Merge "NETCONF-526 : edit-config payload default-operation needs to be set to default...
authorJakub Morvay <jakub.morvay@gmail.com>
Wed, 4 Apr 2018 08:34:19 +0000 (08:34 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 4 Apr 2018 08:34:19 +0000 (08:34 +0000)
189 files changed:
features/restconf/odl-mdsal-apidocs/pom.xml
features/restconf/odl-mdsal-apidocs/src/main/feature/feature.xml [new file with mode: 0644]
features/restconf/odl-restconf-common/pom.xml
features/restconf/odl-restconf-common/src/main/feature/feature.xml
features/restconf/odl-restconf/pom.xml
features/restconf/odl-restconf/src/main/feature/feature.xml [new file with mode: 0644]
netconf/aaa-authn-odl-plugin/pom.xml
netconf/callhome-model/pom.xml
netconf/callhome-protocol/pom.xml
netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/AuthorizedKeysDecoder.java
netconf/callhome-provider/pom.xml
netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/BaseCallHomeTopology.java
netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/CallHomeAuthProviderImpl.java
netconf/callhome-provider/src/main/java/org/opendaylight/netconf/callhome/mount/Configuration.java
netconf/config-netconf-connector/pom.xml
netconf/mdsal-netconf-connector/pom.xml
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/OperationProvider.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/AbstractEdit.java [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/CopyConfig.java [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/EditConfig.java
netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/RuntimeRpc.java
netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/AbstractNetconfOperationTest.java [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/CopyConfigTest.java [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/NetconfMDSalMappingTest.java
netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/SchemaServiceStub.java [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices1.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices2.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices3.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices4.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete_setup.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete_setup_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_container.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_container_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_presence_container.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_presence_container_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_setup.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_setup_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_update.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_update_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_no_config.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_no_source.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_no_target.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_setup.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_setup_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_update.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_update_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_running.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_augmentation.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_augmentation_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_modules.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_modules_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_setup.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_setup_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_update.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_update_control.xml [new file with mode: 0644]
netconf/mdsal-netconf-connector/src/test/resources/yang/mdsal-netconf-mapping-test.yang
netconf/mdsal-netconf-impl/pom.xml
netconf/mdsal-netconf-monitoring/pom.xml
netconf/mdsal-netconf-notification/pom.xml
netconf/mdsal-netconf-ssh/pom.xml
netconf/mdsal-netconf-tcp/pom.xml
netconf/mdsal-netconf-yang-library/pom.xml
netconf/messagebus-netconf/pom.xml
netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSource.java
netconf/messagebus-netconf/src/main/java/org/opendaylight/netconf/messagebus/eventsources/netconf/NetconfEventSourceManager.java
netconf/models/ietf-netconf-monitoring-extension/pom.xml
netconf/models/ietf-netconf-monitoring/pom.xml
netconf/models/ietf-netconf-notifications/pom.xml
netconf/models/ietf-netconf-yang-library/pom.xml
netconf/models/ietf-netconf/pom.xml
netconf/netconf-api/pom.xml
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/NetconfDocumentedException.java
netconf/netconf-api/src/main/java/org/opendaylight/netconf/api/util/NetconfConstants.java
netconf/netconf-auth/pom.xml
netconf/netconf-client/pom.xml
netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/NetconfClientDispatcherImpl.java
netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/NetconfClientSessionNegotiator.java
netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/SimpleNetconfClientSessionListener.java
netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/TcpClientChannelInitializer.java
netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/conf/NetconfClientConfiguration.java
netconf/netconf-console/pom.xml
netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfDisconnectDeviceCommand.java
netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfListDevicesCommand.java
netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/commands/NetconfShowDeviceCommand.java
netconf/netconf-console/src/main/java/org/opendaylight/netconf/console/impl/NetconfCommandsImpl.java
netconf/netconf-impl/pom.xml
netconf/netconf-impl/src/main/java/org/opendaylight/netconf/impl/NetconfServerSessionNegotiator.java
netconf/netconf-impl/src/test/java/org/opendaylight/netconf/impl/MessageParserTest.java
netconf/netconf-mapping-api/pom.xml
netconf/netconf-monitoring/pom.xml
netconf/netconf-monitoring/src/main/java/org/opendaylight/netconf/monitoring/xml/model/MonitoringSchema.java
netconf/netconf-netty-util/pom.xml
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ChunkedFramingMechanismEncoder.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/EOMFramingMechanismEncoder.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/MessageParts.java [new file with mode: 0644]
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/NetconfEOMAggregator.java
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java
netconf/netconf-netty-util/src/test/java/org/opendaylight/netconf/nettyutil/handler/EOMFramingMechanismEncoderTest.java
netconf/netconf-notifications-api/pom.xml
netconf/netconf-notifications-api/src/main/java/org/opendaylight/netconf/notifications/NetconfNotification.java
netconf/netconf-notifications-impl/pom.xml
netconf/netconf-notifications-impl/src/main/java/org/opendaylight/netconf/notifications/impl/ops/NotificationsTransformUtil.java
netconf/netconf-parent/pom.xml [new file with mode: 0644]
netconf/netconf-ssh/pom.xml
netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/SshProxyClientHandler.java
netconf/netconf-ssh/src/main/java/org/opendaylight/netconf/ssh/SshProxyServer.java
netconf/netconf-tcp/pom.xml
netconf/netconf-topology-singleton/pom.xml
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/NetconfTopologyContext.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/RemoteDeviceConnectorImpl.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/NetconfNodeActor.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/actors/ReadAdapter.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/ProxyReadWriteTransaction.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/ProxyWriteAdapter.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/impl/tx/ProxyWriteTransaction.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/CreateInitialMasterActorData.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/RefreshSetupMasterActorData.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/RefreshSlaveActor.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/SchemaPathMessage.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/rpc/InvokeRpcMessage.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/rpc/InvokeRpcMessageReply.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/transactions/NewReadTransactionReply.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/transactions/NewReadTransactionRequest.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/transactions/NewReadWriteTransactionReply.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/transactions/NewWriteTransactionReply.java
netconf/netconf-topology-singleton/src/main/java/org/opendaylight/netconf/topology/singleton/messages/transactions/NewWriteTransactionRequest.java
netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/tx/ProxyReadWriteTransactionTest.java
netconf/netconf-topology-singleton/src/test/java/org/opendaylight/netconf/topology/singleton/impl/tx/ProxyWriteTransactionTest.java
netconf/netconf-topology/pom.xml
netconf/netconf-topology/src/main/java/org/opendaylight/netconf/topology/AbstractNetconfTopology.java
netconf/netconf-util/pom.xml
netconf/netconf-util/src/main/java/org/opendaylight/netconf/util/messages/NetconfMessageConstants.java
netconf/pom.xml
netconf/sal-netconf-connector/pom.xml
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/LibraryModulesSchemas.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfDevice.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/NetconfStateSchemas.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/listener/NetconfDeviceCommunicator.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/listener/UncancellableFuture.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/KeepaliveSalFacade.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceRpc.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/NetconfDeviceTopologyAdapter.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/SchemalessNetconfDeviceRpc.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/AbstractWriteTx.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadWriteTx.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteCandidateTx.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/WriteRunningTx.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/schema/NetconfRemoteSchemaYangSourceProvider.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/schema/YangLibrarySchemaYangSourceProvider.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/schema/mapping/NetconfMessageTransformer.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfBaseOps.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/NetconfRpcFutureCallback.java
netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/util/SchemalessRpcStructureTransformer.java
netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/sal/tx/ReadWriteTxTest.java
netconf/tools/netconf-testtool/pom.xml
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/DummyMonitoringService.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/Execution.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/Main.java
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/ScaleUtil.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/TesttoolParameters.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/http/perf/AsyncExecutionStrategy.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/http/perf/RestPerfClient.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/stress/StressClient.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/customrpc/RpcMapping.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/rpc/SimulatedGetConfig.java
netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/scale/util/ScaleUtilParameters.java
netconf/yanglib/pom.xml
netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibProvider.java
netconf/yanglib/src/main/java/org/opendaylight/yanglib/impl/YangLibServiceImpl.java
pom.xml
protocol-framework/src/main/java/org/opendaylight/protocol/framework/AbstractSessionNegotiator.java
protocol-framework/src/main/java/org/opendaylight/protocol/framework/ReconnectPromise.java
restconf/pom.xml
restconf/restconf-common-models/pom.xml
restconf/restconf-common/pom.xml
restconf/restconf-models/ietf-restconf-monitoring/pom.xml
restconf/restconf-models/ietf-restconf/pom.xml
restconf/restconf-models/ietf-yang-library/pom.xml
restconf/restconf-nb-bierman02/pom.xml
restconf/restconf-nb-bierman02/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestPostOperationTest.java
restconf/restconf-nb-rfc8040/pom.xml
restconf/restconf-parent/pom.xml [moved from restconf/restconf-binding-parent/pom.xml with 98% similarity]
restconf/sal-rest-docgen-maven/pom.xml
restconf/sal-rest-docgen/pom.xml
restconf/sal-restconf-broker/pom.xml

index 76f99fa8d4ef213b56d64434a76fc92ef571b8cb..d9f6be98aff68f5b07a1e79c91b6098614871129 100644 (file)
     <name>OpenDaylight :: MDSAL :: APIDOCS</name>
 
     <dependencies>
+        <dependency>
+            <groupId>org.opendaylight.odlparent</groupId>
+            <artifactId>odl-jackson-2.8</artifactId>
+            <version>3.1.0</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
         <dependency>
             <groupId>org.opendaylight.netconf</groupId>
             <artifactId>odl-restconf</artifactId>
diff --git a/features/restconf/odl-mdsal-apidocs/src/main/feature/feature.xml b/features/restconf/odl-mdsal-apidocs/src/main/feature/feature.xml
new file mode 100644 (file)
index 0000000..58a753b
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright Â© 2018 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
+  -->
+<features name="odl-netconf-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
+    <feature name="odl-mdsal-apidocs" version="${project.version}">
+        <feature version="[3.1.0,4)">odl-jackson-2.8</feature>
+    </feature>
+</features>
index f9954438fed543927cbe77e1d5c2bc85d1e54e35..91cde29b44fabf23b242e965446b7af983a565e8 100644 (file)
 
         <!-- TODO: Remove this when RESTCONF is converted to GSON -->
         <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-annotations</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-databind</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.datatype</groupId>
-            <artifactId>jackson-datatype-json-org</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.jaxrs</groupId>
-            <artifactId>jackson-jaxrs-base</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.jaxrs</groupId>
-            <artifactId>jackson-jaxrs-json-provider</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.fasterxml.jackson.module</groupId>
-            <artifactId>jackson-module-jaxb-annotations</artifactId>
+            <groupId>org.opendaylight.odlparent</groupId>
+            <artifactId>odl-jackson-2.8</artifactId>
+            <version>3.1.0</version>
+            <type>xml</type>
+            <classifier>features</classifier>
         </dependency>
     </dependencies>
 </project>
index 52d3328f607b5ff187d9ad962d3ea4890ff4eb9c..6b0dce279f2b8d5912474d0d8713e2b81af03fbd 100644 (file)
@@ -9,6 +9,7 @@
 <features name="odl-netconf-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
     <feature name="odl-restconf-common" version="${project.version}">
         <feature version="[3.0.0,4)">odl-karaf-feat-jetty</feature>
+        <feature version="[3.1.0,4)">odl-jackson-2.8</feature>
         <feature version="[2.0.1,3)">odl-yangtools-export</feature>
     </feature>
 </features>
index 194a6d6b89c2285e634073d86a2ea9a656844985..0ea252b33f2d59cc5e0e752f2bc59796a9db7103 100644 (file)
             <type>xml</type>
             <classifier>features</classifier>
         </dependency>
+
+        <dependency>
+            <groupId>org.opendaylight.odlparent</groupId>
+            <artifactId>odl-jackson-2.8</artifactId>
+            <version>3.1.0</version>
+            <type>xml</type>
+            <classifier>features</classifier>
+        </dependency>
     </dependencies>
 </project>
\ No newline at end of file
diff --git a/features/restconf/odl-restconf/src/main/feature/feature.xml b/features/restconf/odl-restconf/src/main/feature/feature.xml
new file mode 100644 (file)
index 0000000..8d583bf
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Copyright Â© 2018 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
+  -->
+<features name="odl-netconf-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
+    <feature name="odl-restconf" version="${project.version}">
+        <feature version="[3.1.0,4)">odl-jackson-2.8</feature>
+    </feature>
+</features>
index f330e7f851237c214b2366c191b2979b4e589919..55027f77757f4f145089560e42b75dbba22389b8 100644 (file)
     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>bundle-parent</artifactId>
-        <version>3.0.2</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
     <version>1.5.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.aaa</groupId>
-                <artifactId>aaa-artifacts</artifactId>
-                <version>0.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <dependency>
             <groupId>org.opendaylight.aaa</groupId>
         </dependency>
     </dependencies>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
-
 </project>
index ccc51378534649ebcd213e6e4bc6bac8221fefb8..7b82563c236813099ce557872d05f00a2e32937f 100644 (file)
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.opendaylight.mdsal</groupId>
-        <artifactId>binding-parent</artifactId>
-        <version>0.13.0-SNAPSHOT</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
index df130b804af8aca8bf3d592cd02e7736769d3921..10cd6ceb94bf0b8e3ba1e4ba3f64397bc3b6ac37 100644 (file)
@@ -9,10 +9,10 @@
 <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.mdsal</groupId>
-    <artifactId>binding-parent</artifactId>
-    <version>0.13.0-SNAPSHOT</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <dependency>
       <groupId>org.opendaylight.netconf</groupId>
       <scope>test</scope>
     </dependency>
   </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
 </project>
index e544195fd8045c32bcc8ffb6d008e45b9fbc6584..7e07568a632e39042c3983686cf48d08ee59defb 100644 (file)
@@ -11,6 +11,7 @@ import java.io.ByteArrayOutputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
 import java.math.BigInteger;
+import java.nio.charset.StandardCharsets;
 import java.security.GeneralSecurityException;
 import java.security.KeyFactory;
 import java.security.PublicKey;
@@ -63,7 +64,7 @@ public class AuthorizedKeysDecoder {
 
         // look for the Base64 encoded part of the line to decode
         // both ssh-rsa and ssh-dss begin with "AAAA" due to the length bytes
-        bytes = Base64.getDecoder().decode(keyLine.getBytes());
+        bytes = Base64.getDecoder().decode(keyLine.getBytes(StandardCharsets.UTF_8));
         if (bytes.length == 0) {
             throw new IllegalArgumentException("No Base64 part to decode in " + keyLine);
         }
@@ -121,7 +122,7 @@ public class AuthorizedKeysDecoder {
 
     private String decodeType() {
         int len = decodeInt();
-        String type = new String(bytes, pos, len);
+        String type = new String(bytes, pos, len, StandardCharsets.UTF_8);
         pos += len;
         return type;
     }
@@ -140,23 +141,22 @@ public class AuthorizedKeysDecoder {
     }
 
     public static String encodePublicKey(final PublicKey publicKey) throws IOException {
-        String publicKeyEncoded;
         ByteArrayOutputStream byteOs = new ByteArrayOutputStream();
-        if (publicKey.getAlgorithm().equals(KEY_FACTORY_TYPE_RSA)) {
+        if (publicKey.getAlgorithm().equals(KEY_FACTORY_TYPE_RSA) && publicKey instanceof RSAPublicKey) {
             RSAPublicKey rsaPublicKey = (RSAPublicKey) publicKey;
             DataOutputStream dout = new DataOutputStream(byteOs);
-            dout.writeInt(KEY_TYPE_RSA.getBytes().length);
-            dout.write(KEY_TYPE_RSA.getBytes());
+            dout.writeInt(KEY_TYPE_RSA.getBytes(StandardCharsets.UTF_8).length);
+            dout.write(KEY_TYPE_RSA.getBytes(StandardCharsets.UTF_8));
             dout.writeInt(rsaPublicKey.getPublicExponent().toByteArray().length);
             dout.write(rsaPublicKey.getPublicExponent().toByteArray());
             dout.writeInt(rsaPublicKey.getModulus().toByteArray().length);
             dout.write(rsaPublicKey.getModulus().toByteArray());
-        } else if (publicKey.getAlgorithm().equals(KEY_FACTORY_TYPE_DSA)) {
+        } else if (publicKey.getAlgorithm().equals(KEY_FACTORY_TYPE_DSA) && publicKey instanceof DSAPublicKey) {
             DSAPublicKey dsaPublicKey = (DSAPublicKey) publicKey;
             DSAParams dsaParams = dsaPublicKey.getParams();
             DataOutputStream dout = new DataOutputStream(byteOs);
-            dout.writeInt(KEY_TYPE_DSA.getBytes().length);
-            dout.write(KEY_TYPE_DSA.getBytes());
+            dout.writeInt(KEY_TYPE_DSA.getBytes(StandardCharsets.UTF_8).length);
+            dout.write(KEY_TYPE_DSA.getBytes(StandardCharsets.UTF_8));
             dout.writeInt(dsaParams.getP().toByteArray().length);
             dout.write(dsaParams.getP().toByteArray());
             dout.writeInt(dsaParams.getQ().toByteArray().length);
@@ -165,13 +165,13 @@ public class AuthorizedKeysDecoder {
             dout.write(dsaParams.getG().toByteArray());
             dout.writeInt(dsaPublicKey.getY().toByteArray().length);
             dout.write(dsaPublicKey.getY().toByteArray());
-        } else if (publicKey.getAlgorithm().equals(KEY_FACTORY_TYPE_ECDSA)) {
+        } else if (publicKey.getAlgorithm().equals(KEY_FACTORY_TYPE_ECDSA) && publicKey instanceof BCECPublicKey) {
             BCECPublicKey ecPublicKey = (BCECPublicKey) publicKey;
             DataOutputStream dout = new DataOutputStream(byteOs);
-            dout.writeInt(KEY_TYPE_ECDSA.getBytes().length);
-            dout.write(KEY_TYPE_ECDSA.getBytes());
-            dout.writeInt(ECDSA_SUPPORTED_CURVE_NAME.getBytes().length);
-            dout.write(ECDSA_SUPPORTED_CURVE_NAME.getBytes());
+            dout.writeInt(KEY_TYPE_ECDSA.getBytes(StandardCharsets.UTF_8).length);
+            dout.write(KEY_TYPE_ECDSA.getBytes(StandardCharsets.UTF_8));
+            dout.writeInt(ECDSA_SUPPORTED_CURVE_NAME.getBytes(StandardCharsets.UTF_8).length);
+            dout.write(ECDSA_SUPPORTED_CURVE_NAME.getBytes(StandardCharsets.UTF_8));
 
             byte[] coordX = ecPublicKey.getQ().getAffineXCoord().getEncoded();
             byte[] coordY = ecPublicKey.getQ().getAffineYCoord().getEncoded();
@@ -182,7 +182,6 @@ public class AuthorizedKeysDecoder {
         } else {
             throw new IllegalArgumentException("Unknown public key encoding: " + publicKey.getAlgorithm());
         }
-        publicKeyEncoded = new String(Base64.getEncoder().encodeToString(byteOs.toByteArray()));
-        return publicKeyEncoded;
+        return Base64.getEncoder().encodeToString(byteOs.toByteArray());
     }
 }
index 1a7602c0d6d675cd709d6f9eab7a809292f9af3e..1a2934f66846c8530b915ee32f0692b0d5d4b7d7 100644 (file)
@@ -4,10 +4,10 @@
          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.mdsal</groupId>
-        <artifactId>binding-parent</artifactId>
-        <version>0.13.0-SNAPSHOT</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
     <version>1.5.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>mockito-core</artifactId>
         </dependency>
     </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>
index 0fcfb82fc79e8268e37228fc2ff3a6fb6bab17d2..d4f9e132b8ed0429de94999b077db6dde98fab7c 100644 (file)
@@ -19,9 +19,6 @@ import org.opendaylight.netconf.topology.AbstractNetconfTopology;
 import org.opendaylight.netconf.topology.api.SchemaRepositoryProvider;
 
 abstract class BaseCallHomeTopology extends AbstractNetconfTopology {
-
-    protected DOMMountPointService mountPointService = null;
-
     BaseCallHomeTopology(final String topologyId, final NetconfClientDispatcher clientDispatcher,
                          final EventExecutor eventExecutor,
                          final ScheduledThreadPool keepaliveExecutor,
@@ -33,6 +30,5 @@ abstract class BaseCallHomeTopology extends AbstractNetconfTopology {
         super(topologyId, clientDispatcher, eventExecutor, keepaliveExecutor,
               processingExecutor, schemaRepositoryProvider, dataBroker, mountPointService,
               encryptionService);
-        this.mountPointService = mountPointService;
     }
 }
index 29632c247f1f4caf420b94009db530aab6b7d864..15445eb7460a39943163d5c5c1cae1b776acf607 100644 (file)
@@ -126,7 +126,7 @@ public class CallHomeAuthProviderImpl implements CallHomeAuthorizationProvider,
         return remoteAddress.toString();
     }
 
-    private class DeviceConfig implements DataTreeChangeListener<Device> {
+    private static class DeviceConfig implements DataTreeChangeListener<Device> {
 
         private final AuthorizedKeysDecoder keyDecoder = new AuthorizedKeysDecoder();
 
@@ -189,7 +189,7 @@ public class CallHomeAuthProviderImpl implements CallHomeAuthorizationProvider,
         }
     }
 
-    private class DeviceOp implements DataTreeChangeListener<Device> {
+    private static class DeviceOp implements DataTreeChangeListener<Device> {
 
         private final ConcurrentMap<String, Device> byPublicKey = new ConcurrentHashMap<>();
 
@@ -242,7 +242,7 @@ public class CallHomeAuthProviderImpl implements CallHomeAuthorizationProvider,
         }
     }
 
-    private class GlobalConfig implements DataTreeChangeListener<Global> {
+    private static class GlobalConfig implements DataTreeChangeListener<Global> {
 
         private volatile Global current = null;
 
index 713b7ec4a5837c7dcf1f038f3cf78bc0a41eb90e..14ab22a7f66af1978e4a0cf5a209de0fb9b843ae 100644 (file)
@@ -69,16 +69,13 @@ public class Configuration {
         }
     }
 
-    private final String path;
     private Properties properties;
 
     public Configuration() {
-        path = "<no-path>";
         properties = new Properties();
     }
 
     public Configuration(final String path) throws ConfigurationException {
-        this.path = path;
         try {
             this.properties = readFromPath(path);
         } catch (IOException ioe) {
index 1c57d160a19ce5a7c5f6ff29ed54b8f1097a7719..dfd0621be8c0980f91d24674572d68ad5f0fb30b 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
 
   <dependencyManagement>
     <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>config-artifacts</artifactId>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.mdsal</groupId>
-        <artifactId>mdsal-artifacts</artifactId>
-        <version>2.5.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
     </dependencies>
   </dependencyManagement>
 
           </instructions>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 
index c22437f543ee8ec6e0333d69cf4f067bd6649853..34c07edc771f48bf6697f383cd4b1d4d6444e1d7 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>mdsal-artifacts</artifactId>
-        <version>1.8.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-data-codec-xml</artifactId>
     </dependency>
   </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
 </project>
index e74b0bdf4bf0a0187744e159195f2d742f5f9d38..59ccc29f084472546ec3c8adfaf7e54161e28077 100644 (file)
@@ -14,6 +14,7 @@ import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
 import org.opendaylight.netconf.mapping.api.NetconfOperation;
 import org.opendaylight.netconf.mdsal.connector.ops.Commit;
+import org.opendaylight.netconf.mdsal.connector.ops.CopyConfig;
 import org.opendaylight.netconf.mdsal.connector.ops.DiscardChanges;
 import org.opendaylight.netconf.mdsal.connector.ops.EditConfig;
 import org.opendaylight.netconf.mdsal.connector.ops.Lock;
@@ -35,6 +36,7 @@ final class OperationProvider {
             new Commit(netconfSessionIdForReporting, transactionProvider),
             new DiscardChanges(netconfSessionIdForReporting, transactionProvider),
             new EditConfig(netconfSessionIdForReporting, schemaContext, transactionProvider),
+            new CopyConfig(netconfSessionIdForReporting, schemaContext, transactionProvider),
             new Get(netconfSessionIdForReporting, schemaContext, transactionProvider),
             new GetConfig(netconfSessionIdForReporting, schemaContext, transactionProvider),
             new Lock(netconfSessionIdForReporting),
diff --git a/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/AbstractEdit.java b/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/AbstractEdit.java
new file mode 100644 (file)
index 0000000..125f6b9
--- /dev/null
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2018 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.mdsal.connector.ops;
+
+import com.google.common.base.Optional;
+import com.google.common.base.Strings;
+import com.google.common.collect.ImmutableMap;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Iterator;
+import java.util.Map;
+import javax.xml.transform.dom.DOMSource;
+import org.opendaylight.controller.config.util.xml.DocumentedException;
+import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorSeverity;
+import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorTag;
+import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorType;
+import org.opendaylight.controller.config.util.xml.XmlElement;
+import org.opendaylight.netconf.api.NetconfDocumentedException;
+import org.opendaylight.netconf.mdsal.connector.CurrentSchemaContext;
+import org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation;
+import org.opendaylight.yangtools.yang.common.QName;
+import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
+import org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream;
+import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+abstract class AbstractEdit extends AbstractSingletonNetconfOperation {
+    private static final Logger LOG = LoggerFactory.getLogger(AbstractEdit.class);
+    private static final String TARGET_KEY = "target";
+
+    protected final CurrentSchemaContext schemaContext;
+
+    protected AbstractEdit(final String netconfSessionIdForReporting, final CurrentSchemaContext schemaContext) {
+        super(netconfSessionIdForReporting);
+        this.schemaContext = schemaContext;
+    }
+
+    @SuppressWarnings("checkstyle:IllegalCatch")
+    protected void parseIntoNormalizedNode(final DataSchemaNode schemaNode, final XmlElement element,
+                                         final NormalizedNodeStreamWriter writer) throws DocumentedException {
+        if (!(schemaNode instanceof ContainerSchemaNode) && !(schemaNode instanceof ListSchemaNode)) {
+            // This should never happen since any edit operation on any other node type
+            // should not be possible nor makes sense
+            LOG.debug("DataNode from module is not ContainerSchemaNode nor ListSchemaNode, aborting..");
+            throw new UnsupportedOperationException("implement exception if parse fails");
+        }
+
+        final XmlParserStream xmlParser = XmlParserStream.create(writer, schemaContext.getCurrentContext(), schemaNode);
+        try {
+            xmlParser.traverse(new DOMSource(element.getDomElement()));
+        } catch (final Exception ex) {
+            throw new NetconfDocumentedException("Error parsing input: " + ex.getMessage(), ex, ErrorType.PROTOCOL,
+                ErrorTag.MALFORMED_MESSAGE, ErrorSeverity.ERROR);
+        }
+    }
+
+    protected DataSchemaNode getSchemaNodeFromNamespace(final String namespace, final XmlElement element)
+        throws DocumentedException {
+        final Iterator<Module> it;
+        try {
+            // Returns module with newest revision since findModuleByNamespace returns a set of modules and we only
+            // need the newest one
+            it = schemaContext.getCurrentContext().findModules(new URI(namespace)).iterator();
+        } catch (final URISyntaxException e) {
+            throw new NetconfDocumentedException("Unable to create URI for namespace : " + namespace, e,
+                ErrorType.APPLICATION, ErrorTag.INVALID_VALUE, ErrorSeverity.ERROR);
+        }
+
+        if (!it.hasNext()) {
+            // No module is present with this namespace
+            throw new NetconfDocumentedException("Unable to find module by namespace: " + namespace,
+                ErrorType.APPLICATION, ErrorTag.UNKNOWN_NAMESPACE, ErrorSeverity.ERROR);
+        }
+
+        final Module module = it.next();
+        final java.util.Optional<DataSchemaNode> schemaNode =
+            module.findDataChildByName(QName.create(module.getQNameModule(), element.getName()));
+        if (!schemaNode.isPresent()) {
+            throw new DocumentedException(
+                "Unable to find node with namespace: " + namespace + "in module: " + module.toString(),
+                ErrorType.APPLICATION,
+                ErrorTag.UNKNOWN_NAMESPACE,
+                ErrorSeverity.ERROR);
+        }
+
+        return schemaNode.get();
+    }
+
+    protected static Datastore extractTargetParameter(final XmlElement operationElement, final String operationName)
+        throws DocumentedException {
+        final NodeList elementsByTagName = getElementsByTagName(operationElement, TARGET_KEY);
+        // Direct lookup instead of using XmlElement class due to performance
+        if (elementsByTagName.getLength() == 0) {
+            final Map<String, String> errorInfo = ImmutableMap.of("bad-attribute", TARGET_KEY, "bad-element",
+                operationName);
+            throw new DocumentedException("Missing target element", ErrorType.PROTOCOL, ErrorTag.MISSING_ATTRIBUTE,
+                ErrorSeverity.ERROR, errorInfo);
+        } else if (elementsByTagName.getLength() > 1) {
+            throw new DocumentedException("Multiple target elements", ErrorType.RPC, ErrorTag.UNKNOWN_ATTRIBUTE,
+                ErrorSeverity.ERROR);
+        } else {
+            final XmlElement targetChildNode =
+                XmlElement.fromDomElement((Element) elementsByTagName.item(0)).getOnlyChildElement();
+            return Datastore.valueOf(targetChildNode.getName());
+        }
+    }
+
+    protected static XmlElement getElement(final XmlElement parent, final String elementName)
+        throws DocumentedException {
+        final Optional<XmlElement> childNode = parent.getOnlyChildElementOptionally(elementName);
+        if (!childNode.isPresent()) {
+            throw new DocumentedException(elementName + " element is missing",
+                ErrorType.PROTOCOL,
+                ErrorTag.MISSING_ELEMENT,
+                ErrorSeverity.ERROR);
+        }
+
+        return childNode.get();
+    }
+
+    protected static NodeList getElementsByTagName(final XmlElement parent, final String key) throws
+        DocumentedException {
+        final Element domParent = parent.getDomElement();
+        final NodeList elementsByTagName;
+
+        if (Strings.isNullOrEmpty(domParent.getPrefix())) {
+            elementsByTagName = domParent.getElementsByTagName(key);
+        } else {
+            elementsByTagName = domParent.getElementsByTagNameNS(parent.getNamespace(), key);
+        }
+
+        return elementsByTagName;
+    }
+}
diff --git a/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/CopyConfig.java b/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/netconf/mdsal/connector/ops/CopyConfig.java
new file mode 100644 (file)
index 0000000..9f0f9d9
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2018 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.mdsal.connector.ops;
+
+import com.google.common.base.Optional;
+import org.opendaylight.controller.config.util.xml.DocumentedException;
+import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorSeverity;
+import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorTag;
+import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorType;
+import org.opendaylight.controller.config.util.xml.XmlElement;
+import org.opendaylight.controller.config.util.xml.XmlUtil;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
+import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
+import org.opendaylight.netconf.mdsal.connector.CurrentSchemaContext;
+import org.opendaylight.netconf.mdsal.connector.TransactionProvider;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
+import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
+import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
+import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
+import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNormalizedNodeStreamWriter;
+import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
+import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+public final class CopyConfig extends AbstractEdit {
+    private static final String OPERATION_NAME = "copy-config";
+    private static final String CONFIG_KEY = "config";
+    private static final String SOURCE_KEY = "source";
+
+    // Top-level "data" node without child nodes
+    private static final ContainerNode EMPTY_ROOT_NODE = Builders.containerBuilder()
+        .withNodeIdentifier(new YangInstanceIdentifier.NodeIdentifier(SchemaContext.NAME)).build();
+
+    private final TransactionProvider transactionProvider;
+
+    public CopyConfig(final String netconfSessionIdForReporting, final CurrentSchemaContext schemaContext,
+                      final TransactionProvider transactionProvider) {
+        super(netconfSessionIdForReporting, schemaContext);
+        this.transactionProvider = transactionProvider;
+    }
+
+    @Override
+    protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement)
+            throws DocumentedException {
+        final Datastore targetDatastore = extractTargetParameter(operationElement, OPERATION_NAME);
+        if (targetDatastore == Datastore.running) {
+            throw new DocumentedException("edit-config on running datastore is not supported",
+                    ErrorType.PROTOCOL,
+                    ErrorTag.OPERATION_NOT_SUPPORTED,
+                    ErrorSeverity.ERROR);
+        }
+        final XmlElement configElement = extractConfigParameter(operationElement);
+
+        // <copy-config>, unlike <edit-config>, always replaces entire configuration,
+        // so remove old configuration first:
+        final DOMDataReadWriteTransaction rwTx = transactionProvider.getOrCreateTransaction();
+        rwTx.put(LogicalDatastoreType.CONFIGURATION, YangInstanceIdentifier.EMPTY, EMPTY_ROOT_NODE);
+
+        // Then create nodes present in the <config> element:
+        for (final XmlElement element : configElement.getChildElements()) {
+            final String ns = element.getNamespace();
+            final DataSchemaNode schemaNode = getSchemaNodeFromNamespace(ns, element);
+            final NormalizedNodeResult resultHolder = new NormalizedNodeResult();
+            parseIntoNormalizedNode(schemaNode, element, ImmutableNormalizedNodeStreamWriter.from(resultHolder));
+            final NormalizedNode<?, ?> data = resultHolder.getResult();
+            final YangInstanceIdentifier path = YangInstanceIdentifier.create(data.getIdentifier());
+            // Doing merge instead of put to support top-level list:
+            rwTx.merge(LogicalDatastoreType.CONFIGURATION, path, data);
+        }
+        return XmlUtil.createElement(document, XmlNetconfConstants.OK, Optional.absent());
+    }
+
+    private static XmlElement extractConfigParameter(final XmlElement operationElement) throws DocumentedException {
+        final XmlElement source = getElement(operationElement, SOURCE_KEY);
+        return getElement(source, CONFIG_KEY);
+    }
+
+    @Override
+    protected String getOperationName() {
+        return OPERATION_NAME;
+    }
+}
index cfb59b871f0df643b9c8febb89bb4591ca8b8aa5..2da085290e7c434588f6226569d51cf906d3a57f 100644 (file)
@@ -8,20 +8,12 @@
 
 package org.opendaylight.netconf.mdsal.connector.ops;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import com.google.common.base.Strings;
-import com.google.common.collect.ImmutableMap;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.Iterator;
 import java.util.List;
 import java.util.ListIterator;
-import java.util.Map;
 import java.util.concurrent.ExecutionException;
 import java.util.stream.Collectors;
-import javax.xml.transform.dom.DOMSource;
 import org.opendaylight.controller.config.util.xml.DocumentedException;
 import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorSeverity;
 import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorTag;
@@ -30,27 +22,20 @@ import org.opendaylight.controller.config.util.xml.XmlElement;
 import org.opendaylight.controller.config.util.xml.XmlUtil;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
-import org.opendaylight.netconf.api.NetconfDocumentedException;
 import org.opendaylight.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.netconf.mdsal.connector.CurrentSchemaContext;
 import org.opendaylight.netconf.mdsal.connector.TransactionProvider;
 import org.opendaylight.netconf.mdsal.connector.ops.DataTreeChangeTracker.DataTreeChange;
-import org.opendaylight.netconf.util.mapping.AbstractSingletonNetconfOperation;
-import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.ModifyAction;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.AugmentationNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.opendaylight.yangtools.yang.data.api.schema.MapNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
-import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
-import org.opendaylight.yangtools.yang.data.codec.xml.XmlParserStream;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
 import org.opendaylight.yangtools.yang.data.impl.schema.NormalizedNodeResult;
-import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
 import org.opendaylight.yangtools.yang.model.api.ListSchemaNode;
-import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaNode;
 import org.opendaylight.yangtools.yang.model.util.SchemaContextUtil;
 import org.slf4j.Logger;
@@ -59,28 +44,25 @@ import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
 
-public class EditConfig extends AbstractSingletonNetconfOperation {
+public final class EditConfig extends AbstractEdit {
 
     private static final Logger LOG = LoggerFactory.getLogger(EditConfig.class);
 
     private static final String OPERATION_NAME = "edit-config";
     private static final String CONFIG_KEY = "config";
-    private static final String TARGET_KEY = "target";
     private static final String DEFAULT_OPERATION_KEY = "default-operation";
-    private final CurrentSchemaContext schemaContext;
     private final TransactionProvider transactionProvider;
 
     public EditConfig(final String netconfSessionIdForReporting, final CurrentSchemaContext schemaContext,
             final TransactionProvider transactionProvider) {
-        super(netconfSessionIdForReporting);
-        this.schemaContext = schemaContext;
+        super(netconfSessionIdForReporting, schemaContext);
         this.transactionProvider = transactionProvider;
     }
 
     @Override
     protected Element handleWithNoSubsequentOperations(final Document document, final XmlElement operationElement)
             throws DocumentedException {
-        final Datastore targetDatastore = extractTargetParameter(operationElement);
+        final Datastore targetDatastore = extractTargetParameter(operationElement, OPERATION_NAME);
         if (targetDatastore == Datastore.running) {
             throw new DocumentedException("edit-config on running datastore is not supported",
                     ErrorType.PROTOCOL,
@@ -94,11 +76,10 @@ public class EditConfig extends AbstractSingletonNetconfOperation {
 
         for (final XmlElement element : configElement.getChildElements()) {
             final String ns = element.getNamespace();
-            final DataSchemaNode schemaNode = getSchemaNodeFromNamespace(ns, element).get();
-
+            final DataSchemaNode schemaNode = getSchemaNodeFromNamespace(ns, element);
             final DataTreeChangeTracker changeTracker = new DataTreeChangeTracker(defaultAction);
-
-            parseIntoNormalizedNode(schemaNode, element, changeTracker);
+            parseIntoNormalizedNode(schemaNode, element,
+                new EditOperationNormalizedNodeStreamWriter(new NormalizedNodeResult(), changeTracker));
             executeOperations(changeTracker);
         }
 
@@ -208,81 +189,6 @@ public class EditConfig extends AbstractSingletonNetconfOperation {
         }
     }
 
-    @SuppressWarnings("checkstyle:IllegalCatch")
-    private NormalizedNode<?, ?> parseIntoNormalizedNode(final DataSchemaNode schemaNode, final XmlElement element,
-            final DataTreeChangeTracker changeTracker) throws DocumentedException {
-        if (!(schemaNode instanceof ContainerSchemaNode) && !(schemaNode instanceof ListSchemaNode)) {
-            //this should never happen since edit-config on any other node type should not be possible nor makes sense
-            LOG.debug("DataNode from module is not ContainerSchemaNode nor ListSchemaNode, aborting..");
-            throw new UnsupportedOperationException("implement exception if parse fails");
-        }
-
-        final NormalizedNodeResult resultHolder = new NormalizedNodeResult();
-        final NormalizedNodeStreamWriter writer = new EditOperationNormalizedNodeStreamWriter(resultHolder,
-                changeTracker);
-        final XmlParserStream xmlParser = XmlParserStream.create(writer, schemaContext.getCurrentContext(), schemaNode);
-        try {
-            xmlParser.traverse(new DOMSource(element.getDomElement()));
-        } catch (final Exception ex) {
-            throw new NetconfDocumentedException("Error parsing input: " + ex.getMessage(), ex, ErrorType.PROTOCOL,
-                    ErrorTag.MALFORMED_MESSAGE, ErrorSeverity.ERROR);
-        }
-
-        return resultHolder.getResult();
-    }
-
-    private Optional<DataSchemaNode> getSchemaNodeFromNamespace(final String namespace, final XmlElement element)
-            throws DocumentedException {
-        final Iterator<Module> it;
-        try {
-            // returns module with newest revision since findModuleByNamespace returns a set of modules and we only
-            // need the newest one
-            it = schemaContext.getCurrentContext().findModules(new URI(namespace)).iterator();
-        } catch (final URISyntaxException e) {
-            LOG.debug("Unable to create URI for namespace : {}", namespace);
-            return Optional.absent();
-        }
-
-        if (!it.hasNext()) {
-            // no module is present with this namespace
-            throw new NetconfDocumentedException("Unable to find module by namespace: " + namespace,
-                ErrorType.APPLICATION, ErrorTag.UNKNOWN_NAMESPACE, ErrorSeverity.ERROR);
-        }
-
-        final Module module = it.next();
-        final java.util.Optional<DataSchemaNode> schemaNode =
-                module.findDataChildByName(QName.create(module.getQNameModule(), element.getName()));
-        if (!schemaNode.isPresent()) {
-            if (schemaNode != null) {
-                throw new DocumentedException(
-                    "Unable to find node with namespace: " + namespace + "in module: " + module.toString(),
-                    ErrorType.APPLICATION,
-                    ErrorTag.UNKNOWN_NAMESPACE,
-                    ErrorSeverity.ERROR);
-            }
-        }
-
-        return Optional.fromJavaUtil(schemaNode);
-    }
-
-    private static Datastore extractTargetParameter(final XmlElement operationElement) throws DocumentedException {
-        final NodeList elementsByTagName = getElementsByTagName(operationElement, TARGET_KEY);
-        // Direct lookup instead of using XmlElement class due to performance
-        if (elementsByTagName.getLength() == 0) {
-            final Map<String, String> errorInfo = ImmutableMap.of("bad-attribute", TARGET_KEY, "bad-element",
-                OPERATION_NAME);
-            throw new DocumentedException("Missing target element", ErrorType.PROTOCOL, ErrorTag.MISSING_ATTRIBUTE,
-                ErrorSeverity.ERROR, errorInfo);
-        } else if (elementsByTagName.getLength() > 1) {
-            throw new DocumentedException("Multiple target elements", ErrorType.RPC, ErrorTag.UNKNOWN_ATTRIBUTE,
-                ErrorSeverity.ERROR);
-        } else {
-            final XmlElement targetChildNode =
-                    XmlElement.fromDomElement((Element) elementsByTagName.item(0)).getOnlyChildElement();
-            return Datastore.valueOf(targetChildNode.getName());
-        }
-    }
-
     private static ModifyAction getDefaultOperation(final XmlElement operationElement) throws DocumentedException {
         final NodeList elementsByTagName = getElementsByTagName(operationElement, DEFAULT_OPERATION_KEY);
         if (elementsByTagName.getLength() == 0) {
@@ -296,34 +202,6 @@ public class EditConfig extends AbstractSingletonNetconfOperation {
 
     }
 
-    private static XmlElement getElement(final XmlElement operationElement, final String elementName)
-            throws DocumentedException {
-        final Optional<XmlElement> childNode = operationElement.getOnlyChildElementOptionally(elementName);
-        if (!childNode.isPresent()) {
-            throw new DocumentedException(elementName + " element is missing",
-                    ErrorType.PROTOCOL,
-                    ErrorTag.MISSING_ELEMENT,
-                    ErrorSeverity.ERROR);
-        }
-
-        return childNode.get();
-    }
-
-    @VisibleForTesting
-    static NodeList getElementsByTagName(final XmlElement operationElement, final String key) throws
-            DocumentedException {
-        final Element element = operationElement.getDomElement();
-        final NodeList elementsByTagName;
-
-        if (Strings.isNullOrEmpty(element.getPrefix())) {
-            elementsByTagName = element.getElementsByTagName(key);
-        } else {
-            elementsByTagName = element.getElementsByTagNameNS(operationElement.getNamespace(), key);
-        }
-
-        return elementsByTagName;
-    }
-
     @Override
     protected String getOperationName() {
         return OPERATION_NAME;
index 6d4ba4305ae99a1799d5e8ed90f768e76f44172a..d61c249cfd2df18181cba3d8fe01ba3d89a2d98b 100644 (file)
@@ -259,7 +259,7 @@ public class RuntimeRpc extends AbstractSingletonNetconfOperation {
     @Nullable
     private NormalizedNode<?, ?> rpcToNNode(final XmlElement element, @Nullable final ContainerSchemaNode input)
             throws DocumentedException {
-        if (input.getChildNodes().isEmpty()) {
+        if (input == null || input.getChildNodes().isEmpty()) {
             return null;
         }
 
diff --git a/netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/AbstractNetconfOperationTest.java b/netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/AbstractNetconfOperationTest.java
new file mode 100644 (file)
index 0000000..555f201
--- /dev/null
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2018 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.mdsal.connector.ops;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import com.google.common.io.ByteSource;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.MoreExecutors;
+import java.io.StringWriter;
+import java.util.EnumMap;
+import java.util.concurrent.ExecutorService;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import org.custommonkey.xmlunit.DetailedDiff;
+import org.custommonkey.xmlunit.Diff;
+import org.custommonkey.xmlunit.XMLUnit;
+import org.junit.Before;
+import org.mockito.MockitoAnnotations;
+import org.opendaylight.controller.config.util.xml.XmlUtil;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
+import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreFactory;
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.controller.sal.core.spi.data.DOMStore;
+import org.opendaylight.netconf.mapping.api.NetconfOperation;
+import org.opendaylight.netconf.mapping.api.NetconfOperationChainedExecution;
+import org.opendaylight.netconf.mdsal.connector.CurrentSchemaContext;
+import org.opendaylight.netconf.mdsal.connector.TransactionProvider;
+import org.opendaylight.netconf.mdsal.connector.ops.get.Get;
+import org.opendaylight.netconf.mdsal.connector.ops.get.GetConfig;
+import org.opendaylight.netconf.util.test.NetconfXmlUnitRecursiveQualifier;
+import org.opendaylight.netconf.util.test.XmlFileLoader;
+import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+abstract class AbstractNetconfOperationTest {
+    private static final Logger LOG = LoggerFactory.getLogger(AbstractNetconfOperationTest.class);
+    protected static final String SESSION_ID_FOR_REPORTING = "netconf-test-session1";
+    private static final String RPC_REPLY_ELEMENT = "rpc-reply";
+    private static final String DATA_ELEMENT = "data";
+    protected static final Document RPC_REPLY_OK = getReplyOk();
+
+    private CurrentSchemaContext currentSchemaContext;
+    private TransactionProvider transactionProvider;
+
+    @Before
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+
+        XMLUnit.setIgnoreWhitespace(true);
+        XMLUnit.setIgnoreAttributeOrder(true);
+
+        final SchemaContext schemaContext = getSchemaContext();
+        final SchemaService schemaService = new SchemaServiceStub(schemaContext);
+        final DOMStore operStore = InMemoryDOMDataStoreFactory.create("DOM-OPER", schemaService);
+        final DOMStore configStore = InMemoryDOMDataStoreFactory.create("DOM-CFG", schemaService);
+
+        currentSchemaContext = new CurrentSchemaContext(schemaService, sourceIdentifier -> {
+            final YangTextSchemaSource yangTextSchemaSource =
+                YangTextSchemaSource.delegateForByteSource(sourceIdentifier, ByteSource.wrap("module test".getBytes()));
+            return Futures.immediateCheckedFuture(yangTextSchemaSource);
+        });
+
+        final EnumMap<LogicalDatastoreType, DOMStore> datastores = new EnumMap<>(LogicalDatastoreType.class);
+        datastores.put(LogicalDatastoreType.CONFIGURATION, configStore);
+        datastores.put(LogicalDatastoreType.OPERATIONAL, operStore);
+
+        final ExecutorService listenableFutureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(
+            16, 16, "CommitFutures", CopyConfigTest.class);
+
+        final SerializedDOMDataBroker sdb = new SerializedDOMDataBroker(datastores,
+            MoreExecutors.listeningDecorator(listenableFutureExecutor));
+        this.transactionProvider = new TransactionProvider(sdb, SESSION_ID_FOR_REPORTING);
+    }
+
+    protected abstract SchemaContext getSchemaContext();
+
+    protected CurrentSchemaContext getCurrentSchemaContext() {
+        return currentSchemaContext;
+    }
+
+    protected TransactionProvider getTransactionProvider() {
+        return transactionProvider;
+    }
+
+    @SuppressWarnings("illegalCatch")
+    private static Document getReplyOk() {
+        Document doc;
+        try {
+            doc = XmlFileLoader.xmlFileToDocument("messages/mapping/rpc-reply_ok.xml");
+        } catch (final Exception e) {
+            LOG.debug("unable to load rpc reply ok.", e);
+            doc = XmlUtil.newDocument();
+        }
+        return doc;
+    }
+
+    protected Document commit() throws Exception {
+        final Commit commit = new Commit(SESSION_ID_FOR_REPORTING, transactionProvider);
+        return executeOperation(commit, "messages/mapping/commit.xml");
+    }
+
+    protected Document discardChanges() throws Exception {
+        final DiscardChanges discardOp = new DiscardChanges(SESSION_ID_FOR_REPORTING, transactionProvider);
+        return executeOperation(discardOp, "messages/mapping/discardChanges.xml");
+    }
+
+    protected Document edit(final String resource) throws Exception {
+        final EditConfig editConfig = new EditConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext,
+            transactionProvider);
+        return executeOperation(editConfig, resource);
+    }
+
+    protected Document get() throws Exception {
+        final Get get = new Get(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider);
+        return executeOperation(get, "messages/mapping/get.xml");
+    }
+
+    protected Document getWithFilter(final String resource) throws Exception {
+        final Get get = new Get(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider);
+        return executeOperation(get, resource);
+    }
+
+    protected Document getConfigRunning() throws Exception {
+        final GetConfig getConfig = new GetConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider);
+        return executeOperation(getConfig, "messages/mapping/getConfig.xml");
+    }
+
+    protected Document getConfigCandidate() throws Exception {
+        final GetConfig getConfig = new GetConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider);
+        return executeOperation(getConfig, "messages/mapping/getConfig_candidate.xml");
+    }
+
+    protected Document getConfigWithFilter(final String resource) throws Exception {
+        final GetConfig getConfig = new GetConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider);
+        return executeOperation(getConfig, resource);
+    }
+
+    protected static Document lock() throws Exception {
+        final Lock lock = new Lock(SESSION_ID_FOR_REPORTING);
+        return executeOperation(lock, "messages/mapping/lock.xml");
+    }
+
+    protected static Document unlock() throws Exception {
+        final Unlock unlock = new Unlock(SESSION_ID_FOR_REPORTING);
+        return executeOperation(unlock, "messages/mapping/unlock.xml");
+    }
+
+    protected static Document lockWithoutTarget() throws Exception {
+        final Lock lock = new Lock(SESSION_ID_FOR_REPORTING);
+        return executeOperation(lock, "messages/mapping/lock_notarget.xml");
+    }
+
+    protected static Document unlockWithoutTarget() throws Exception {
+        final Unlock unlock = new Unlock(SESSION_ID_FOR_REPORTING);
+        return executeOperation(unlock, "messages/mapping/unlock_notarget.xml");
+    }
+
+    protected static Document lockCandidate() throws Exception {
+        final Lock lock = new Lock(SESSION_ID_FOR_REPORTING);
+        return executeOperation(lock, "messages/mapping/lock_candidate.xml");
+    }
+
+    protected static Document unlockCandidate() throws Exception {
+        final Unlock unlock = new Unlock(SESSION_ID_FOR_REPORTING);
+        return executeOperation(unlock, "messages/mapping/unlock_candidate.xml");
+    }
+
+    protected static Document executeOperation(final NetconfOperation op, final String filename) throws Exception {
+        final Document request = XmlFileLoader.xmlFileToDocument(filename);
+        final Document response = op.handle(request, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT);
+
+        LOG.debug("Got response {}", response);
+        return response;
+    }
+
+    protected static void assertEmptyDatastore(final Document response) {
+        final NodeList nodes = response.getChildNodes();
+        assertTrue(nodes.getLength() == 1);
+
+        assertEquals(nodes.item(0).getLocalName(), RPC_REPLY_ELEMENT);
+
+        final NodeList replyNodes = nodes.item(0).getChildNodes();
+        assertTrue(replyNodes.getLength() == 1);
+
+        final Node dataNode = replyNodes.item(0);
+        assertEquals(dataNode.getLocalName(), DATA_ELEMENT);
+        assertFalse(dataNode.hasChildNodes());
+    }
+
+    protected static void verifyResponse(final Document response, final Document template) throws Exception {
+        final DetailedDiff dd = new DetailedDiff(new Diff(response, template));
+        dd.overrideElementQualifier(new NetconfXmlUnitRecursiveQualifier());
+        if (!dd.similar()) {
+            LOG.warn("Actual response:");
+            printDocument(response);
+            LOG.warn("Expected response:");
+            printDocument(template);
+            fail("Differences found: " + dd.toString());
+        }
+    }
+
+    private static void printDocument(final Document doc) throws Exception {
+        final TransformerFactory tf = TransformerFactory.newInstance();
+        final Transformer transformer = tf.newTransformer();
+        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no");
+        transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4");
+
+        final StringWriter writer = new StringWriter();
+        transformer.transform(new DOMSource(doc),
+            new StreamResult(writer));
+        LOG.warn(writer.getBuffer().toString());
+    }
+}
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/CopyConfigTest.java b/netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/CopyConfigTest.java
new file mode 100644 (file)
index 0000000..e634dc4
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2018 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.mdsal.connector.ops;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.opendaylight.yangtools.yang.test.util.YangParserTestUtils.parseYangResources;
+
+import org.junit.Test;
+import org.opendaylight.controller.config.util.xml.DocumentedException;
+import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorSeverity;
+import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorTag;
+import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorType;
+import org.opendaylight.netconf.util.test.XmlFileLoader;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.w3c.dom.Document;
+
+public class CopyConfigTest extends AbstractNetconfOperationTest {
+
+    @Override
+    protected SchemaContext getSchemaContext() {
+        return parseYangResources(CopyConfigTest.class,
+            "/yang/mdsal-netconf-mapping-test.yang");
+    }
+
+
+    @Test
+    public void testTargetMissing() throws Exception {
+        try {
+            copyConfig("messages/mapping/copyConfigs/copyConfig_no_target.xml");
+            fail("Should have failed - <target> element is missing");
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.MISSING_ATTRIBUTE);
+            assertTrue(e.getErrorType() == ErrorType.PROTOCOL);
+        }
+    }
+
+    @Test
+    public void testSourceMissing() throws Exception {
+        try {
+            copyConfig("messages/mapping/copyConfigs/copyConfig_no_source.xml");
+            fail("Should have fanode1iled - <source> element is missing");
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.MISSING_ELEMENT);
+            assertTrue(e.getErrorType() == ErrorType.PROTOCOL);
+        }
+    }
+
+    @Test
+    public void testConfigMissing() throws Exception {
+        try {
+            copyConfig("messages/mapping/copyConfigs/copyConfig_no_config.xml");
+            fail("Should have failed - <config> element is missing");
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.MISSING_ELEMENT);
+            assertTrue(e.getErrorType() == ErrorType.PROTOCOL);
+        }
+    }
+
+    @Test
+    public void testRunning() throws Exception {
+        try {
+            copyConfig("messages/mapping/copyConfigs/copyConfig_running.xml");
+            fail("Should have failed - copy config on running datastore is not supported");
+        } catch (final DocumentedException e) {
+            assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
+            assertTrue(e.getErrorTag() == ErrorTag.OPERATION_NOT_SUPPORTED);
+            assertTrue(e.getErrorType() == ErrorType.PROTOCOL);
+        }
+    }
+
+    @Test
+    public void testCandidateTransaction() throws Exception {
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_top_modules.xml"), RPC_REPLY_OK);
+        verifyResponse(getConfigCandidate(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_top_modules_control.xml"));
+        assertEmptyDatastore(getConfigRunning());
+
+        verifyResponse(discardChanges(), RPC_REPLY_OK);
+        assertEmptyDatastore(getConfigCandidate());
+    }
+
+    @Test
+    public void testWithCommit() throws Exception {
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_top_modules.xml"), RPC_REPLY_OK);
+        final Document expectedConfig = XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_top_modules_control.xml");
+        verifyResponse(getConfigCandidate(), expectedConfig);
+
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), expectedConfig);
+    }
+
+    @Test
+    public void testDeleteSubtree() throws Exception {
+        // Initialize datastore
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_delete_setup.xml"), RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_delete_setup_control.xml"));
+
+        // Issue second copy-config, this time without top container
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_delete.xml"), RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_delete_control.xml"));
+    }
+
+    @Test
+    public void testList() throws Exception {
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_list_setup.xml"), RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_list_setup_control.xml"));
+
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_list_update.xml"), RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_list_update_control.xml"));
+    }
+
+    @Test
+    public void testOrderedList() throws Exception {
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_ordered_list_setup.xml"),
+            RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_ordered_list_setup_control.xml"));
+
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_ordered_list_update.xml"),
+            RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_ordered_list_update_control.xml"));
+    }
+
+    @Test
+    public void testToplevelList() throws Exception {
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_toplevel_list_setup.xml"),
+            RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_toplevel_list_setup_control.xml"));
+
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_toplevel_list_update.xml"),
+            RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_toplevel_list_update_control.xml"));
+    }
+
+    @Test
+    public void testEmptyContainer() throws Exception {
+        // Check that empty non-presence container is removed.
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_empty_container.xml"),
+            RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_empty_container_control.xml"));
+    }
+
+    @Test
+    public void testEmptyPresenceContainer() throws Exception {
+        // Check that empty presence container is not removed.
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_empty_presence_container.xml"),
+            RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_empty_presence_container_control.xml"));
+    }
+
+    @Test
+    public void testAugmentations() throws Exception {
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_top_augmentation.xml"),
+            RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_top_augmentation_control.xml"));
+    }
+
+    @Test
+    public void testChoices() throws Exception {
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_choices1.xml"), RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_choices2.xml"), RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_choices3.xml"), RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(copyConfig("messages/mapping/copyConfigs/copyConfig_choices4.xml"), RPC_REPLY_OK);
+        verifyResponse(commit(), RPC_REPLY_OK);
+        verifyResponse(getConfigRunning(), XmlFileLoader.xmlFileToDocument(
+            "messages/mapping/copyConfigs/copyConfig_choices_control.xml"));
+    }
+
+    private Document copyConfig(final String resource) throws Exception {
+        final CopyConfig copyConfig = new CopyConfig(SESSION_ID_FOR_REPORTING, getCurrentSchemaContext(),
+            getTransactionProvider());
+        return executeOperation(copyConfig, resource);
+    }
+}
\ No newline at end of file
index a514ca46dd763aaf8c02873500c2580d889c921e..a7709ecd0ebb6b9db70c610d6a620d5a0ef9f3ab 100644 (file)
@@ -9,75 +9,42 @@
 package org.opendaylight.netconf.mdsal.connector.ops;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doAnswer;
 
-import com.google.common.io.ByteSource;
-import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.MoreExecutors;
 import java.io.StringWriter;
-import java.util.EnumMap;
-import java.util.concurrent.ExecutorService;
 import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
-import org.custommonkey.xmlunit.DetailedDiff;
-import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.XMLUnit;
 import org.junit.Assert;
-import org.junit.Before;
 import org.junit.Test;
-import org.mockito.Mock;
 import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
 import org.opendaylight.controller.config.util.xml.DocumentedException;
 import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorSeverity;
 import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorTag;
 import org.opendaylight.controller.config.util.xml.DocumentedException.ErrorType;
 import org.opendaylight.controller.config.util.xml.XmlElement;
 import org.opendaylight.controller.config.util.xml.XmlUtil;
-import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.dom.broker.impl.SerializedDOMDataBroker;
-import org.opendaylight.controller.md.sal.dom.store.impl.InMemoryDOMDataStoreFactory;
-import org.opendaylight.controller.sal.core.api.model.SchemaService;
-import org.opendaylight.controller.sal.core.spi.data.DOMStore;
-import org.opendaylight.netconf.mapping.api.NetconfOperation;
-import org.opendaylight.netconf.mapping.api.NetconfOperationChainedExecution;
 import org.opendaylight.netconf.mdsal.connector.CurrentSchemaContext;
 import org.opendaylight.netconf.mdsal.connector.TransactionProvider;
-import org.opendaylight.netconf.mdsal.connector.ops.get.Get;
 import org.opendaylight.netconf.mdsal.connector.ops.get.GetConfig;
-import org.opendaylight.netconf.util.test.NetconfXmlUnitRecursiveQualifier;
 import org.opendaylight.netconf.util.test.XmlFileLoader;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
-import org.opendaylight.yangtools.util.concurrent.SpecialExecutors;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
-import org.opendaylight.yangtools.yang.model.api.Module;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
-import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
-import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
-import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceProvider;
 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
-import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
-public class NetconfMDSalMappingTest {
+public class NetconfMDSalMappingTest extends AbstractNetconfOperationTest {
     private static final Logger LOG = LoggerFactory.getLogger(NetconfMDSalMappingTest.class);
 
     private static final String TARGET_KEY = "target";
-    private static final String RPC_REPLY_ELEMENT = "rpc-reply";
-    private static final String DATA_ELEMENT = "data";
     private static final String FILTER_NODE = "filter";
     private static final String GET_CONFIG = "get-config";
     private static final QName TOP = QName.create("urn:opendaylight:mdsal:mapping:test", "2015-02-26", "top");
@@ -101,63 +68,11 @@ public class NetconfMDSalMappingTest {
 
     private static final YangInstanceIdentifier AUGMENTED_CONTAINER_IN_MODULES =
             YangInstanceIdentifier.builder().node(TOP).node(MODULES).build();
-    private static final String SESSION_ID_FOR_REPORTING = "netconf-test-session1";
-    private static final Document RPC_REPLY_OK = NetconfMDSalMappingTest.getReplyOk();
 
-    private CurrentSchemaContext currentSchemaContext = null;
-    private SchemaContext schemaContext = null;
-    private TransactionProvider transactionProvider = null;
-
-    @Mock
-    private SchemaSourceProvider<YangTextSchemaSource> sourceProvider;
-
-    @SuppressWarnings("illegalCatch")
-    private static Document getReplyOk() {
-        Document doc;
-        try {
-            doc = XmlFileLoader.xmlFileToDocument("messages/mapping/rpc-reply_ok.xml");
-        } catch (final Exception e) {
-            LOG.debug("unable to load rpc reply ok.", e);
-            doc = XmlUtil.newDocument();
-        }
-        return doc;
-    }
-
-    @Before
-    public void setUp() throws Exception {
-        MockitoAnnotations.initMocks(this);
-
-        XMLUnit.setIgnoreWhitespace(true);
-        XMLUnit.setIgnoreAttributeOrder(true);
-
-        this.schemaContext = YangParserTestUtils.parseYangResources(NetconfMDSalMappingTest.class,
+    @Override
+    protected SchemaContext getSchemaContext() {
+        return YangParserTestUtils.parseYangResources(NetconfMDSalMappingTest.class,
             "/META-INF/yang/config@2013-04-05.yang", "/yang/mdsal-netconf-mapping-test.yang");
-        schemaContext.getModules();
-        final SchemaService schemaService = createSchemaService();
-
-        final DOMStore operStore = InMemoryDOMDataStoreFactory.create("DOM-OPER", schemaService);
-        final DOMStore configStore = InMemoryDOMDataStoreFactory.create("DOM-CFG", schemaService);
-
-        final EnumMap<LogicalDatastoreType, DOMStore> datastores = new EnumMap<>(LogicalDatastoreType.class);
-        datastores.put(LogicalDatastoreType.CONFIGURATION, configStore);
-        datastores.put(LogicalDatastoreType.OPERATIONAL, operStore);
-
-        final ExecutorService listenableFutureExecutor = SpecialExecutors.newBlockingBoundedCachedThreadPool(
-                16, 16, "CommitFutures", NetconfMDSalMappingTest.class);
-
-        final SerializedDOMDataBroker sdb = new SerializedDOMDataBroker(datastores,
-                MoreExecutors.listeningDecorator(listenableFutureExecutor));
-        this.transactionProvider = new TransactionProvider(sdb, SESSION_ID_FOR_REPORTING);
-
-        doAnswer(invocationOnMock -> {
-            final SourceIdentifier sId = (SourceIdentifier) invocationOnMock.getArguments()[0];
-            final YangTextSchemaSource yangTextSchemaSource =
-                    YangTextSchemaSource.delegateForByteSource(sId, ByteSource.wrap("module test".getBytes()));
-            return Futures.immediateFuture(yangTextSchemaSource);
-
-        }).when(sourceProvider).getSource(any(SourceIdentifier.class));
-
-        this.currentSchemaContext = new CurrentSchemaContext(schemaService, sourceProvider);
     }
 
     @Test
@@ -170,8 +85,8 @@ public class NetconfMDSalMappingTest {
     @Test
     public void testIncorrectGet() throws Exception {
         try {
-            executeOperation(new GetConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider),
-                    "messages/mapping/bad_getConfig.xml");
+            executeOperation(new GetConfig(SESSION_ID_FOR_REPORTING, getCurrentSchemaContext(),
+                    getTransactionProvider()), "messages/mapping/bad_getConfig.xml");
             fail("Should have failed, this is an incorrect request");
         } catch (final DocumentedException e) {
             assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
@@ -180,8 +95,8 @@ public class NetconfMDSalMappingTest {
         }
 
         try {
-            executeOperation(new GetConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider),
-                    "messages/mapping/bad_namespace_getConfig.xml");
+            executeOperation(new GetConfig(SESSION_ID_FOR_REPORTING, getCurrentSchemaContext(),
+                    getTransactionProvider()), "messages/mapping/bad_namespace_getConfig.xml");
             fail("Should have failed, this is an incorrect request");
         } catch (final DocumentedException e) {
             assertTrue(e.getErrorSeverity() == ErrorSeverity.ERROR);
@@ -692,8 +607,8 @@ public class NetconfMDSalMappingTest {
 
     private void verifyFilterIdentifier(final String resource, final YangInstanceIdentifier identifier)
             throws Exception {
-        final TestingGetConfig getConfig = new TestingGetConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext,
-                transactionProvider);
+        final TestingGetConfig getConfig = new TestingGetConfig(SESSION_ID_FOR_REPORTING, getCurrentSchemaContext(),
+                getTransactionProvider());
         final Document request = XmlFileLoader.xmlFileToDocument(resource);
         final YangInstanceIdentifier iid = getConfig.getInstanceIdentifierFromDocument(request);
         assertEquals(identifier, iid);
@@ -719,148 +634,4 @@ public class NetconfMDSalMappingTest {
         verifyResponse(commit(), RPC_REPLY_OK);
         assertEmptyDatastore(getConfigRunning());
     }
-
-    private static void verifyResponse(final Document response, final Document template) throws Exception {
-        final DetailedDiff dd = new DetailedDiff(new Diff(response, template));
-        dd.overrideElementQualifier(new NetconfXmlUnitRecursiveQualifier());
-
-        printDocument(response);
-        printDocument(template);
-
-        assertTrue(dd.toString(), dd.similar());
-    }
-
-    private static void assertEmptyDatastore(final Document response) {
-        final NodeList nodes = response.getChildNodes();
-        assertTrue(nodes.getLength() == 1);
-
-        assertEquals(nodes.item(0).getLocalName(), RPC_REPLY_ELEMENT);
-
-        final NodeList replyNodes = nodes.item(0).getChildNodes();
-        assertTrue(replyNodes.getLength() == 1);
-
-        final Node dataNode = replyNodes.item(0);
-        assertEquals(dataNode.getLocalName(), DATA_ELEMENT);
-        assertFalse(dataNode.hasChildNodes());
-    }
-
-    private Document commit() throws Exception {
-        final Commit commit = new Commit(SESSION_ID_FOR_REPORTING, transactionProvider);
-        return executeOperation(commit, "messages/mapping/commit.xml");
-    }
-
-    private Document discardChanges() throws Exception {
-        final DiscardChanges discardOp = new DiscardChanges(SESSION_ID_FOR_REPORTING, transactionProvider);
-        return executeOperation(discardOp, "messages/mapping/discardChanges.xml");
-    }
-
-    private Document edit(final String resource) throws Exception {
-        final EditConfig editConfig = new EditConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext,
-                transactionProvider);
-        return executeOperation(editConfig, resource);
-    }
-
-    private Document get() throws Exception {
-        final Get get = new Get(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider);
-        return executeOperation(get, "messages/mapping/get.xml");
-    }
-
-    private Document getWithFilter(final String resource) throws Exception {
-        final Get get = new Get(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider);
-        return executeOperation(get, resource);
-    }
-
-    private Document getConfigRunning() throws Exception {
-        final GetConfig getConfig = new GetConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider);
-        return executeOperation(getConfig, "messages/mapping/getConfig.xml");
-    }
-
-    private Document getConfigCandidate() throws Exception {
-        final GetConfig getConfig = new GetConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider);
-        return executeOperation(getConfig, "messages/mapping/getConfig_candidate.xml");
-    }
-
-    private Document getConfigWithFilter(final String resource) throws Exception {
-        final GetConfig getConfig = new GetConfig(SESSION_ID_FOR_REPORTING, currentSchemaContext, transactionProvider);
-        return executeOperation(getConfig, resource);
-    }
-
-    private static Document lock() throws Exception {
-        final Lock lock = new Lock(SESSION_ID_FOR_REPORTING);
-        return executeOperation(lock, "messages/mapping/lock.xml");
-    }
-
-    private static Document unlock() throws Exception {
-        final Unlock unlock = new Unlock(SESSION_ID_FOR_REPORTING);
-        return executeOperation(unlock, "messages/mapping/unlock.xml");
-    }
-
-    private static Document lockWithoutTarget() throws Exception {
-        final Lock lock = new Lock(SESSION_ID_FOR_REPORTING);
-        return executeOperation(lock, "messages/mapping/lock_notarget.xml");
-    }
-
-    private static Document unlockWithoutTarget() throws Exception {
-        final Unlock unlock = new Unlock(SESSION_ID_FOR_REPORTING);
-        return executeOperation(unlock, "messages/mapping/unlock_notarget.xml");
-    }
-
-    private static Document lockCandidate() throws Exception {
-        final Lock lock = new Lock(SESSION_ID_FOR_REPORTING);
-        return executeOperation(lock, "messages/mapping/lock_candidate.xml");
-    }
-
-    private static Document unlockCandidate() throws Exception {
-        final Unlock unlock = new Unlock(SESSION_ID_FOR_REPORTING);
-        return executeOperation(unlock, "messages/mapping/unlock_candidate.xml");
-    }
-
-    private static Document executeOperation(final NetconfOperation op, final String filename) throws Exception {
-        final Document request = XmlFileLoader.xmlFileToDocument(filename);
-        final Document response = op.handle(request, NetconfOperationChainedExecution.EXECUTION_TERMINATION_POINT);
-
-        LOG.debug("Got response {}", response);
-        return response;
-    }
-
-    private SchemaService createSchemaService() {
-        return new SchemaService() {
-
-            @Override
-            public void addModule(final Module module) {
-            }
-
-            @Override
-            public void removeModule(final Module module) {
-
-            }
-
-            @Override
-            public SchemaContext getSessionContext() {
-                return schemaContext;
-            }
-
-            @Override
-            public SchemaContext getGlobalContext() {
-                return schemaContext;
-            }
-
-            @Override
-            public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
-                    final SchemaContextListener listener) {
-                listener.onGlobalContextUpdated(getGlobalContext());
-                return new ListenerRegistration<SchemaContextListener>() {
-                    @Override
-                    public void close() {
-
-                    }
-
-                    @Override
-                    public SchemaContextListener getInstance() {
-                        return listener;
-                    }
-                };
-            }
-        };
-    }
 }
diff --git a/netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/SchemaServiceStub.java b/netconf/mdsal-netconf-connector/src/test/java/org/opendaylight/netconf/mdsal/connector/ops/SchemaServiceStub.java
new file mode 100644 (file)
index 0000000..206beab
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2018 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.mdsal.connector.ops;
+
+import org.opendaylight.controller.sal.core.api.model.SchemaService;
+import org.opendaylight.yangtools.concepts.ListenerRegistration;
+import org.opendaylight.yangtools.yang.model.api.Module;
+import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaContextListener;
+
+final class SchemaServiceStub implements SchemaService {
+    private final SchemaContext schemaContext;
+
+    SchemaServiceStub(SchemaContext schemaContext) {
+        this.schemaContext = schemaContext;
+    }
+
+    @Override
+    public void addModule(final Module module) {
+    }
+
+    @Override
+    public void removeModule(final Module module) {
+
+    }
+
+    @Override
+    public SchemaContext getSessionContext() {
+        return schemaContext;
+    }
+
+    @Override
+    public SchemaContext getGlobalContext() {
+        return schemaContext;
+    }
+
+    @Override
+    public ListenerRegistration<SchemaContextListener> registerSchemaContextListener(
+        final SchemaContextListener listener) {
+        listener.onGlobalContextUpdated(getGlobalContext());
+        return new ListenerRegistration<SchemaContextListener>() {
+            @Override
+            public void close() {
+            }
+
+            @Override
+            public SchemaContextListener getInstance() {
+                return listener;
+            }
+        };
+    }
+}
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices1.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices1.xml
new file mode 100644 (file)
index 0000000..2fc05cd
--- /dev/null
@@ -0,0 +1,22 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <top xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <text>some text</text>
+                </top>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices2.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices2.xml
new file mode 100644 (file)
index 0000000..2817458
--- /dev/null
@@ -0,0 +1,24 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <top xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <text-cont>
+                        <text>some text</text>
+                    </text-cont>
+                </top>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices3.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices3.xml
new file mode 100644 (file)
index 0000000..a2242fe
--- /dev/null
@@ -0,0 +1,22 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <top xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <augmented-case>augmented case text</augmented-case>
+                </top>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices4.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices4.xml
new file mode 100644 (file)
index 0000000..423b545
--- /dev/null
@@ -0,0 +1,24 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <top xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <choice-wrapper>
+                        <text2>some text</text2>
+                    </choice-wrapper>
+                </top>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_choices_control.xml
new file mode 100644 (file)
index 0000000..378417f
--- /dev/null
@@ -0,0 +1,17 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <top xmlns="urn:opendaylight:mdsal:mapping:test">
+            <choice-wrapper>
+                <text2>some text</text2>
+            </choice-wrapper>
+        </top>
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete.xml
new file mode 100644 (file)
index 0000000..e9bdf41
--- /dev/null
@@ -0,0 +1,25 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <mapping-node>
+                        <id>node1</id>
+                        <content>content1</content>
+                    </mapping-node>
+                </mapping-nodes>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete_control.xml
new file mode 100644 (file)
index 0000000..0d177bc
--- /dev/null
@@ -0,0 +1,18 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+            <mapping-node>
+                <id>node1</id>
+                <content>content1</content>
+            </mapping-node>
+        </mapping-nodes>
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete_setup.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete_setup.xml
new file mode 100644 (file)
index 0000000..68491b7
--- /dev/null
@@ -0,0 +1,43 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <mapping-node>
+                        <id>node1</id>
+                        <content>content1</content>
+                    </mapping-node>
+                </mapping-nodes>
+                <top xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <modules>
+                        <augmented-container>
+                            <identifier>augmented container</identifier>
+                        </augmented-container>
+                        <module>
+                            <id>module1</id>
+                            <type>type1</type>
+                            <desc>module1-desc</desc>
+                        </module>
+                        <module>
+                            <id>module2</id>
+                        </module>
+                        <module>
+                            <id>module3</id>
+                        </module>
+                    </modules>
+                </top>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete_setup_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_delete_setup_control.xml
new file mode 100644 (file)
index 0000000..9ec309a
--- /dev/null
@@ -0,0 +1,36 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+            <mapping-node>
+                <id>node1</id>
+                <content>content1</content>
+            </mapping-node>
+        </mapping-nodes>
+        <top xmlns="urn:opendaylight:mdsal:mapping:test">
+            <modules>
+                <augmented-container>
+                    <identifier>augmented container</identifier>
+                </augmented-container>
+                <module>
+                    <id>module1</id>
+                    <type>type1</type>
+                    <desc>module1-desc</desc>
+                </module>
+                <module>
+                    <id>module2</id>
+                </module>
+                <module>
+                    <id>module3</id>
+                </module>
+            </modules>
+        </top>
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_container.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_container.xml
new file mode 100644 (file)
index 0000000..9249683
--- /dev/null
@@ -0,0 +1,21 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <top xmlns="urn:opendaylight:mdsal:mapping:test">
+                </top>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_container_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_container_control.xml
new file mode 100644 (file)
index 0000000..34d9b31
--- /dev/null
@@ -0,0 +1,11 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data/>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_presence_container.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_presence_container.xml
new file mode 100644 (file)
index 0000000..df5c5ce
--- /dev/null
@@ -0,0 +1,20 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <top-with-presence xmlns="urn:opendaylight:mdsal:mapping:test" />
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_presence_container_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_empty_presence_container_control.xml
new file mode 100644 (file)
index 0000000..9bae4a6
--- /dev/null
@@ -0,0 +1,13 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <top-with-presence xmlns="urn:opendaylight:mdsal:mapping:test" />
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_setup.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_setup.xml
new file mode 100644 (file)
index 0000000..14f9ea1
--- /dev/null
@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <mapping-node>
+                        <id>node1</id>
+                        <content>content1</content>
+                    </mapping-node>
+                    <mapping-node>
+                        <id>node2</id>
+                        <content>content2</content>
+                    </mapping-node>
+                    <mapping-node>
+                        <id>node3</id>
+                        <content>content3</content>
+                    </mapping-node>
+                </mapping-nodes>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_setup_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_setup_control.xml
new file mode 100644 (file)
index 0000000..b75333d
--- /dev/null
@@ -0,0 +1,26 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+            <mapping-node>
+                <id>node1</id>
+                <content>content1</content>
+            </mapping-node>
+            <mapping-node>
+                <id>node2</id>
+                <content>content2</content>
+            </mapping-node>
+            <mapping-node>
+                <id>node3</id>
+                <content>content3</content>
+            </mapping-node>
+        </mapping-nodes>
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_update.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_update.xml
new file mode 100644 (file)
index 0000000..477a2fc
--- /dev/null
@@ -0,0 +1,33 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <mapping-node>
+                        <id>new_node</id>
+                        <content>new_node content</content>
+                    </mapping-node>
+                    <mapping-node>
+                        <id>node2</id>
+                        <content>content2</content>
+                    </mapping-node>
+                    <mapping-node>
+                        <id>node3</id>
+                        <content>updated content3</content>
+                    </mapping-node>
+                </mapping-nodes>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_update_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_list_update_control.xml
new file mode 100644 (file)
index 0000000..9ad53ba
--- /dev/null
@@ -0,0 +1,26 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+            <mapping-node>
+                <id>new_node</id>
+                <content>new_node content</content>
+            </mapping-node>
+            <mapping-node>
+                <id>node2</id>
+                <content>content2</content>
+            </mapping-node>
+            <mapping-node>
+                <id>node3</id>
+                <content>updated content3</content>
+            </mapping-node>
+        </mapping-nodes>
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_no_config.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_no_config.xml
new file mode 100644 (file)
index 0000000..8149192
--- /dev/null
@@ -0,0 +1,17 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_no_source.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_no_source.xml
new file mode 100644 (file)
index 0000000..822977d
--- /dev/null
@@ -0,0 +1,15 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_no_target.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_no_target.xml
new file mode 100644 (file)
index 0000000..0a72ca3
--- /dev/null
@@ -0,0 +1,22 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <source>
+            <config>
+                <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <mapping-node>
+                        <id>node1-put</id>
+                        <content>put content</content>
+                    </mapping-node>
+                </mapping-nodes>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_setup.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_setup.xml
new file mode 100644 (file)
index 0000000..defe15c
--- /dev/null
@@ -0,0 +1,46 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <mapping-node>
+                        <id>id</id>
+                        <ordered-items>
+                            <ordered-item>
+                                <id>item1</id>
+                                <content>content1</content>
+                            </ordered-item>
+                            <ordered-item>
+                                <id>item2</id>
+                                <content>content2</content>
+                            </ordered-item>
+                            <ordered-item>
+                                <id>item3</id>
+                                <content>content3</content>
+                            </ordered-item>
+                            <ordered-item>
+                                <id>item4</id>
+                                <content>content4</content>
+                            </ordered-item>
+                            <ordered-item>
+                                <id>item5</id>
+                                <content>content5</content>
+                            </ordered-item>
+                        </ordered-items>
+                    </mapping-node>
+                </mapping-nodes>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_setup_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_setup_control.xml
new file mode 100644 (file)
index 0000000..3212491
--- /dev/null
@@ -0,0 +1,39 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+            <mapping-node>
+                <id>id</id>
+                <ordered-items>
+                    <ordered-item>
+                        <id>item1</id>
+                        <content>content1</content>
+                    </ordered-item>
+                    <ordered-item>
+                        <id>item2</id>
+                        <content>content2</content>
+                    </ordered-item>
+                    <ordered-item>
+                        <id>item3</id>
+                        <content>content3</content>
+                    </ordered-item>
+                    <ordered-item>
+                        <id>item4</id>
+                        <content>content4</content>
+                    </ordered-item>
+                    <ordered-item>
+                        <id>item5</id>
+                        <content>content5</content>
+                    </ordered-item>
+                </ordered-items>
+            </mapping-node>
+        </mapping-nodes>
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_update.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_update.xml
new file mode 100644 (file)
index 0000000..4789895
--- /dev/null
@@ -0,0 +1,42 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <mapping-node>
+                        <id>id</id>
+                        <ordered-items>
+                            <ordered-item>
+                                <id>item1</id>
+                                <content>udated content1</content>
+                            </ordered-item>
+                            <ordered-item>
+                                <id>new_item</id>
+                                <content>new_item content</content>
+                            </ordered-item>
+                            <ordered-item>
+                                <id>item2</id>
+                                <content>content2</content>
+                            </ordered-item>
+                            <ordered-item>
+                                <id>item5</id>
+                                <content>content5</content>
+                            </ordered-item>
+                        </ordered-items>
+                    </mapping-node>
+                </mapping-nodes>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_update_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_ordered_list_update_control.xml
new file mode 100644 (file)
index 0000000..4cc2131
--- /dev/null
@@ -0,0 +1,35 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+            <mapping-node>
+                <id>id</id>
+                <ordered-items>
+                    <ordered-item>
+                        <id>item1</id>
+                        <content>udated content1</content>
+                    </ordered-item>
+                    <ordered-item>
+                        <id>new_item</id>
+                        <content>new_item content</content>
+                    </ordered-item>
+                    <ordered-item>
+                        <id>item2</id>
+                        <content>content2</content>
+                    </ordered-item>
+                    <ordered-item>
+                        <id>item5</id>
+                        <content>content5</content>
+                    </ordered-item>
+                </ordered-items>
+            </mapping-node>
+        </mapping-nodes>
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_running.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_running.xml
new file mode 100644 (file)
index 0000000..2190a2d
--- /dev/null
@@ -0,0 +1,25 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <running/>
+        </target>
+        <source>
+            <config>
+                <mapping-nodes xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <mapping-node>
+                        <id>node1-put</id>
+                        <content>put content</content>
+                    </mapping-node>
+                </mapping-nodes>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_augmentation.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_augmentation.xml
new file mode 100644 (file)
index 0000000..b9769ac
--- /dev/null
@@ -0,0 +1,43 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <top xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <modules>
+                        <augmented-container>
+                            <identifier>augmented container</identifier>
+                        </augmented-container>
+                        <module>
+                            <id>module1</id>
+                            <type>type1</type>
+                            <desc>module1-desc</desc>
+                        </module>
+                    </modules>
+                    <mid-level>
+                        <low-level>
+                            <lowest-level>
+                                <note>note1</note>
+                                <note>note2</note>
+                            </lowest-level>
+                        </low-level>
+                        <low-level2>
+                            <note>note1</note>
+                            <note>note2</note>
+                        </low-level2>
+                    </mid-level>
+                </top>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_augmentation_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_augmentation_control.xml
new file mode 100644 (file)
index 0000000..bb09a7f
--- /dev/null
@@ -0,0 +1,36 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <top xmlns="urn:opendaylight:mdsal:mapping:test">
+            <modules>
+                <augmented-container>
+                    <identifier>augmented container</identifier>
+                </augmented-container>
+                <module>
+                    <id>module1</id>
+                    <type>type1</type>
+                    <desc>module1-desc</desc>
+                </module>
+            </modules>
+            <mid-level>
+                <low-level>
+                    <lowest-level>
+                        <note>note1</note>
+                        <note>note2</note>
+                    </lowest-level>
+                </low-level>
+                <low-level2>
+                    <note>note1</note>
+                    <note>note2</note>
+                </low-level2>
+            </mid-level>
+        </top>
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_modules.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_modules.xml
new file mode 100644 (file)
index 0000000..2cecb4b
--- /dev/null
@@ -0,0 +1,29 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <top xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <modules>
+                        <module>
+                            <id>module1</id>
+                        </module>
+                        <module>
+                            <id>module2</id>
+                        </module>
+                    </modules>
+                </top>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_modules_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_top_modules_control.xml
new file mode 100644 (file)
index 0000000..3ab7eeb
--- /dev/null
@@ -0,0 +1,22 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <top xmlns="urn:opendaylight:mdsal:mapping:test">
+            <modules>
+                <module>
+                    <id>module1</id>
+                </module>
+                <module>
+                    <id>module2</id>
+                </module>
+            </modules>
+        </top>
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_setup.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_setup.xml
new file mode 100644 (file)
index 0000000..f93dfda
--- /dev/null
@@ -0,0 +1,31 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <toplevel-list xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <id>item1</id>
+                    <content>content1</content>
+                </toplevel-list>
+                <toplevel-list xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <id>item2</id>
+                    <content>content2</content>
+                </toplevel-list>
+                <toplevel-list xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <id>item3</id>
+                    <content>content3</content>
+                </toplevel-list>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_setup_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_setup_control.xml
new file mode 100644 (file)
index 0000000..08947b4
--- /dev/null
@@ -0,0 +1,24 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <toplevel-list xmlns="urn:opendaylight:mdsal:mapping:test">
+            <id>item1</id>
+            <content>content1</content>
+        </toplevel-list>
+        <toplevel-list xmlns="urn:opendaylight:mdsal:mapping:test">
+            <id>item2</id>
+            <content>content2</content>
+        </toplevel-list>
+        <toplevel-list xmlns="urn:opendaylight:mdsal:mapping:test">
+            <id>item3</id>
+            <content>content3</content>
+        </toplevel-list>
+    </data>
+</rpc-reply>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_update.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_update.xml
new file mode 100644 (file)
index 0000000..0ce09fa
--- /dev/null
@@ -0,0 +1,27 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc message-id="a" a="64" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+    <copy-config>
+        <target>
+            <candidate/>
+        </target>
+        <source>
+            <config>
+                <toplevel-list xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <id>new_item</id>
+                    <content>new_item content</content>
+                </toplevel-list>
+                <toplevel-list xmlns="urn:opendaylight:mdsal:mapping:test">
+                    <id>item3</id>
+                    <content>updated content3</content>
+                </toplevel-list>
+            </config>
+        </source>
+    </copy-config>
+</rpc>
\ No newline at end of file
diff --git a/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_update_control.xml b/netconf/mdsal-netconf-connector/src/test/resources/messages/mapping/copyConfigs/copyConfig_toplevel_list_update_control.xml
new file mode 100644 (file)
index 0000000..014b45c
--- /dev/null
@@ -0,0 +1,20 @@
+<!--
+  ~ Copyright (c) 2018 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
+  -->
+
+<rpc-reply a="64" id="a" message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlnx="a:b:c:d">
+    <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
+        <toplevel-list xmlns="urn:opendaylight:mdsal:mapping:test">
+            <id>new_item</id>
+            <content>new_item content</content>
+        </toplevel-list>
+        <toplevel-list xmlns="urn:opendaylight:mdsal:mapping:test">
+            <id>item3</id>
+            <content>updated content3</content>
+        </toplevel-list>
+    </data>
+</rpc-reply>
\ No newline at end of file
index 2557dbcc86f33bee9a16315ea43c228d950cd778..86fbc3481df0bf58b2bfd7bee8f352ef2edcc408 100644 (file)
@@ -210,4 +210,20 @@ module config {
             }
         }
     }
+
+    list toplevel-list {
+        key "id";
+        leaf id {
+            type string;
+        }
+
+        leaf content {
+            type string;
+        }
+    }
+
+    container top-with-presence {
+        presence "For testing presence containers";
+
+    }
 }
\ No newline at end of file
index 81ba82eb0b8572a5dfd92413c713b49e7199d956..dddf90c1b94c7e0fc765bae7d2828cf533dd48f9 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <dependency>
       <groupId>${project.groupId}</groupId>
index bee3092396083d9ca238146d92c7143b3dc43d4b..d9cc172bb8205ee6cd3b215e5559655110c18a45 100644 (file)
@@ -9,10 +9,10 @@
 <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>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.mdsal.model</groupId>
-        <artifactId>mdsal-model-artifacts</artifactId>
-        <version>0.13.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>mdsal-artifacts</artifactId>
-        <version>1.8.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <!-- compile dependencies -->
     <dependency>
       <artifactId>slf4j-api</artifactId>
     </dependency>
   </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
 </project>
index 54ff19ed400438e938e290d21666252518f07ca3..3feea7de55646ee05e01d9633286453b34c2d44d 100644 (file)
@@ -9,10 +9,10 @@
 <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>bundle-parent</artifactId>
-        <version>3.0.2</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
     <name>${project.artifactId}</name>
     <packaging>bundle</packaging>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yangtools-artifacts</artifactId>
-                <version>2.0.2</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <!-- compile dependencies -->
         <dependency>
                     </instructions>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
 </project>
index f7a0326daa1ba0a94efa8d342a77d557e18688ab..c09dada467e4f20f91653ecf28e4c549d595a562 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <dependency>
       <groupId>${project.groupId}</groupId>
index 52da565bca1784293da33c72eaa2c4460dfda13c..557eddaa0322a526ab99ffb549067cee99bb18d7 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <dependency>
       <groupId>${project.groupId}</groupId>
index 1d8706d4d2a82c3a29ae4bee2190d0e4353c8e52..d028269befdf55b665884d635fa4ea841a9356dd 100644 (file)
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.opendaylight.odlparent</groupId>
-        <artifactId>bundle-parent</artifactId>
-        <version>3.0.2</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
     <name>${project.artifactId}</name>
     <packaging>bundle</packaging>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.mdsal.model</groupId>
-                <artifactId>mdsal-model-artifacts</artifactId>
-                <version>0.13.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yangtools-artifacts</artifactId>
-                <version>2.0.2</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
             <artifactId>yang-test-util</artifactId>
         </dependency>
     </dependencies>
-    
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>
index fdfa6b3a5ad35eaf9686d4f9f436fc6bb4b6b0b7..3fdcb7cd81d0c6c8783525e00f735616f507cec4 100644 (file)
@@ -12,10 +12,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.opendaylight.odlparent</groupId>
-        <artifactId>bundle-parent</artifactId>
-        <version>3.0.2</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
@@ -24,39 +24,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
     <name>${project.artifactId}</name>
     <packaging>bundle</packaging>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.mdsal</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>2.5.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yangtools-artifacts</artifactId>
-                <version>2.0.2</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
@@ -110,16 +77,4 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
             <artifactId>hamcrest-core</artifactId>
         </dependency>
     </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>
index 26609d21e31196c1291d72e516b6847727ecc28e..a8959888a0d49542566ed8fb492f603e93c1e17a 100644 (file)
@@ -23,6 +23,7 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 import java.util.concurrent.Future;
 import java.util.regex.Pattern;
@@ -122,8 +123,9 @@ public class NetconfEventSource implements EventSource, DOMNotificationListener
                 .put(cntr.getNotificationUrnPrefix(), cntr);
         Map<String, Stream> availableStreams = getAvailableStreams();
         LOG.debug("Stream configuration compare...");
-        for (String urnPrefix : this.urnPrefixToStreamMap.keySet()) {
-            final String streamName = this.urnPrefixToStreamMap.get(urnPrefix);
+        for (Entry<String, String> entry : this.urnPrefixToStreamMap.entrySet()) {
+            String urnPrefix = entry.getKey();
+            final String streamName = entry.getValue();
             LOG.debug("urnPrefix: {} streamName: {}", urnPrefix, streamName);
             if (availableStreams.containsKey(streamName)) {
                 LOG.debug("Stream containig on device");
index 91df5f781218707acccf96c1f1319d06627af033..6360136b9fd3f401cf1b6c2e2f0b558ebb8f705a 100644 (file)
@@ -114,22 +114,6 @@ public final class NetconfEventSourceManager implements DataTreeChangeListener<N
         }
     }
 
-    private void nodeUpdated(final InstanceIdentifier<?> key, final Node node) {
-        Preconditions.checkNotNull(key);
-        if (!validateNode(node)) {
-            LOG.warn("NodeUpdated event : Node [{}] is null or not valid.", key.toString());
-            return;
-        }
-
-        LOG.info("Netconf event source [{}] is updating...", key.toString());
-        NetconfEventSourceRegistration nesr = registrationMap.get(key);
-        if (nesr != null) {
-            nesr.updateStatus();
-        } else {
-            nodeCreated(key, node);
-        }
-    }
-
     private void nodeRemoved(final InstanceIdentifier<?> key) {
         Preconditions.checkNotNull(key);
         LOG.info("Netconf event source [{}] is removing...", key.toString());
index 240bae46ba1b4913f0c95394a444ee762fdf8612..a76caf20250b6761df1af726d075a0a004601760 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.mdsal</groupId>
-    <artifactId>binding-parent</artifactId>
-    <version>0.13.0-SNAPSHOT</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
index 84ab90251826d61c9539459244c4fe3790b57c41..bcfc36636e6d46cec6681d39cd60923cf1164387 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.mdsal</groupId>
-    <artifactId>binding-parent</artifactId>
-    <version>0.13.0-SNAPSHOT</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
index c6e3ebd8dcb4737f671290e6c2030988f5c06494..5129223e40f69f3e96da434aaca1be996a292097 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.mdsal</groupId>
-    <artifactId>binding-parent</artifactId>
-    <version>0.13.0-SNAPSHOT</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
index 46f4753190c8029f87f0b07f3f5cc949e515228e..2ca7702ba423985451bec8b7f09079b36b15ea03 100644 (file)
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.opendaylight.mdsal</groupId>
-        <artifactId>binding-parent</artifactId>
-        <version>0.13.0-SNAPSHOT</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
index b211926f18dc010c79986f22805840cbbd7b5a07..50b31bfad8d5200ac77767648b65101bd9143722 100644 (file)
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.opendaylight.mdsal</groupId>
-        <artifactId>binding-parent</artifactId>
-        <version>0.13.0-SNAPSHOT</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
index 056ecc2c59ac557db9785f2194bb339071bde4d0..c6f90377fd39ff896991c43131b631a246393ac5 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
 
   <dependencyManagement>
     <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>config-artifacts</artifactId>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.mdsal.model</groupId>
-        <artifactId>mdsal-model-artifacts</artifactId>
-        <version>0.13.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
     </dependencies>
   </dependencyManagement>
 
       <artifactId>mockito-configuration</artifactId>
     </dependency>
   </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
 </project>
index 8e289fa9e82dc243df9346da319b756ebbff9b83..2adb4984b8a61e32d9ad024352b205460d1d3d56 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.netconf.api;
 
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.util.Map;
 import org.opendaylight.controller.config.util.xml.DocumentedException;
 import org.w3c.dom.Document;
@@ -43,6 +44,7 @@ public class NetconfDocumentedException extends DocumentedException {
         super(message, cause, errorType, errorTag, errorSeverity, errorInfo);
     }
 
+    @SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE")
     public NetconfDocumentedException(final DocumentedException exception) {
         super(exception.getMessage(), (Exception) exception.getCause(), exception.getErrorType(),
                 exception.getErrorTag(), exception.getErrorSeverity(), exception.getErrorInfo());
index 3abeeea40c4e0a68f00ebd29e8f8d6ccf3533353..0c7856f84c8a8c3e6e8fc03568876335e80b187b 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.netconf.api.util;
 
-import com.google.common.collect.Sets;
+import com.google.common.collect.ImmutableSet;
 import java.util.Set;
 
 /**
@@ -25,7 +25,7 @@ public final class NetconfConstants {
     public static final String NETCONF_MONITORING = "ietf-netconf-monitoring";
     public static final String NETCONF_NOTIFICATION = "ietf-netconf-notifications";
 
-    public static final Set<String> CONFIG_SERVICE_MARKERS = Sets.newHashSet(SERVICE_NAME, CONFIG_NETCONF_CONNECTOR,
+    public static final Set<String> CONFIG_SERVICE_MARKERS = ImmutableSet.of(SERVICE_NAME, CONFIG_NETCONF_CONNECTOR,
             NETCONF_MONITORING, NETCONF_NOTIFICATION);
 
     private NetconfConstants() {
index 417fad3491517deb61bef7418bd33a5b186aa46f..b2c0ae02c7aa9474856caa3f2389316a5bf93489 100644 (file)
 <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>bundle-parent</artifactId>
-        <version>3.0.2</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
     <version>1.5.0-SNAPSHOT</version>
     <name>${project.artifactId}</name>
     <packaging>bundle</packaging>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>
index 26a201af4951caad443db342ec20ece060740f53..2e4a8aaa912f6c2ee06b9f2406df383448a42c25 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <dependency>
       <groupId>${project.groupId}</groupId>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 
index d0dc480299b97192a7a5495daf2e3fed344525c6..780ce7ff59f4103810ba99462b89dbd1ff9f1e30 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.netconf.client;
 import io.netty.channel.EventLoopGroup;
 import io.netty.util.Timer;
 import io.netty.util.concurrent.Future;
-import java.io.Closeable;
 import org.opendaylight.netconf.client.conf.NetconfClientConfiguration;
 import org.opendaylight.netconf.client.conf.NetconfReconnectingClientConfiguration;
 import org.opendaylight.protocol.framework.AbstractDispatcher;
@@ -19,7 +18,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class NetconfClientDispatcherImpl extends AbstractDispatcher<NetconfClientSession, NetconfClientSessionListener>
-        implements NetconfClientDispatcher, Closeable {
+        implements NetconfClientDispatcher {
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfClientDispatcherImpl.class);
 
index 608450225f52d84d71cff3d1443b739905edaa5d..19091f6d60a93c3f7f064ef68adf8cfbd9aff7a1 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Interner;
 import com.google.common.collect.Interners;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.ChannelFutureListener;
@@ -64,16 +65,17 @@ public class NetconfClientSessionNegotiator extends
     }
 
     @Override
+    @SuppressFBWarnings("BC_UNCONFIRMED_CAST")
     protected void handleMessage(final NetconfHelloMessage netconfMessage) throws NetconfDocumentedException {
         final NetconfClientSession session = getSessionForHelloMessage(netconfMessage);
         replaceHelloMessageInboundHandler(session);
 
         // If exi should be used, try to initiate exi communication
         // Call negotiationSuccessFul after exi negotiation is finished successfully or not
-        if (shouldUseExi(netconfMessage)) {
+        final NetconfMessage startExiMessage = sessionPreferences.getStartExiMessage();
+        if (shouldUseExi(netconfMessage) && startExiMessage instanceof NetconfStartExiMessage) {
             LOG.debug("Netconf session {} should use exi.", session);
-            NetconfStartExiMessage startExiMessage = (NetconfStartExiMessage) sessionPreferences.getStartExiMessage();
-            tryToInitiateExi(session, startExiMessage);
+            tryToInitiateExi(session, (NetconfStartExiMessage) startExiMessage);
         } else {
             // Exi is not supported, release session immediately
             LOG.debug("Netconf session {} isn't capable of using exi.", session);
@@ -105,6 +107,7 @@ public class NetconfClientSessionNegotiator extends
         });
     }
 
+    @SuppressFBWarnings("BC_UNCONFIRMED_CAST")
     private boolean shouldUseExi(final NetconfHelloMessage helloMsg) {
         return containsExi10Capability(helloMsg.getDocument())
                 && containsExi10Capability(sessionPreferences.getHelloMessage().getDocument());
@@ -130,7 +133,7 @@ public class NetconfClientSessionNegotiator extends
             }
         }
 
-        return Long.valueOf(textContent);
+        return Long.parseLong(textContent);
     }
 
     private static String getSessionIdWithXPath(final Document doc, final XPathExpression sessionIdXPath) {
index 82e72045d44d258f770100980056d5e6e34e4eb8..26f33152dac04473d3c065f1dcab9694ffae8ca2 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.netconf.client;
 
 import com.google.common.base.Preconditions;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GlobalEventExecutor;
 import io.netty.util.concurrent.Promise;
@@ -40,6 +41,7 @@ public class SimpleNetconfClientSessionListener implements NetconfClientSessionL
     private NetconfClientSession clientSession;
 
     @GuardedBy("this")
+    @SuppressFBWarnings("RV_RETURN_VALUE_IGNORED")
     private void dispatchRequest() {
         while (!requests.isEmpty()) {
             final RequestEntry e = requests.peek();
index 2cf0e1a5cd32e04aaabf297a695e786946f8723b..5f25800b4b0c595137485c78fc0bc095c1114e82 100644 (file)
@@ -49,7 +49,7 @@ class TcpClientChannelInitializer extends AbstractChannelInitializer<NetconfClie
 
                 negotiationFutureListener = future -> {
                     if (future.isSuccess()) {
-                        connectPromise.setSuccess();
+                        channelPromise.setSuccess();
                     }
                 };
 
@@ -58,7 +58,7 @@ class TcpClientChannelInitializer extends AbstractChannelInitializer<NetconfClie
                         //complete connection promise with netconf negotiation future
                         negotiationFuture.addListener(negotiationFutureListener);
                     } else {
-                        connectPromise.setFailure(future.cause());
+                        channelPromise.setFailure(future.cause());
                     }
                 });
                 ctx.connect(remoteAddress, localAddress, tcpConnectFuture);
@@ -66,6 +66,10 @@ class TcpClientChannelInitializer extends AbstractChannelInitializer<NetconfClie
 
             @Override
             public void disconnect(final ChannelHandlerContext ctx, final ChannelPromise promise) throws Exception {
+                if (connectPromise == null) {
+                    return;
+                }
+
                 // If we have already succeeded and the session was dropped after, we need to fire inactive to notify
                 // reconnect logic
                 if (connectPromise.isSuccess()) {
index b25071156234e1a02b3a174413cfb6766a1893e7..ee41da8a8d165387d4da477d161c2830ac4e4445 100644 (file)
@@ -85,18 +85,17 @@ public class NetconfClientConfiguration {
         return sslHandlerFactory;
     }
 
-    @SuppressWarnings("checkstyle:FallThrough")
     private void validateConfiguration() {
         Preconditions.checkNotNull(clientProtocol, " ");
         switch (clientProtocol) {
             case TLS:
+                validateTlsConfiguration();
+                validateTcpConfiguration();
+                break;
             case SSH:
-                if (clientProtocol == NetconfClientProtocol.SSH) {
-                    validateSshConfiguration();
-                } else {
-                    validateTlsConfiguration();
-                }
-                // Fall through intentional (ssh or tls validation is a superset of tcp validation)
+                validateSshConfiguration();
+                validateTcpConfiguration();
+                break;
             case TCP:
                 validateTcpConfiguration();
                 break;
@@ -141,4 +140,4 @@ public class NetconfClientConfiguration {
     public enum NetconfClientProtocol {
         TCP, SSH, TLS
     }
-}
\ No newline at end of file
+}
index f7ef415f8910759288640c0d70b0a9d805c0b2ee..1a6b9c29ae501d4f3e542438fa4455712c05db84 100644 (file)
@@ -9,10 +9,10 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
@@ -21,32 +21,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>mdsal-artifacts</artifactId>
-        <version>1.8.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
       <!-- Apache Karaf console dependency -->
       <dependency>
@@ -96,16 +70,4 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
           <scope>test</scope>
     </dependency>
   </dependencies>
-
-  <build>
-    <plugins>
-        <plugin>
-            <groupId>org.apache.maven.plugins</groupId>
-            <artifactId>maven-checkstyle-plugin</artifactId>
-            <configuration>
-                <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-            </configuration>
-        </plugin>
-    </plugins>
-  </build>
 </project>
index 20f1234ac90dc9af0ebf30353370d5916d695648..ccb9c41bd6c0cb26863d80d2f5bf71a33f225986 100644 (file)
@@ -60,7 +60,7 @@ public class NetconfDisconnectDeviceCommand extends AbstractAction {
         if (!Strings.isNullOrEmpty(deviceId)) {
             status = service.disconnectDevice(deviceId);
         } else {
-            if (!NetconfCommandUtils.isIpValid(deviceIp) && !NetconfCommandUtils.isPortValid(devicePort)) {
+            if (!NetconfCommandUtils.isIpValid(deviceIp) || !NetconfCommandUtils.isPortValid(devicePort)) {
                 return "Invalid IP:" + deviceIp + " or Port:" + devicePort + "Please enter a valid entry to proceed.";
             }
             status = service.disconnectDevice(deviceIp, devicePort);
index 874dbc3c1b0db4ffcf8c6e59c295408cc3d769da..f34cbed0014489d34572178e41d8c612440bc635 100644 (file)
@@ -40,8 +40,7 @@ public class NetconfListDevicesCommand extends AbstractAction {
         table.column(NetconfConsoleConstants.NETCONF_PORT).alignLeft();
         table.column(NetconfConsoleConstants.STATUS).alignLeft();
 
-        for (final String nodeIds : allDevices.keySet()) {
-            final Map<String, String> attributes = allDevices.get(nodeIds);
+        for (final Map<String, String> attributes : allDevices.values()) {
             table.addRow().addContent(attributes.get(NetconfConsoleConstants.NETCONF_ID),
                     attributes.get(NetconfConsoleConstants.NETCONF_IP),
                     attributes.get(NetconfConsoleConstants.NETCONF_PORT),
index a6e76350a02299f8fbca45789d3ae81e5ead71ad..8ab84d7257168c3bd6818f5a1307b8064d20015b 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Strings;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import javax.annotation.Nonnull;
 import org.apache.karaf.shell.commands.Command;
 import org.apache.karaf.shell.commands.Option;
@@ -75,7 +76,7 @@ public class NetconfShowDeviceCommand extends AbstractAction {
         }
 
         if (!NetconfCommandUtils.isIpValid(deviceIp)
-                || (devicePort != null && !NetconfCommandUtils.isPortValid(devicePort))) {
+                || devicePort != null && !NetconfCommandUtils.isPortValid(devicePort)) {
             return "Invalid IP:" + deviceIp + " or Port:" + devicePort + "Please enter a valid entry to proceed.";
         }
 
@@ -93,8 +94,9 @@ public class NetconfShowDeviceCommand extends AbstractAction {
         table.column(NetconfConsoleConstants.STATUS).alignLeft();
         table.column(NetconfConsoleConstants.AVAILABLE_CAPABILITIES).alignLeft();
 
-        for (final String nodeId : devices.keySet()) {
-            final Map<String, List<String>> device = devices.get(nodeId);
+        for (final Entry<String, Map<String, List<String>>> entry : devices.entrySet()) {
+            final String nodeId = entry.getKey();
+            final Map<String, List<String>> device = entry.getValue();
             table.addRow().addContent(nodeId,
                     device.get(NetconfConsoleConstants.NETCONF_IP).get(NetconfConsoleConstants.DEFAULT_INDEX),
                     device.get(NetconfConsoleConstants.NETCONF_PORT).get(NetconfConsoleConstants.DEFAULT_INDEX),
index 9a9fa6e1ee09c7bf665027827c2f1144cc2c428a..8954e4a2947cc3c20a10108447e8d617b315fa83 100644 (file)
@@ -17,6 +17,7 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.UUID;
 import java.util.stream.Collectors;
@@ -73,7 +74,8 @@ public class NetconfCommandsImpl implements NetconfCommands {
             attributes.put(NetconfConsoleConstants.NETCONF_IP,
                     netconfNode.getHost().getIpAddress().getIpv4Address().getValue());
             attributes.put(NetconfConsoleConstants.NETCONF_PORT, netconfNode.getPort().getValue().toString());
-            attributes.put(NetconfConsoleConstants.STATUS, netconfNode.getConnectionStatus().name().toLowerCase());
+            attributes.put(NetconfConsoleConstants.STATUS, netconfNode.getConnectionStatus().name()
+                    .toLowerCase(Locale.ROOT));
             netconfNodes.put(node.getNodeId().getValue(), attributes);
         }
         return netconfNodes;
index 459155e0a713f34485f6cfec911b1903e92eaf52..b449c573b657e9736ef2177b6709ae8a13c0a49b 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
 
   <dependencyManagement>
     <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>config-artifacts</artifactId>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 
index b3e263a92beadc5f17597abc0eb46340556f3ff2..e32d5c7e451be7f4492b95ad499c11e5dc988627 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.netconf.impl;
 
 import com.google.common.base.Optional;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.channel.Channel;
 import io.netty.channel.local.LocalAddress;
 import io.netty.util.Timer;
@@ -52,6 +53,7 @@ public class NetconfServerSessionNegotiator
     }
 
     @Override
+    @SuppressFBWarnings("BC_UNCONFIRMED_CAST_OF_RETURN_VALUE")
     protected NetconfServerSession getSession(
             NetconfServerSessionListener sessionListener, Channel channel,
             NetconfHelloMessage message) {
index 10ef3cd59752704e51aeda6f331acdf4e1637ebf..0b07c774f250ef1db726c2a15b20ad016956f28b 100644 (file)
@@ -62,18 +62,19 @@ public class MessageParserTest {
         int msgLength = out.readableBytes();
 
         int chunkCount = msgLength / ChunkedFramingMechanismEncoder.DEFAULT_CHUNK_SIZE;
-        if ((msgLength % ChunkedFramingMechanismEncoder.DEFAULT_CHUNK_SIZE) != 0) {
+        if (msgLength % ChunkedFramingMechanismEncoder.DEFAULT_CHUNK_SIZE != 0) {
             chunkCount++;
         }
+
+        byte[] endOfChunkBytes = NetconfMessageConstants.END_OF_CHUNK.getBytes(StandardCharsets.UTF_8);
         for (int i = 1; i <= chunkCount; i++) {
             ByteBuf recievedOutbound = (ByteBuf) messages.poll();
             int exptHeaderLength = ChunkedFramingMechanismEncoder.DEFAULT_CHUNK_SIZE;
             if (i == chunkCount) {
-                exptHeaderLength = msgLength - (ChunkedFramingMechanismEncoder.DEFAULT_CHUNK_SIZE * (i - 1));
-                byte[] eom = new byte[NetconfMessageConstants.END_OF_CHUNK.length];
-                recievedOutbound
-                        .getBytes(recievedOutbound.readableBytes() - NetconfMessageConstants.END_OF_CHUNK.length, eom);
-                assertArrayEquals(NetconfMessageConstants.END_OF_CHUNK, eom);
+                exptHeaderLength = msgLength - ChunkedFramingMechanismEncoder.DEFAULT_CHUNK_SIZE * (i - 1);
+                byte[] eom = new byte[endOfChunkBytes.length];
+                recievedOutbound.getBytes(recievedOutbound.readableBytes() - endOfChunkBytes.length, eom);
+                assertArrayEquals(endOfChunkBytes, eom);
             }
 
             byte[] header = new byte[String.valueOf(exptHeaderLength).length()
@@ -99,10 +100,10 @@ public class MessageParserTest {
         testChunkChannel.writeOutbound(this.msg);
         ByteBuf recievedOutbound = (ByteBuf) testChunkChannel.readOutbound();
 
-        byte[] eom = new byte[NetconfMessageConstants.END_OF_MESSAGE.length];
-        recievedOutbound.getBytes(recievedOutbound.readableBytes() - NetconfMessageConstants.END_OF_MESSAGE.length,
-                eom);
-        assertArrayEquals(NetconfMessageConstants.END_OF_MESSAGE, eom);
+        byte[] endOfMsgBytes = NetconfMessageConstants.END_OF_MESSAGE.getBytes(StandardCharsets.UTF_8);
+        byte[] eom = new byte[endOfMsgBytes.length];
+        recievedOutbound.getBytes(recievedOutbound.readableBytes() - endOfMsgBytes.length, eom);
+        assertArrayEquals(endOfMsgBytes, eom);
 
         testChunkChannel.writeInbound(recievedOutbound);
         NetconfMessage receivedMessage = (NetconfMessage) testChunkChannel.readInbound();
index 7fe47055de076fec2c79aa6c8e42662db4ef004d..70dc1265b460b10a0b9091b9c6784376826898a7 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>guava</artifactId>
     </dependency>
   </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
 </project>
index 76dea738e971d9a9e88f1085b00f29ed436a3315..a0164f9be4de0293de48f9788435cb7103ec405a 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.mdsal.model</groupId>
-        <artifactId>mdsal-model-artifacts</artifactId>
-        <version>0.13.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <!-- compile dependencies -->
     <dependency>
           </instructions>
         </configuration>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 
index 57ce954dcea21a17abb18d3e11bc3c4df0801e71..37788249450e980f660f9d2b5df80b1f55f648cf 100644 (file)
@@ -30,7 +30,7 @@ final class MonitoringSchema {
 
     @XmlElement(name = "namespace")
     public String getNamespace() {
-        return schema.getNamespace().getValue().toString();
+        return schema.getNamespace().getValue();
     }
 
     @XmlElement(name = "location")
index 3a7a6434a8c3dbf692b4bde2ef5b728b0ec73fe1..d3dca9abdff528fa70cd93a9e8386e9dc1b08625 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
 
   <dependencyManagement>
     <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
       <dependency>
         <groupId>com.siemens.ct.exi</groupId>
         <artifactId>exificient</artifactId>
     </dependency>
   </dependencies>
 
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
 </project>
index 1d7a3cd5adad2b8b0218e91b1970fb999558b69d..f2592e42304fa62bc1fc9bcf6b149a6c7a7d6364 100644 (file)
@@ -13,7 +13,6 @@ import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.handler.codec.MessageToByteEncoder;
 import java.nio.charset.StandardCharsets;
-import org.opendaylight.netconf.util.messages.NetconfMessageConstants;
 
 public class ChunkedFramingMechanismEncoder extends MessageToByteEncoder<ByteBuf> {
     public static final int DEFAULT_CHUNK_SIZE = 8192;
@@ -41,13 +40,13 @@ public class ChunkedFramingMechanismEncoder extends MessageToByteEncoder<ByteBuf
         do {
             final int xfer = Math.min(chunkSize, msg.readableBytes());
 
-            out.writeBytes(NetconfMessageConstants.START_OF_CHUNK);
+            out.writeBytes(MessageParts.START_OF_CHUNK);
             out.writeBytes(String.valueOf(xfer).getBytes(StandardCharsets.US_ASCII));
             out.writeByte('\n');
 
             out.writeBytes(msg, xfer);
         } while (msg.isReadable());
 
-        out.writeBytes(NetconfMessageConstants.END_OF_CHUNK);
+        out.writeBytes(MessageParts.END_OF_CHUNK);
     }
 }
index fdb0aae950e225d5622f4433cd5a59dd39df89ef..74009a7301b87b9546ba26793ce89c99bb9b854d 100644 (file)
@@ -11,12 +11,11 @@ package org.opendaylight.netconf.nettyutil.handler;
 import io.netty.buffer.ByteBuf;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.handler.codec.MessageToByteEncoder;
-import org.opendaylight.netconf.util.messages.NetconfMessageConstants;
 
 public class EOMFramingMechanismEncoder extends MessageToByteEncoder<ByteBuf> {
     @Override
     protected void encode(ChannelHandlerContext ctx, ByteBuf msg, ByteBuf out) {
         out.writeBytes(msg);
-        out.writeBytes(NetconfMessageConstants.END_OF_MESSAGE);
+        out.writeBytes(MessageParts.END_OF_MESSAGE);
     }
 }
diff --git a/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/MessageParts.java b/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/MessageParts.java
new file mode 100644 (file)
index 0000000..3db8ca6
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2018 Inocybe Technologies 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.nettyutil.handler;
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import org.opendaylight.netconf.util.messages.NetconfMessageConstants;
+
+/**
+ * netconf message part constants as bytes.
+ *
+ * @author Thomas Pantelis
+ */
+interface MessageParts {
+    byte[] END_OF_MESSAGE = NetconfMessageConstants.END_OF_MESSAGE.getBytes(UTF_8);
+    byte[] START_OF_CHUNK = NetconfMessageConstants.START_OF_CHUNK.getBytes(UTF_8);
+    byte[] END_OF_CHUNK = NetconfMessageConstants.END_OF_CHUNK.getBytes(UTF_8);
+}
index 6c0f5a1f6e658043e3fb5c7965def379694fdeca..9c441404d82373d69b41ee302a6ea38cb36d2025 100644 (file)
@@ -11,11 +11,10 @@ package org.opendaylight.netconf.nettyutil.handler;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import io.netty.handler.codec.DelimiterBasedFrameDecoder;
-import org.opendaylight.netconf.util.messages.NetconfMessageConstants;
 
 public class NetconfEOMAggregator extends DelimiterBasedFrameDecoder {
 
-    public static final ByteBuf DELIMITER = Unpooled.wrappedBuffer(NetconfMessageConstants.END_OF_MESSAGE);
+    public static final ByteBuf DELIMITER = Unpooled.wrappedBuffer(MessageParts.END_OF_MESSAGE);
 
     public NetconfEOMAggregator() {
         super(Integer.MAX_VALUE, DELIMITER);
index c3ff3496625e0f84f154692f49d71b924d67ca15..2d080ef3fca0e4372937b8bcb11c807fd5a1264a 100644 (file)
@@ -119,9 +119,10 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
 
             session = future.getSession();
             final AuthFuture authenticateFuture = authenticationHandler.authenticate(session);
+            final ClientSession localSession = session;
             authenticateFuture.addListener(future1 -> {
                 if (future1.isSuccess()) {
-                    handleSshAuthenticated(session, ctx);
+                    handleSshAuthenticated(localSession, ctx);
                 } else {
                     // Exception does not have to be set in the future, add simple exception in such case
                     final Throwable exception = future1.getException() == null
@@ -164,8 +165,9 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
 
         // TODO we should also read from error stream and at least log from that
 
+        ClientChannel localChannel = channel;
         sshReadAsyncListener = new AsyncSshHandlerReader(() -> AsyncSshHandler.this.disconnect(ctx, ctx.newPromise()),
-            msg -> ctx.fireChannelRead(msg), channel.toString(), channel.getAsyncOut());
+            msg -> ctx.fireChannelRead(msg), localChannel.toString(), localChannel.getAsyncOut());
 
         // if readAsyncListener receives immediate close,
         // it will close this handler and closing this handler sets channel variable to null
@@ -198,10 +200,9 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
         this.connectPromise = promise;
 
         if (negotiationFuture != null) {
-
             negotiationFutureListener = future -> {
                 if (future.isSuccess()) {
-                    connectPromise.setSuccess();
+                    promise.setSuccess();
                 }
             };
             //complete connection promise with netconf negotiation future
@@ -249,10 +250,12 @@ public class AsyncSshHandler extends ChannelOutboundHandlerAdapter {
 
         if (session != null && !session.isClosed() && !session.isClosing()) {
             session.close(false).addListener(future -> {
-                if (!future.isClosed()) {
-                    session.close(true);
+                synchronized (this) {
+                    if (!future.isClosed()) {
+                        session.close(true);
+                    }
+                    session = null;
                 }
-                session = null;
             });
         }
 
index 748e55c47afd3992db4e7fc3616532465b599457..b00de8ad5f0b9d8413b4865eb4117238a2d79c2e 100644 (file)
@@ -13,7 +13,6 @@ import static org.junit.Assert.assertEquals;
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import org.junit.Test;
-import org.opendaylight.netconf.util.messages.NetconfMessageConstants;
 
 public class EOMFramingMechanismEncoderTest {
 
@@ -24,6 +23,6 @@ public class EOMFramingMechanismEncoderTest {
         final ByteBuf destination = Unpooled.buffer();
         new EOMFramingMechanismEncoder().encode(null, source, destination);
 
-        assertEquals(Unpooled.wrappedBuffer(source.array(), NetconfMessageConstants.END_OF_MESSAGE), destination);
+        assertEquals(Unpooled.wrappedBuffer(source.array(), MessageParts.END_OF_MESSAGE), destination);
     }
-}
\ No newline at end of file
+}
index 8fdd15827cb3def1900f449d7f76dab054a5985c..5af5697fa65c4e23392b267af88d9fae51720c12 100644 (file)
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.opendaylight.odlparent</groupId>
-        <artifactId>bundle-parent</artifactId>
-        <version>3.0.2</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
     <version>1.5.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
             <artifactId>slf4j-api</artifactId>
         </dependency>
     </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>
index 3e7f562434770fe89cb0912e2d76b9c1b92c8836..87de89a5dba7f94488b6ebae6fdafd69923aa874 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.netconf.notifications;
 
 import com.google.common.base.Preconditions;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.text.ParsePosition;
 import java.time.Instant;
 import java.time.LocalDateTime;
@@ -179,6 +180,7 @@ public final class NetconfNotification extends NetconfMessage {
     /**
      * Create new notification with provided timestamp.
      */
+    @SuppressFBWarnings("EI_EXPOSE_REP2") // stores a reference to an externally mutable Date object
     public NetconfNotification(final Document notificationContent, final Date eventTime) {
         super(wrapNotification(notificationContent, eventTime));
         this.eventTime = eventTime;
@@ -189,6 +191,7 @@ public final class NetconfNotification extends NetconfMessage {
      *
      * @return notification event time
      */
+    @SuppressFBWarnings("EI_EXPOSE_REP")
     public Date getEventTime() {
         return eventTime;
     }
index 227dac8bd10e87640dbbe20f626fbf846db87959..a3ba09d626c42db95e682e44a0cf99ea889c4487 100644 (file)
          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>bundle-parent</artifactId>
-        <version>3.0.2</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
     <version>1.5.0-SNAPSHOT</version>
     <packaging>bundle</packaging>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.mdsal</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>2.5.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yangtools-artifacts</artifactId>
-                <version>2.0.2</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
                     </instructions>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
 </project>
index f45192c3b89d3b74d786f0e52537ec8b132eed81..a657e34a1c2d083095becea200a7b271d1a8f7c1 100644 (file)
@@ -10,7 +10,6 @@ package org.opendaylight.netconf.notifications.impl.ops;
 
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
-import com.google.common.base.Predicate;
 import com.google.common.collect.Collections2;
 import com.google.common.collect.Iterables;
 import java.io.IOException;
@@ -69,12 +68,7 @@ public final class NotificationsTransformUtil {
 
     private static RpcDefinition findCreateSubscriptionRpc() {
         return Iterables.getFirst(Collections2.filter(NOTIFICATIONS_SCHEMA_CTX.getOperations(),
-            new Predicate<RpcDefinition>() {
-                @Override
-                public boolean apply(final RpcDefinition input) {
-                    return input.getQName().getLocalName().equals(CreateSubscription.CREATE_SUBSCRIPTION);
-                }
-            }), null);
+            input -> input.getQName().getLocalName().equals(CreateSubscription.CREATE_SUBSCRIPTION)), null);
     }
 
     /**
diff --git a/netconf/netconf-parent/pom.xml b/netconf/netconf-parent/pom.xml
new file mode 100644 (file)
index 0000000..acb0b82
--- /dev/null
@@ -0,0 +1,67 @@
+<?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.mdsal</groupId>
+    <artifactId>binding-parent</artifactId>
+    <version>0.13.0-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <groupId>org.opendaylight.netconf</groupId>
+  <artifactId>netconf-parent</artifactId>
+  <version>1.5.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <dependencyManagement>
+    <dependencies>
+      <dependency>
+        <groupId>org.opendaylight.aaa</groupId>
+        <artifactId>aaa-artifacts</artifactId>
+        <version>0.8.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>mdsal-artifacts</artifactId>
+        <version>1.8.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-artifacts</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <type>pom</type>
+        <scope>import</scope>
+      </dependency>
+    </dependencies>
+  </dependencyManagement>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-checkstyle-plugin</artifactId>
+        <configuration>
+          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+        </configuration>
+      </plugin>
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>findbugs-maven-plugin</artifactId>
+        <configuration>
+          <failOnError>true</failOnError>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+</project>
index 7270341f840e50567f8ac41a7e14780b9e6b4686..e7976f3def6f2c7e421095a62e62fe4739ccfb18 100644 (file)
@@ -9,10 +9,10 @@
 <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>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
 
   <dependencyManagement>
     <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>config-artifacts</artifactId>
         <type>pom</type>
         <scope>import</scope>
       </dependency>
-      <dependency>
-        <groupId>org.opendaylight.mdsal.model</groupId>
-        <artifactId>mdsal-model-artifacts</artifactId>
-        <version>0.13.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
     </dependencies>
   </dependencyManagement>
 
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 
index 2a198383a693c91b90b6f3faa7462d64772a2ac9..e8ec506026d24d79255e6788671d28e836b87360 100644 (file)
@@ -8,10 +8,10 @@
 
 package org.opendaylight.netconf.ssh;
 
-import io.netty.buffer.ByteBuf;
 import io.netty.buffer.Unpooled;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInboundHandlerAdapter;
+import java.nio.charset.StandardCharsets;
 import org.apache.sshd.common.io.IoInputStream;
 import org.apache.sshd.common.io.IoOutputStream;
 import org.apache.sshd.server.ExitCallback;
@@ -52,27 +52,21 @@ final class SshProxyClientHandler extends ChannelInboundHandlerAdapter {
         writeAdditionalHeader(ctx);
 
         asyncSshHandlerWriter = new AsyncSshHandlerWriter(out);
-        asyncSshHandlerReader = new AsyncSshHandlerReader(new AutoCloseable() {
-            @Override
-            public void close() throws Exception {
-                // Close both sessions (delegate server and remote client)
-                ctx.fireChannelInactive();
-                ctx.disconnect();
-                ctx.close();
-                asyncSshHandlerReader.close();
-                asyncSshHandlerWriter.close();
-            }
-        }, new AsyncSshHandlerReader.ReadMsgHandler() {
-            @Override
-            public void onMessageRead(final ByteBuf msg) {
-                if (LOG.isTraceEnabled()) {
-                    LOG.trace("Forwarding message for client: {} on channel: {}, message: {}",
-                            netconfHelloMessageAdditionalHeader.getAddress(), ctx.channel(),
-                            AsyncSshHandlerWriter.byteBufToString(msg));
-                }
-                // Just forward to delegate
-                ctx.writeAndFlush(msg);
+        asyncSshHandlerReader = new AsyncSshHandlerReader(() -> {
+            // Close both sessions (delegate server and remote client)
+            ctx.fireChannelInactive();
+            ctx.disconnect();
+            ctx.close();
+            asyncSshHandlerReader.close();
+            asyncSshHandlerWriter.close();
+        }, msg -> {
+            if (LOG.isTraceEnabled()) {
+                LOG.trace("Forwarding message for client: {} on channel: {}, message: {}",
+                        netconfHelloMessageAdditionalHeader.getAddress(), ctx.channel(),
+                        AsyncSshHandlerWriter.byteBufToString(msg));
             }
+            // Just forward to delegate
+            ctx.writeAndFlush(msg);
         }, "ssh" + netconfHelloMessageAdditionalHeader.getAddress(), in);
 
 
@@ -80,7 +74,8 @@ final class SshProxyClientHandler extends ChannelInboundHandlerAdapter {
     }
 
     private void writeAdditionalHeader(final ChannelHandlerContext ctx) {
-        ctx.writeAndFlush(Unpooled.copiedBuffer(netconfHelloMessageAdditionalHeader.toFormattedString().getBytes()));
+        ctx.writeAndFlush(Unpooled.copiedBuffer(netconfHelloMessageAdditionalHeader.toFormattedString()
+                .getBytes(StandardCharsets.UTF_8)));
     }
 
     @Override
index 406a28aee4722740fdd04364f851832d2d40a522..f638a2bfbf13e35e53adbdc8f2e800ffeb6e308e 100644 (file)
@@ -12,9 +12,7 @@ import com.google.common.collect.ImmutableList;
 import io.netty.channel.EventLoopGroup;
 import java.io.IOException;
 import java.nio.channels.AsynchronousChannelGroup;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
@@ -84,15 +82,6 @@ public class SshProxyServer implements AutoCloseable {
         sshServer.start();
     }
 
-    private static Map<String, String> getProperties(final SshProxyServerConfiguration sshProxyServerConfiguration) {
-        final Map<String, String> ret = new HashMap<>();
-        ret.put(ServerFactoryManager.IDLE_TIMEOUT, String.valueOf(sshProxyServerConfiguration.getIdleTimeout()));
-        // TODO make auth timeout configurable on its own
-        ret.put(ServerFactoryManager.AUTH_TIMEOUT, String.valueOf(sshProxyServerConfiguration.getIdleTimeout()));
-
-        return ret;
-    }
-
     @Override
     public void close() throws IOException {
         try {
index 8bf5105342e8583c6547c920bbf6e2e057d71000..5ff0635a998cea267697163aee21e1bb7fb4e91d 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
 
   <dependencyManagement>
     <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
       <dependency>
         <groupId>org.opendaylight.controller</groupId>
         <artifactId>config-artifacts</artifactId>
       <artifactId>org.osgi.compendium</artifactId>
     </dependency>
   </dependencies>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-
 </project>
index 953c96ac90ca7dfa8a1b9f14163aef480dca6610..2ed1044b38d02b773712ad472653f3558e355dcd 100644 (file)
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.opendaylight.mdsal</groupId>
-        <artifactId>binding-parent</artifactId>
-        <version>0.13.0-SNAPSHOT</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
 
     <dependencyManagement>
         <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
             <dependency>
                 <groupId>org.opendaylight.controller</groupId>
                 <artifactId>config-artifacts</artifactId>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
-            <dependency>
-                <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
         </dependencies>
     </dependencyManagement>
 
             <artifactId>akka-testkit_2.12</artifactId>
         </dependency>
     </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>
index 62508a2c3b1d9ec9ccb0155ca147290217252662..0ac355d6dc0e4b53059e953b43d474cbd21b2ac4 100644 (file)
@@ -18,6 +18,7 @@ import akka.util.Timeout;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
+import java.util.concurrent.atomic.AtomicBoolean;
 import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService;
@@ -47,7 +48,7 @@ class NetconfTopologyContext implements ClusterSingletonService {
     private NetconfNodeManager netconfNodeManager;
     private ActorRef masterActorRef;
     private boolean finalClose = false;
-    private boolean closed = false;
+    private final AtomicBoolean closed = new AtomicBoolean(false);
     private boolean isMaster;
 
     NetconfTopologyContext(final NetconfTopologySetup netconfTopologyDeviceSetup,
@@ -164,8 +165,8 @@ class NetconfTopologyContext implements ClusterSingletonService {
         }
     }
 
-    private synchronized void stopDeviceConnectorAndActor() {
-        if (closed) {
+    private void stopDeviceConnectorAndActor() {
+        if (!closed.compareAndSet(false, true)) {
             return;
         }
         if (remoteDeviceConnector != null) {
@@ -176,6 +177,5 @@ class NetconfTopologyContext implements ClusterSingletonService {
             netconfTopologyDeviceSetup.getActorSystem().stop(masterActorRef);
             masterActorRef = null;
         }
-        closed = true;
     }
 }
index fd1d84168c99ab021024bf158fa8dcae24e62176..40511bf781367eeffe2823de3a336a3251fe8f51 100644 (file)
@@ -153,11 +153,11 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
     NetconfConnectorDTO createDeviceCommunicator(final NodeId nodeId, final NetconfNode node,
                                                  final ActorRef deviceContextActorRef) {
         //setup default values since default value is not supported in mdsal
-        final Long defaultRequestTimeoutMillis = node.getDefaultRequestTimeoutMillis() == null
+        final long defaultRequestTimeoutMillis = node.getDefaultRequestTimeoutMillis() == null
                 ? NetconfTopologyUtils.DEFAULT_REQUEST_TIMEOUT_MILLIS : node.getDefaultRequestTimeoutMillis();
-        final Long keepaliveDelay = node.getKeepaliveDelay() == null
+        final long keepaliveDelay = node.getKeepaliveDelay() == null
                 ? NetconfTopologyUtils.DEFAULT_KEEPALIVE_DELAY : node.getKeepaliveDelay();
-        final Boolean reconnectOnChangedSchema = node.isReconnectOnChangedSchema() == null
+        final boolean reconnectOnChangedSchema = node.isReconnectOnChangedSchema() == null
                 ? NetconfTopologyUtils.DEFAULT_RECONNECT_ON_CHANGED_SCHEMA : node.isReconnectOnChangedSchema();
 
         RemoteDeviceHandler<NetconfSessionPreferences> salFacade = new MasterSalFacade(remoteDeviceId,
@@ -352,11 +352,8 @@ public class RemoteDeviceConnectorImpl implements RemoteDeviceConnector {
 
         @Override
         public ReconnectStrategy createReconnectStrategy() {
-            final Long maxSleep = null;
-            final Long deadline = null;
-
             return new TimedReconnectStrategy(executor, minSleep,
-                    minSleep, sleepFactor, maxSleep, connectionAttempts, deadline);
+                    minSleep, sleepFactor, null /*maxSleep*/, connectionAttempts, null /*deadline*/);
         }
     }
 }
index 89547421c7c50d352ec7f9c4e660709631592f01..3a3fad9ce46a4628a6b8d8b6d717462e02dd2399 100644 (file)
@@ -259,7 +259,7 @@ public final class NetconfNodeActor extends UntypedActor {
 
         Futures.addCallback(remoteSchemaContext, new FutureCallback<SchemaContext>() {
             @Override
-            public void onSuccess(final SchemaContext result) {
+            public void onSuccess(@Nonnull final SchemaContext result) {
                 LOG.info("{}: Schema context resolved: {}", id, result.getModules());
                 slaveSalManager.registerSlaveMountPoint(result, deviceRpcService, masterReference);
             }
index 3d881e65def18fd6ff0a15c21064922e8a2bee45..6b79f621257ad0abcc2a7d19996b41db4ce86325 100644 (file)
@@ -56,7 +56,7 @@ class ReadAdapter {
         Futures.addCallback(read, new FutureCallback<Optional<NormalizedNode<?, ?>>>() {
 
             @Override
-            public void onSuccess(final Optional<NormalizedNode<?, ?>> result) {
+            public void onSuccess(@Nonnull final Optional<NormalizedNode<?, ?>> result) {
                 if (!result.isPresent()) {
                     sender.tell(new EmptyReadResponse(), self);
                     return;
index 2b2759ba0f6e8fbd95a431e2c77d74e2d2ae6726..e0075476e7769db1640c583134e528810fb2c88d 100644 (file)
@@ -13,14 +13,11 @@ import akka.actor.ActorSystem;
 import akka.util.Timeout;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -53,11 +50,6 @@ public class ProxyReadWriteTransaction implements DOMDataReadWriteTransaction {
         return delegateWrite.cancel();
     }
 
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return delegateWrite.commit(getIdentifier());
-    }
-
     @Override
     public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(final LogicalDatastoreType store,
                                                                                    final YangInstanceIdentifier path) {
index a833e3bb422ef721030ea426beab4c45ee40c08f..703cfce42ccdbbae5392d1df6812b98524ebdfaf 100644 (file)
@@ -17,11 +17,9 @@ import com.google.common.base.Function;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
-import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.concurrent.atomic.AtomicBoolean;
 import javax.annotation.Nullable;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
@@ -33,8 +31,6 @@ import org.opendaylight.netconf.topology.singleton.messages.transactions.MergeRe
 import org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequest;
 import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitFailedReply;
 import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitRequest;
-import org.opendaylight.yangtools.yang.common.RpcResult;
-import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.slf4j.Logger;
@@ -120,19 +116,6 @@ public class ProxyWriteAdapter {
         });
     }
 
-    public ListenableFuture<RpcResult<TransactionStatus>> commit(final Object identifier) {
-        LOG.trace("{}: Commit", id);
-
-        final CheckedFuture<Void, TransactionCommitFailedException> submit = submit(identifier);
-        return Futures.transform(submit, new Function<Void, RpcResult<TransactionStatus>>() {
-            @Nullable
-            @Override
-            public RpcResult<TransactionStatus> apply(@Nullable final Void input) {
-                return RpcResultBuilder.success(TransactionStatus.SUBMITED).build();
-            }
-        });
-    }
-
     public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier identifier) {
         Preconditions.checkState(opened.get(), "%s: Transaction was closed %s", id, identifier);
         LOG.trace("{}: Delete {} via NETCONF: {}", id, store, identifier);
index f8504c029c28e960ad42d01b7257fbadd6464b18..f2ed8b7e04a141a1014f0a0ee87aaa658158daff 100644 (file)
@@ -12,13 +12,10 @@ import akka.actor.ActorRef;
 import akka.actor.ActorSystem;
 import akka.util.Timeout;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -54,11 +51,6 @@ public class ProxyWriteTransaction implements DOMDataWriteTransaction {
         return proxyWriteAdapter.submit(getIdentifier());
     }
 
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return proxyWriteAdapter.commit(getIdentifier());
-    }
-
     @Override
     public void delete(final LogicalDatastoreType store, final YangInstanceIdentifier identifier) {
         proxyWriteAdapter.delete(store, identifier);
index 45fd4df0f6e66f2e63ba8633a6ec2c7d78af8fd5..b9ce540fd6df321902418a256ffe4d7373e8cd78 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.netconf.topology.singleton.messages;
 
-import java.io.Serializable;
 import java.util.List;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
@@ -17,9 +16,7 @@ import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
 /**
  * Master sends this message to the own actor to set necessary parameters.
  */
-public class CreateInitialMasterActorData implements Serializable {
-    private static final long serialVersionUID = 1L;
-
+public class CreateInitialMasterActorData {
     private final DOMDataBroker deviceDataBroker;
     private final List<SourceIdentifier> allSourceIdentifiers;
     private final DOMRpcService deviceRpc;
index 2f6e2e250696fb3d44af54c55db094ef28d2c5fb..47befecaad425575634763ee72a848a87347e594 100644 (file)
@@ -8,16 +8,13 @@
 
 package org.opendaylight.netconf.topology.singleton.messages;
 
-import java.io.Serializable;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
 import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologySetup;
 
 /**
  * Master sends this message to the own actor to refresh setup data.
  */
-public class RefreshSetupMasterActorData implements Serializable {
-    private static final long serialVersionUID = 1L;
-
+public class RefreshSetupMasterActorData {
     private final NetconfTopologySetup netconfTopologyDeviceSetup;
     private final RemoteDeviceId remoteDeviceId;
 
index 47023f219fd96643c0474ef0d20c00a60e70fcf8..95798f66ac0a883c037e9ce26a3e8ee5b0057dfc 100644 (file)
@@ -9,13 +9,12 @@
 package org.opendaylight.netconf.topology.singleton.messages;
 
 import akka.util.Timeout;
-import java.io.Serializable;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
 import org.opendaylight.netconf.topology.singleton.impl.utils.NetconfTopologySetup;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaRepository;
 import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceRegistry;
 
-public class RefreshSlaveActor implements Serializable {
+public class RefreshSlaveActor {
 
     private final SchemaRepository schemaRepository;
     private final RemoteDeviceId id;
index 319b375340262e221b9dc4e0027fbbc88777ec79..a34697885e7d37b1ac3843b1df5c3cc536ce9dd1 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.netconf.topology.singleton.messages;
 
 import com.google.common.collect.Iterables;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -20,7 +21,8 @@ import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 public class SchemaPathMessage implements Serializable {
     private static final long serialVersionUID = 1L;
 
-    private SchemaPath schemaPath;
+    @SuppressFBWarnings("SE_BAD_FIELD")
+    private final SchemaPath schemaPath;
 
     public SchemaPathMessage(final SchemaPath schemaPath) {
         this.schemaPath = schemaPath;
@@ -39,7 +41,8 @@ public class SchemaPathMessage implements Serializable {
 
         private SchemaPathMessage schemaPathMessage;
 
-        Proxy() {
+        @SuppressWarnings("checkstyle:RedundantModifier")
+        public Proxy() {
             //due to Externalizable
         }
 
index 9a0e5c35e5fe57a32e3765e99f821aadc9e975a0..d540e23f8d6b3dbf066dc5daedcc5c195d1970d4 100644 (file)
@@ -50,7 +50,8 @@ public class InvokeRpcMessage implements Serializable {
 
         private InvokeRpcMessage invokeRpcMessage;
 
-        Proxy() {
+        @SuppressWarnings("checkstyle:RedundantModifier")
+        public Proxy() {
             //due to Externalizable
         }
 
index ba658ba92f83b41db87812160987743a37a4564c..b70582354cc6cd476fd72e93d0303a0211d7babf 100644 (file)
@@ -8,6 +8,7 @@
 
 package org.opendaylight.netconf.topology.singleton.messages.rpc;
 
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.Externalizable;
 import java.io.IOException;
 import java.io.ObjectInput;
@@ -21,6 +22,7 @@ import org.opendaylight.yangtools.yang.common.RpcError;
 public class InvokeRpcMessageReply implements Serializable {
     private static final long serialVersionUID = 1L;
 
+    @SuppressFBWarnings("SE_BAD_FIELD")
     private final Collection<RpcError> rpcErrors;
     private final NormalizedNodeMessage normalizedNodeMessage;
 
@@ -47,7 +49,8 @@ public class InvokeRpcMessageReply implements Serializable {
 
         private InvokeRpcMessageReply invokeRpcMessageReply;
 
-        Proxy() {
+        @SuppressWarnings("checkstyle:RedundantModifier")
+        public Proxy() {
             //due to Externalizable
         }
 
index 30a6867f1a0189177b1a963645a3ebfd3eb4a2fd..ee692518db5dce88f4addd1ccd9d6d1246fff50e 100644 (file)
@@ -14,7 +14,6 @@ import akka.testkit.TestProbe;
 import akka.util.Timeout;
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
 import java.net.InetSocketAddress;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
@@ -24,7 +23,6 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.controller.config.util.xml.DocumentedException;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
@@ -40,7 +38,6 @@ import org.opendaylight.netconf.topology.singleton.messages.transactions.ReadReq
 import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitReply;
 import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitRequest;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
@@ -112,14 +109,6 @@ public class ProxyReadWriteTransactionTest {
         }
     }
 
-    @Test
-    public void testCommit() throws Exception {
-        final ListenableFuture<RpcResult<TransactionStatus>> submitFuture = tx.commit();
-        masterActor.expectMsgClass(SubmitRequest.class);
-        masterActor.reply(new SubmitReply());
-        Assert.assertEquals(TransactionStatus.SUBMITED, submitFuture.get().getResult());
-    }
-
     @Test
     public void testDelete() throws Exception {
         tx.delete(STORE, PATH);
@@ -244,4 +233,4 @@ public class ProxyReadWriteTransactionTest {
             Assert.assertEquals(DocumentedException.ErrorType.APPLICATION, de.getErrorType());
         }
     }
-}
\ No newline at end of file
+}
index b51375b14558803e1c873c358b01b04407e87f5a..159bdc1a7ed10084722417bccece988f664123a1 100644 (file)
@@ -22,7 +22,6 @@ import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
@@ -33,7 +32,6 @@ import org.opendaylight.netconf.topology.singleton.messages.transactions.PutRequ
 import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitReply;
 import org.opendaylight.netconf.topology.singleton.messages.transactions.SubmitRequest;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
@@ -104,14 +102,6 @@ public class ProxyWriteTransactionTest {
         }
     }
 
-    @Test
-    public void testCommit() throws Exception {
-        final ListenableFuture<RpcResult<TransactionStatus>> submitFuture = tx.commit();
-        masterActor.expectMsgClass(SubmitRequest.class);
-        masterActor.reply(new SubmitReply());
-        Assert.assertEquals(TransactionStatus.SUBMITED, submitFuture.get().getResult());
-    }
-
     @Test
     public void testDelete() throws Exception {
         tx.delete(STORE, PATH);
@@ -175,4 +165,4 @@ public class ProxyWriteTransactionTest {
         submit.checkedGet();
     }
 
-}
\ No newline at end of file
+}
index e1b9a60125f126289a96bce384177305f1182e86..f60f24cdbde305ce6d32878fd1d0b5964d620fcc 100644 (file)
@@ -4,10 +4,10 @@
          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>bundle-parent</artifactId>
-        <version>3.0.2</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
 
     <dependencyManagement>
         <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
             <dependency>
                 <groupId>org.opendaylight.controller</groupId>
                 <artifactId>config-artifacts</artifactId>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
-            <dependency>
-                <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yangtools-artifacts</artifactId>
-                <version>2.0.2</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
         </dependencies>
     </dependencyManagement>
 
             <version>0.8.0-SNAPSHOT</version>
         </dependency>
     </dependencies>
-
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
-        </plugins>
-    </build>
 </project>
index 9bc6b59e7e8ccc7788df3144a801c11ee9bfa4a2..e3a84195332f6713962567f1307e7cc4af1a41d4 100644 (file)
@@ -278,11 +278,11 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
     protected NetconfConnectorDTO createDeviceCommunicator(final NodeId nodeId,
                                                            final NetconfNode node) {
         //setup default values since default value is not supported in mdsal
-        final Long defaultRequestTimeoutMillis = node.getDefaultRequestTimeoutMillis() == null
+        final long defaultRequestTimeoutMillis = node.getDefaultRequestTimeoutMillis() == null
                 ? DEFAULT_REQUEST_TIMEOUT_MILLIS : node.getDefaultRequestTimeoutMillis();
-        final Long keepaliveDelay = node.getKeepaliveDelay() == null
+        final long keepaliveDelay = node.getKeepaliveDelay() == null
                 ? DEFAULT_KEEPALIVE_DELAY : node.getKeepaliveDelay();
-        final Boolean reconnectOnChangedSchema = node.isReconnectOnChangedSchema() == null
+        final boolean reconnectOnChangedSchema = node.isReconnectOnChangedSchema() == null
                 ? DEFAULT_RECONNECT_ON_CHANGED_SCHEMA : node.isReconnectOnChangedSchema();
 
         final IpAddress ipAddress = node.getHost().getIpAddress();
@@ -579,11 +579,8 @@ public abstract class AbstractNetconfTopology implements NetconfTopology {
 
         @Override
         public ReconnectStrategy createReconnectStrategy() {
-            final Long maxSleep = null;
-            final Long deadline = null;
-
             return new TimedReconnectStrategy(executor, minSleep,
-                    minSleep, sleepFactor, maxSleep, connectionAttempts, deadline);
+                    minSleep, sleepFactor, null /*maxSleep*/, connectionAttempts, null /*deadline*/);
         }
     }
 
index e0d8968ff303d03c2a12704d34707fbd27ed17a8..7642915fae035dbcda71243f81b9dd4b65177d94 100644 (file)
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
-    <groupId>org.opendaylight.odlparent</groupId>
-    <artifactId>bundle-parent</artifactId>
-    <version>3.0.2</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <name>${project.artifactId}</name>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>${project.version}</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.yangtools</groupId>
-        <artifactId>yangtools-artifacts</artifactId>
-        <version>2.0.2</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.mdsal</groupId>
-        <artifactId>mdsal-artifacts</artifactId>
-        <version>2.5.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <!-- compile dependencies -->
     <dependency>
           </execution>
         </executions>
       </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
     </plugins>
   </build>
 
index 4117918d5322ae79e8cfa9b0e8138c08ddb3ce7e..df5b4bc8d320af34d6444d3352b9a53a357341d0 100644 (file)
@@ -8,27 +8,22 @@
 
 package org.opendaylight.netconf.util.messages;
 
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-public final class NetconfMessageConstants {
-
-    private NetconfMessageConstants(){}
+public interface NetconfMessageConstants {
 
     /**
      * The NETCONF 1.0 old-style message separator. This is framing mechanism
      * is used by default.
      */
-    public static final byte[] END_OF_MESSAGE = "]]>]]>".getBytes(UTF_8);
+    String END_OF_MESSAGE = "]]>]]>";
 
     // bytes
 
-    public static final int MIN_HEADER_LENGTH = 4;
+    int MIN_HEADER_LENGTH = 4;
 
     // bytes
 
-    public static final int MAX_HEADER_LENGTH = 13;
-
-    public static final byte[] START_OF_CHUNK = "\n#".getBytes(UTF_8);
-    public static final byte[] END_OF_CHUNK = "\n##\n".getBytes(UTF_8);
+    int MAX_HEADER_LENGTH = 13;
 
+    String START_OF_CHUNK = "\n#";
+    String END_OF_CHUNK = "\n##\n";
 }
index a9ed4632035d937e27b07823aca883302b1b4d51..c768ac9593ecc82479531022a4658c2e546d1d6f 100644 (file)
@@ -35,6 +35,7 @@
     <module>mdsal-netconf-notification</module>
     <module>mdsal-netconf-yang-library</module>
     <module>mdsal-netconf-impl</module>
+    <module>netconf-parent</module>
     <module>netconf-util</module>
     <module>netconf-netty-util</module>
     <module>netconf-mapping-api</module>
index 52cfacbb2d4375b0bb8d49ad6115d7c6cc90f1cc..9b9a0d4672c82b7b6c50feaf50458d702941c3b7 100644 (file)
@@ -9,10 +9,10 @@
 <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.mdsal</groupId>
-    <artifactId>binding-parent</artifactId>
-    <version>0.13.0-SNAPSHOT</version>
-    <relativePath/>
+    <groupId>org.opendaylight.netconf</groupId>
+    <artifactId>netconf-parent</artifactId>
+    <version>1.5.0-SNAPSHOT</version>
+    <relativePath>../netconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
   <version>1.8.0-SNAPSHOT</version>
   <packaging>bundle</packaging>
 
-  <dependencyManagement>
-    <dependencies>
-      <dependency>
-        <groupId>org.opendaylight.controller</groupId>
-        <artifactId>mdsal-artifacts</artifactId>
-        <version>1.8.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>netconf-artifacts</artifactId>
-        <version>1.5.0-SNAPSHOT</version>
-        <type>pom</type>
-        <scope>import</scope>
-      </dependency>
-    </dependencies>
-  </dependencyManagement>
-
   <dependencies>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
     <tag>HEAD</tag>
     <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:MD-SAL</url>
   </scm>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-checkstyle-plugin</artifactId>
-        <configuration>
-          <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
 </project>
index 68fb36018b7e26cd2a8da7921b0c536b0323efe5..9e62919cf688852953d57c428f2e363d22262c31 100644 (file)
@@ -24,16 +24,22 @@ import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URI;
+import java.net.URISyntaxException;
 import java.net.URL;
 import java.net.URLConnection;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.util.AbstractMap;
 import java.util.Collections;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.ExecutionException;
 import java.util.regex.Pattern;
 import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.transform.dom.DOMSource;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
@@ -67,6 +73,7 @@ import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
 
 /**
  * Holds URLs with YANG schema resources for all yang modules reported in
@@ -130,7 +137,7 @@ public final class LibraryModulesSchemas implements NetconfDeviceSchemas {
             if (connection instanceof HttpURLConnection) {
                 connection.setRequestProperty("Accept", "application/xml");
                 final String userpass = username + ":" + password;
-                final String basicAuth = "Basic " + printBase64Binary(userpass.getBytes());
+                final String basicAuth = "Basic " + printBase64Binary(userpass.getBytes(StandardCharsets.UTF_8));
 
                 connection.setRequestProperty("Authorization", basicAuth);
             }
@@ -291,7 +298,7 @@ public final class LibraryModulesSchemas implements NetconfDeviceSchemas {
         String extension = "";
         final int i = fileName.lastIndexOf(46);
         if (i != -1) {
-            extension = fileName.substring(i).toLowerCase();
+            extension = fileName.substring(i).toLowerCase(Locale.ROOT);
         }
 
         return extension.equals(".json");
@@ -302,14 +309,13 @@ public final class LibraryModulesSchemas implements NetconfDeviceSchemas {
         final NormalizedNodeStreamWriter writer = ImmutableNormalizedNodeStreamWriter.from(resultHolder);
 
         final JsonParserStream jsonParser = JsonParserStream.create(writer, LIBRARY_CONTEXT);
-        final JsonReader reader = new JsonReader(new InputStreamReader(in));
+        final JsonReader reader = new JsonReader(new InputStreamReader(in, Charset.defaultCharset()));
 
         jsonParser.parse(reader);
 
         return resultHolder.isFinished() ? Optional.of(resultHolder.getResult()) : Optional.empty();
     }
 
-    @SuppressWarnings("checkstyle:IllegalCatch")
     private static Optional<NormalizedNode<?, ?>> readXml(final InputStream in) {
         try {
             final DocumentBuilder docBuilder = UntrustedXML.newDocumentBuilder();
@@ -338,7 +344,8 @@ public final class LibraryModulesSchemas implements NetconfDeviceSchemas {
             xmlParser.traverse(new DOMSource(doc.getDocumentElement()));
             final NormalizedNode<?, ?> parsed = resultHolder.getResult();
             return Optional.of(parsed);
-        } catch (final Exception e) {
+        } catch (XMLStreamException | URISyntaxException | IOException | ParserConfigurationException
+                | SAXException e) {
             LOG.warn("Unable to parse yang library xml content", e);
         }
 
@@ -394,9 +401,8 @@ public final class LibraryModulesSchemas implements NetconfDeviceSchemas {
 
     private static Optional<String> getValueOfSimpleNode(
             final NormalizedNode<? extends YangInstanceIdentifier.PathArgument, ?> node) {
-        final Object value = node.getValue();
-        return value == null || Strings.isNullOrEmpty(value.toString()) ? Optional.empty()
-                : Optional.of(value.toString().trim());
+        final String valueStr = node.getValue().toString();
+        return Strings.isNullOrEmpty(valueStr) ? Optional.empty() : Optional.of(valueStr.trim());
     }
 
     @Override
index 2dc16331726e2857897b372bcd55745e3ad36daa..9efd1dfaba5c24d2336bbf1d58d0c7171ce25954 100644 (file)
@@ -29,6 +29,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 import java.util.stream.Collectors;
+import javax.annotation.Nonnull;
 import javax.annotation.concurrent.GuardedBy;
 import org.opendaylight.controller.md.sal.dom.api.DOMNotification;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcException;
@@ -149,7 +150,7 @@ public class NetconfDevice
 
         final FutureCallback<DeviceSources> resolvedSourceCallback = new FutureCallback<DeviceSources>() {
             @Override
-            public void onSuccess(final DeviceSources result) {
+            public void onSuccess(@Nonnull final DeviceSources result) {
                 addProvidedSourcesToSchemaRegistry(result);
                 setUpSchema(result);
             }
@@ -250,7 +251,7 @@ public class NetconfDevice
         updateTransformer(null);
     }
 
-    private void updateTransformer(final MessageTransformer<NetconfMessage> transformer) {
+    private synchronized void updateTransformer(final MessageTransformer<NetconfMessage> transformer) {
         messageTransformer = transformer;
     }
 
@@ -511,7 +512,7 @@ public class NetconfDevice
 
                     if (cause instanceof MissingSchemaSourceException) {
                         requiredSources = handleMissingSchemaSourceException(
-                                requiredSources, (MissingSchemaSourceException) e.getCause());
+                                requiredSources, (MissingSchemaSourceException) cause);
                         continue;
                     }
                     if (cause instanceof SchemaResolutionException) {
index 6ce2d0f145a79ee4de95997792205a6a91ee7e18..822a43a22aace8b4706faf479fb3152193620b3c 100644 (file)
@@ -256,9 +256,8 @@ public final class NetconfStateSchemas implements NetconfDeviceSchemas {
 
         private static Optional<String> getValueOfSimpleNode(
                 final NormalizedNode<? extends YangInstanceIdentifier.PathArgument, ?> node) {
-            final Object value = node.getValue();
-            return value == null || Strings.isNullOrEmpty(value.toString())
-                    ? Optional.empty() : Optional.of(value.toString().trim());
+            final String valueStr = node.getValue().toString();
+            return Strings.isNullOrEmpty(valueStr) ? Optional.empty() : Optional.of(valueStr.trim());
         }
 
         @Override
index d8eace1fc99c41f0628030281dc593ca72f1ca43..8b67f56db23bdc1bf5bb3cb5d53eec3d8e0f8320 100644 (file)
@@ -275,7 +275,7 @@ public class NetconfDeviceCommunicator
         try {
             request = requests.peek();
             if (request != null && request.future.isUncancellable()) {
-                requests.poll();
+                request = requests.poll();
                 // we have just removed one request from the queue
                 // we can also release one permit
                 if (semaphore != null) {
@@ -343,18 +343,15 @@ public class NetconfDeviceCommunicator
     @Override
     public ListenableFuture<RpcResult<NetconfMessage>> sendRequest(final NetconfMessage message, final QName rpc) {
         sessionLock.lock();
-
-        if (semaphore != null && !semaphore.tryAcquire()) {
-            LOG.warn("Limit of concurrent rpc messages was reached (limit :"
-                    + concurentRpcMsgs + "). Rpc reply message is needed. Discarding request of Netconf device with id"
-                    + id.getName());
-            sessionLock.unlock();
-            return Futures.immediateFailedFuture(new NetconfDocumentedException(
-                    "Limit of rpc messages was reached (Limit :" + concurentRpcMsgs
-                            + ") waiting for emptying the queue of Netconf device with id" + id.getName()));
-        }
-
         try {
+            if (semaphore != null && !semaphore.tryAcquire()) {
+                LOG.warn("Limit of concurrent rpc messages was reached (limit :" + concurentRpcMsgs
+                    + "). Rpc reply message is needed. Discarding request of Netconf device with id" + id.getName());
+                return Futures.immediateFailedFuture(new NetconfDocumentedException(
+                        "Limit of rpc messages was reached (Limit :" + concurentRpcMsgs
+                        + ") waiting for emptying the queue of Netconf device with id" + id.getName()));
+            }
+
             return sendRequestWithLock(message, rpc);
         } finally {
             sessionLock.unlock();
index 8f010e778057e7dbd77eed8b0e23e3ad8abfe8fc..77b7d1c142cc3ef4071e9d34a16ed63703700c57 100644 (file)
@@ -10,17 +10,15 @@ package org.opendaylight.netconf.sal.connect.netconf.listener;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.AbstractFuture;
 import javax.annotation.Nullable;
-import javax.annotation.concurrent.GuardedBy;
 
 final class UncancellableFuture<V> extends AbstractFuture<V> {
-    @GuardedBy("this")
-    private boolean uncancellable = false;
+    private volatile boolean uncancellable = false;
 
     UncancellableFuture(final boolean uncancellable) {
         this.uncancellable = uncancellable;
     }
 
-    public synchronized boolean setUncancellable() {
+    public boolean setUncancellable() {
         if (isCancelled()) {
             return false;
         }
@@ -29,17 +27,17 @@ final class UncancellableFuture<V> extends AbstractFuture<V> {
         return true;
     }
 
-    public synchronized boolean isUncancellable() {
+    public boolean isUncancellable() {
         return uncancellable;
     }
 
     @Override
-    public synchronized boolean cancel(final boolean mayInterruptIfRunning) {
+    public boolean cancel(final boolean mayInterruptIfRunning) {
         return !uncancellable && super.cancel(mayInterruptIfRunning);
     }
 
     @Override
-    public synchronized boolean set(@Nullable final V value) {
+    public boolean set(@Nullable final V value) {
         Preconditions.checkState(uncancellable);
         return super.set(value);
     }
index a92ad42c709044a031e9c65095358a4c16b665fd..590e5e4cdac1944f0d813f5e2cf483243b357340 100644 (file)
@@ -211,11 +211,11 @@ public final class KeepaliveSalFacade implements RemoteDeviceHandler<NetconfSess
             if (result != null && result.getResult() != null) {
                 LOG.debug("{}: Keepalive RPC successful with response: {}", id, result.getResult());
                 scheduleKeepalive();
-            } else if (result != null && result.getErrors() != null) {
+            } else if (result != null && !result.getErrors().isEmpty()) {
                 LOG.warn("{}: Keepalive RPC failed with error: {}", id, result.getErrors());
                 scheduleKeepalive();
             } else {
-                LOG.warn("{} Keepalive RPC returned null with response: {}. Reconnecting netconf session", id, result);
+                LOG.warn("{} Keepalive RPC returned null with response. Reconnecting netconf session", id);
                 reconnect();
             }
         }
@@ -276,7 +276,7 @@ public final class KeepaliveSalFacade implements RemoteDeviceHandler<NetconfSess
     public static final class KeepaliveDOMRpcService implements DOMRpcService {
 
         private final DOMRpcService deviceRpc;
-        private ResetKeepalive resetKeepaliveTask;
+        private final ResetKeepalive resetKeepaliveTask;
         private final long defaultRequestTimeoutMillis;
         private final ScheduledExecutorService executor;
 
index 1b5ae10ec4955b74ecc5660a6ff19deb0cab45ca..897cdaa5c73267039b1438aed9054cb69c37b9d9 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netconf.sal.connect.netconf.sal;
 
-import com.google.common.base.Function;
 import com.google.common.collect.Collections2;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
@@ -68,13 +67,8 @@ public final class NetconfDeviceRpc implements DOMRpcService {
                 }
             }, MoreExecutors.directExecutor());
 
-        return Futures.makeChecked(transformed, new Function<Exception, DOMRpcException>() {
-            @Nullable
-            @Override
-            public DOMRpcException apply(@Nullable final Exception exception) {
-                return new DOMRpcImplementationNotAvailableException(exception, "Unable to invoke rpc %s", type);
-            }
-        });
+        return Futures.makeChecked(transformed, exception ->
+            new DOMRpcImplementationNotAvailableException(exception, "Unable to invoke rpc %s", type));
     }
 
     @Nonnull
index 8fbf058850685e660b9ca639a3355fe0a33ccf30..9e247018e19638d1d169f69a58e648e91b15d9c7 100644 (file)
@@ -248,11 +248,6 @@ public final class NetconfDeviceTopologyAdapter implements AutoCloseable {
         }, MoreExecutors.directExecutor());
     }
 
-    private static Node getNodeWithId(final RemoteDeviceId id) {
-        final NodeBuilder builder = getNodeIdBuilder(id);
-        return builder.build();
-    }
-
     private static NodeBuilder getNodeIdBuilder(final RemoteDeviceId id) {
         final NodeBuilder nodeBuilder = new NodeBuilder();
         nodeBuilder.setKey(new NodeKey(new NodeId(id.getName())));
index 9701c984105cb0cb7a925005d01a2d1122ad5909..79482c564c029206f29fa5928f2aafb6a181ca2c 100644 (file)
@@ -7,7 +7,6 @@
  */
 package org.opendaylight.netconf.sal.connect.netconf.sal;
 
-import com.google.common.base.Function;
 import com.google.common.util.concurrent.CheckedFuture;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -77,16 +76,15 @@ public final class SchemalessNetconfDeviceRpc implements DOMRpcService {
                 listener.sendRequest(netconfMessage, type.getLastComponent());
 
         final ListenableFuture<DOMRpcResult> transformed =
-            Futures.transform(rpcResultListenableFuture, (Function<RpcResult<NetconfMessage>, DOMRpcResult>) input1 -> {
+            Futures.transform(rpcResultListenableFuture, input1 -> {
                 if (input1.isSuccessful()) {
                     return transformer.toRpcResult(input1.getResult(), type);
-                } else {
-                    return new DefaultDOMRpcResult(input1.getErrors());
                 }
+
+                return new DefaultDOMRpcResult(input1.getErrors());
             }, MoreExecutors.directExecutor());
 
-        return Futures.makeChecked(transformed,
-            e -> new DOMRpcImplementationNotAvailableException(e,
+        return Futures.makeChecked(transformed, e -> new DOMRpcImplementationNotAvailableException(e,
                 "Unable to invoke rpc %s on device %s", type, deviceId));
     }
 
@@ -99,5 +97,4 @@ public final class SchemalessNetconfDeviceRpc implements DOMRpcService {
     public <T extends DOMRpcAvailabilityListener> ListenerRegistration<T> registerRpcListener(@Nonnull final T lsnr) {
         throw new UnsupportedOperationException("Not available for netconf 1.0");
     }
-
 }
index 8c5929752c97bf0ea056a41aea4165c3600808ac..c4e01f37b0670a8fdd03965831282801050897e1 100644 (file)
@@ -18,9 +18,8 @@ import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.SettableFuture;
 import java.util.List;
 import java.util.concurrent.CopyOnWriteArrayList;
-import javax.annotation.Nullable;
+import javax.annotation.Nonnull;
 import org.opendaylight.controller.config.util.xml.DocumentedException;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
@@ -49,7 +48,7 @@ public abstract class AbstractWriteTx implements DOMDataWriteTransaction {
     protected final List<ListenableFuture<DOMRpcResult>> resultsFutures;
     private final List<TxListener> listeners = new CopyOnWriteArrayList<>();
     // Allow commit to be called only once
-    protected boolean finished = false;
+    protected volatile boolean finished = false;
 
     public AbstractWriteTx(final NetconfBaseOps netOps, final RemoteDeviceId id, final boolean rollbackSupport) {
         this.netOps = netOps;
@@ -147,21 +146,20 @@ public abstract class AbstractWriteTx implements DOMDataWriteTransaction {
                 editStructure, Optional.of(ModifyAction.NONE), "delete");
     }
 
-    @Override
-    public final ListenableFuture<RpcResult<TransactionStatus>> commit() {
+    protected final ListenableFuture<RpcResult<Void>> commitConfiguration() {
         listeners.forEach(listener -> listener.onTransactionSubmitted(this));
         checkNotFinished();
         finished = true;
-        final ListenableFuture<RpcResult<TransactionStatus>> result = performCommit();
-        Futures.addCallback(result, new FutureCallback<RpcResult<TransactionStatus>>() {
+        final ListenableFuture<RpcResult<Void>> result = performCommit();
+        Futures.addCallback(result, new FutureCallback<RpcResult<Void>>() {
             @Override
-            public void onSuccess(@Nullable final RpcResult<TransactionStatus> result) {
-                if (result != null && result.isSuccessful()) {
+            public void onSuccess(@Nonnull final RpcResult<Void> rpcResult) {
+                if (rpcResult.isSuccessful()) {
                     listeners.forEach(txListener -> txListener.onTransactionSuccessful(AbstractWriteTx.this));
                 } else {
                     final TransactionCommitFailedException cause =
                             new TransactionCommitFailedException("Transaction failed",
-                                    result.getErrors().toArray(new RpcError[result.getErrors().size()]));
+                                    rpcResult.getErrors().toArray(new RpcError[rpcResult.getErrors().size()]));
                     listeners.forEach(listener -> listener.onTransactionFailed(AbstractWriteTx.this, cause));
                 }
             }
@@ -174,7 +172,7 @@ public abstract class AbstractWriteTx implements DOMDataWriteTransaction {
         return result;
     }
 
-    protected abstract ListenableFuture<RpcResult<TransactionStatus>> performCommit();
+    protected abstract ListenableFuture<RpcResult<Void>> performCommit();
 
     private void checkEditable(final LogicalDatastoreType store) {
         checkNotFinished();
@@ -186,12 +184,12 @@ public abstract class AbstractWriteTx implements DOMDataWriteTransaction {
                                        DataContainerChild<?, ?> editStructure,
                                        Optional<ModifyAction> defaultOperation, String operation);
 
-    protected ListenableFuture<RpcResult<TransactionStatus>> resultsToTxStatus() {
-        final SettableFuture<RpcResult<TransactionStatus>> transformed = SettableFuture.create();
+    protected ListenableFuture<RpcResult<Void>> resultsToTxStatus() {
+        final SettableFuture<RpcResult<Void>> transformed = SettableFuture.create();
 
         Futures.addCallback(Futures.allAsList(resultsFutures), new FutureCallback<List<DOMRpcResult>>() {
             @Override
-            public void onSuccess(final List<DOMRpcResult> domRpcResults) {
+            public void onSuccess(@Nonnull final List<DOMRpcResult> domRpcResults) {
                 domRpcResults.forEach(domRpcResult -> {
                     if (!domRpcResult.getErrors().isEmpty() && !transformed.isDone()) {
                         final NetconfDocumentedException exception =
@@ -204,7 +202,7 @@ public abstract class AbstractWriteTx implements DOMDataWriteTransaction {
                 });
 
                 if (!transformed.isDone()) {
-                    transformed.set(RpcResultBuilder.success(TransactionStatus.COMMITED).build());
+                    transformed.set(RpcResultBuilder.<Void>success().build());
                 }
             }
 
index c6012bbf2183a5c71e82df7e36bb7eeb66248a28..1c44b40f841712bce44169e702ab7cdc5330a656 100644 (file)
@@ -10,15 +10,12 @@ package org.opendaylight.netconf.sal.connect.netconf.sal.tx;
 
 import com.google.common.base.Optional;
 import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataReadWriteTransaction;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 
@@ -59,11 +56,6 @@ public class ReadWriteTx implements DOMDataReadWriteTransaction {
         return delegateWriteTx.submit();
     }
 
-    @Override
-    public ListenableFuture<RpcResult<TransactionStatus>> commit() {
-        return delegateWriteTx.commit();
-    }
-
     @Override
     public CheckedFuture<Optional<NormalizedNode<?, ?>>, ReadFailedException> read(
             final LogicalDatastoreType store, final YangInstanceIdentifier path) {
index d3f5b1e94de1f7a4e3a3f08fbf0da830050b101d..ac24ac8f35acd592e2a855ba671a14b4bc25cda1 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.netconf.sal.connect.netconf.sal.tx;
 
-import com.google.common.base.Function;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
@@ -16,8 +15,8 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps;
@@ -69,7 +68,7 @@ public class WriteCandidateTx extends AbstractWriteTx {
     private void lock() {
         final FutureCallback<DOMRpcResult> lockCandidateCallback = new FutureCallback<DOMRpcResult>() {
             @Override
-            public void onSuccess(final DOMRpcResult result) {
+            public void onSuccess(@Nonnull final DOMRpcResult result) {
                 if (isSuccess(result)) {
                     if (LOG.isTraceEnabled()) {
                         LOG.trace("Lock candidate successful");
@@ -96,12 +95,11 @@ public class WriteCandidateTx extends AbstractWriteTx {
 
     @Override
     public synchronized CheckedFuture<Void, TransactionCommitFailedException> submit() {
-        final ListenableFuture<Void> commitFutureAsVoid = Futures.transform(commit(),
-            (Function<RpcResult<TransactionStatus>, Void>) input -> {
-                Preconditions.checkArgument(input.isSuccessful() && input.getErrors().isEmpty(),
-                        "Submit failed with errors: %s", input.getErrors());
-                return null;
-            }, MoreExecutors.directExecutor());
+        final ListenableFuture<Void> commitFutureAsVoid = Futures.transform(commitConfiguration(), input -> {
+            Preconditions.checkArgument(input.isSuccessful() && input.getErrors().isEmpty(),
+                "Submit failed with errors: %s", input.getErrors());
+            return null;
+        }, MoreExecutors.directExecutor());
 
         return Futures.makeChecked(commitFutureAsVoid, input -> new TransactionCommitFailedException(
                 "Submit of transaction " + getIdentifier() + " failed", input));
@@ -116,13 +114,13 @@ public class WriteCandidateTx extends AbstractWriteTx {
     }
 
     @Override
-    public synchronized ListenableFuture<RpcResult<TransactionStatus>> performCommit() {
+    public synchronized ListenableFuture<RpcResult<Void>> performCommit() {
         resultsFutures.add(netOps.commit(new NetconfRpcFutureCallback("Commit", id)));
-        final ListenableFuture<RpcResult<TransactionStatus>> txResult = resultsToTxStatus();
+        final ListenableFuture<RpcResult<Void>> txResult = resultsToTxStatus();
 
-        Futures.addCallback(txResult, new FutureCallback<RpcResult<TransactionStatus>>() {
+        Futures.addCallback(txResult, new FutureCallback<RpcResult<Void>>() {
             @Override
-            public void onSuccess(@Nullable final RpcResult<TransactionStatus> result) {
+            public void onSuccess(@Nullable final RpcResult<Void> result) {
                 cleanupOnSuccess();
             }
 
index ddc66fb5f1757080cc1ed4e5feb24b27ad1f76fe..6b1999f74e9192ef9fea27fb609c193021e795f3 100644 (file)
@@ -16,7 +16,6 @@ import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
 import java.util.ArrayList;
 import java.util.List;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.netconf.sal.connect.netconf.util.NetconfBaseOps;
@@ -73,8 +72,8 @@ public class WriteRunningTx extends AbstractWriteTx {
 
     @Override
     public synchronized CheckedFuture<Void, TransactionCommitFailedException> submit() {
-        final ListenableFuture<Void> commmitFutureAsVoid = Futures.transform(commit(),
-                (Function<RpcResult<TransactionStatus>, Void>) input -> null, MoreExecutors.directExecutor());
+        final ListenableFuture<Void> commmitFutureAsVoid = Futures.transform(commitConfiguration(),
+                (Function<RpcResult<Void>, Void>) input -> null, MoreExecutors.directExecutor());
 
         return Futures.makeChecked(commmitFutureAsVoid,
             input -> new TransactionCommitFailedException("Submit of transaction " + getIdentifier() + " failed",
@@ -82,7 +81,7 @@ public class WriteRunningTx extends AbstractWriteTx {
     }
 
     @Override
-    public synchronized ListenableFuture<RpcResult<TransactionStatus>> performCommit() {
+    public synchronized ListenableFuture<RpcResult<Void>> performCommit() {
         for (final Change change : changes) {
             resultsFutures.add(change.execute(id, netOps, rollbackSupport));
         }
index 068fc10a5150d0b8065cdc9bf9bcedc89af544a3..0ba6cead958387ab434fd5bd40cbfc03b2cd1411 100644 (file)
@@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
+import javax.annotation.Nonnull;
 import javax.xml.transform.dom.DOMSource;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
@@ -144,7 +145,7 @@ public final class NetconfRemoteSchemaYangSourceProvider implements SchemaSource
         }
 
         @Override
-        public YangTextSchemaSource apply(final DOMRpcResult input) {
+        public YangTextSchemaSource apply(@Nonnull final DOMRpcResult input) {
 
             if (input.getErrors().isEmpty()) {
 
index d7d4948e4c4efa22b62aeb6ffd54be6588f89f57..4fa5127c6e32f328e08f0d282824443b5986240e 100644 (file)
@@ -15,6 +15,7 @@ import com.google.common.util.concurrent.ListenableFuture;
 import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
+import java.nio.charset.Charset;
 import java.util.Map;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
 import org.opendaylight.yangtools.yang.model.repo.api.SchemaSourceException;
@@ -51,7 +52,7 @@ public final class YangLibrarySchemaYangSourceProvider implements SchemaSourcePr
     private ListenableFuture<? extends YangTextSchemaSource> download(final SourceIdentifier sourceIdentifier) {
         final URL url = availableSources.get(sourceIdentifier);
         try (InputStream in = url.openStream()) {
-            final String schemaContent = new String(ByteStreams.toByteArray(in));
+            final String schemaContent = new String(ByteStreams.toByteArray(in), Charset.defaultCharset());
             final NetconfRemoteSchemaYangSourceProvider.NetconfYangTextSchemaSource yangSource =
                     new NetconfRemoteSchemaYangSourceProvider
                             .NetconfYangTextSchemaSource(id, sourceIdentifier, Optional.of(schemaContent));
index 8428a48df63a45d6fb73751b74dffe6f333fa960..e146131d9b0fbd87e4426234e26c6eb942c40149 100644 (file)
@@ -16,11 +16,13 @@ import com.google.common.collect.Maps;
 import com.google.common.collect.Multimap;
 import com.google.common.collect.Multimaps;
 import java.io.IOException;
+import java.net.URISyntaxException;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Date;
 import java.util.Map;
 import javax.annotation.Nonnull;
+import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.transform.dom.DOMResult;
 import javax.xml.transform.dom.DOMSource;
@@ -54,6 +56,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
 
 public class NetconfMessageTransformer implements MessageTransformer<NetconfMessage> {
 
@@ -82,7 +85,6 @@ public class NetconfMessageTransformer implements MessageTransformer<NetconfMess
         this.strictParsing = strictParsing;
     }
 
-    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public synchronized DOMNotification toNotification(final NetconfMessage message) {
         final Map.Entry<Date, XmlElement> stripped = NetconfMessageTransformUtil.stripNotification(message);
@@ -113,7 +115,8 @@ public class NetconfMessageTransformer implements MessageTransformer<NetconfMess
                     notificationAsContainerSchemaNode, strictParsing);
             xmlParser.traverse(new DOMSource(element));
             content = (ContainerNode) resultHolder.getResult();
-        } catch (final Exception e) {
+        } catch (XMLStreamException | URISyntaxException | IOException | ParserConfigurationException
+                | SAXException | UnsupportedOperationException e) {
             throw new IllegalArgumentException(String.format("Failed to parse notification %s", element), e);
         }
         return new NetconfDeviceNotification(content, stripped.getKey());
@@ -175,7 +178,6 @@ public class NetconfMessageTransformer implements MessageTransformer<NetconfMess
                 || rpc.getNamespace().equals(NetconfMessageTransformUtil.CREATE_SUBSCRIPTION_RPC_QNAME.getNamespace());
     }
 
-    @SuppressWarnings("checkstyle:IllegalCatch")
     @Override
     public synchronized DOMRpcResult toRpcResult(final NetconfMessage message, final SchemaPath rpc) {
         final NormalizedNode<?, ?> normalizedNode;
@@ -193,7 +195,8 @@ public class NetconfMessageTransformer implements MessageTransformer<NetconfMess
                         strictParsing);
                 xmlParser.traverse(new DOMSource(xmlData));
                 dataNode = (ContainerNode) resultHolder.getResult();
-            } catch (final Exception e) {
+            } catch (XMLStreamException | URISyntaxException | IOException | ParserConfigurationException
+                    | SAXException e) {
                 throw new IllegalArgumentException(String.format("Failed to parse data response %s", xmlData), e);
             }
 
@@ -232,7 +235,8 @@ public class NetconfMessageTransformer implements MessageTransformer<NetconfMess
                             rpcDefinition.getOutput(), strictParsing);
                     xmlParser.traverse(new DOMSource(element));
                     normalizedNode = resultHolder.getResult();
-                } catch (final Exception e) {
+                } catch (XMLStreamException | URISyntaxException | IOException | ParserConfigurationException
+                        | SAXException e) {
                     throw new IllegalArgumentException(String.format("Failed to parse RPC response %s", element), e);
                 }
             }
index 71a60bb18efbe22dfe9269361a105440d19ae626..2c055b9cf18a4349b0b82862d25a4ffe97792b89 100644 (file)
@@ -33,6 +33,7 @@ import com.google.common.util.concurrent.FutureCallback;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.MoreExecutors;
+import java.util.Locale;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
 import org.opendaylight.netconf.sal.connect.netconf.sal.KeepaliveSalFacade.KeepaliveDOMRpcService;
@@ -304,7 +305,7 @@ public final class NetconfBaseOps {
 
         // Default operation
         if (defaultOperation.isPresent()) {
-            final String opString = defaultOperation.get().name().toLowerCase();
+            final String opString = defaultOperation.get().name().toLowerCase(Locale.ROOT);
             editBuilder.withChild(Builders.leafBuilder().withNodeIdentifier(toId(NETCONF_DEFAULT_OPERATION_QNAME))
                     .withValue(opString).build());
         }
index e5eaab1d7d92944350067eb6eef3026d489426bc..7e45856e5b7e9d0d0a1b3e8132c98149493bbc1d 100644 (file)
@@ -9,6 +9,7 @@
 package org.opendaylight.netconf.sal.connect.netconf.util;
 
 import com.google.common.util.concurrent.FutureCallback;
+import javax.annotation.Nonnull;
 import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
 import org.opendaylight.netconf.sal.connect.util.RemoteDeviceId;
 import org.slf4j.Logger;
@@ -29,7 +30,7 @@ public class NetconfRpcFutureCallback implements FutureCallback<DOMRpcResult> {
     }
 
     @Override
-    public void onSuccess(final DOMRpcResult result) {
+    public void onSuccess(@Nonnull final DOMRpcResult result) {
         if (result.getErrors().isEmpty()) {
             LOG.trace("{}: {} invoked successfully", id, type);
         } else {
index 28c69e72ab0857d8ef653ec7770c1ca15cb5a83d..98d3d30f91066802cc1ce715caa716ae7da412d3 100644 (file)
@@ -13,7 +13,9 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import java.util.Collections;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
+import java.util.Map.Entry;
 import javax.xml.transform.dom.DOMSource;
 import org.opendaylight.controller.config.util.xml.DocumentedException;
 import org.opendaylight.controller.config.util.xml.XmlElement;
@@ -156,7 +158,8 @@ class SchemalessRpcStructureTransformer implements RpcStructureTransformer {
         final YangInstanceIdentifier.NodeIdentifierWithPredicates keyedId =
                 (YangInstanceIdentifier.NodeIdentifierWithPredicates) lastPathArgument;
         final Map<QName, Object> keyValues = keyedId.getKeyValues();
-        for (QName qualifiedName : keyValues.keySet()) {
+        for (Entry<QName, Object> entry : keyValues.entrySet()) {
+            QName qualifiedName = entry.getKey();
             final List<XmlElement> key =
                     dataElement.getChildElementsWithinNamespace(qualifiedName.getLocalName(),
                             qualifiedName.getNamespace().toString());
@@ -172,7 +175,7 @@ class SchemalessRpcStructureTransformer implements RpcStructureTransformer {
             } catch (DocumentedException e) {
                 throw new IllegalStateException("Key value not present in key element", e);
             }
-            if (!keyValues.get(qualifiedName).equals(textContent)) {
+            if (!entry.getValue().equals(textContent)) {
                 throw new IllegalStateException("Key value in path not equal to key value in xml");
             }
         }
@@ -225,7 +228,7 @@ class SchemalessRpcStructureTransformer implements RpcStructureTransformer {
     }
 
     private static String toOperationString(final ModifyAction operation) {
-        return operation.name().toLowerCase();
+        return operation.name().toLowerCase(Locale.ROOT);
     }
 
     private static Element getSourceElement(final DOMSource source) {
index 795af83945ca2b8b7f86f56a9cf32dc647355831..0fe89343e264625ebf8193459eea1fffc358ea61 100644 (file)
@@ -55,12 +55,6 @@ public class ReadWriteTxTest {
         verify(delegateWriteTx).submit();
     }
 
-    @Test
-    public void commit() throws Exception {
-        tx.commit();
-        verify(delegateWriteTx).commit();
-    }
-
     @Test
     public void cancel() throws Exception {
         tx.cancel();
@@ -89,4 +83,4 @@ public class ReadWriteTxTest {
         Assert.assertNotEquals(tx.getIdentifier(), tx2.getIdentifier());
     }
 
-}
\ No newline at end of file
+}
index 92abd68786dcde3a9043b6ac91009cbfc9d3175e..4d6a46a6441a114ac95dbcd8725d5cc92746045e 100644 (file)
     <modelVersion>4.0.0</modelVersion>
 
     <parent>
-        <groupId>org.opendaylight.odlparent</groupId>
-        <artifactId>odlparent</artifactId>
-        <version>3.0.2</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
 
     <dependencyManagement>
         <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.yangtools</groupId>
-                <artifactId>yangtools-artifacts</artifactId>
-                <version>2.0.2</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
             <dependency>
                 <groupId>org.opendaylight.controller</groupId>
                 <artifactId>config-artifacts</artifactId>
                 <type>pom</type>
                 <scope>import</scope>
             </dependency>
-            <dependency>
-                <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.mdsal.model</groupId>
-                <artifactId>mdsal-model-artifacts</artifactId>
-                <version>0.13.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
         </dependencies>
     </dependencyManagement>
 
                       </execution>
                   </executions>
               </plugin>
-              <plugin>
-                  <groupId>org.apache.maven.plugins</groupId>
-                  <artifactId>maven-checkstyle-plugin</artifactId>
-                  <configuration>
-                      <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                  </configuration>
-              </plugin>
           </plugins>
       </build>
 
index 5ece664e179a54113b7824b3bd38327fd491f8e0..e5b30838be6690db8b3776eb6347cd382ba9f6b7 100644 (file)
@@ -16,6 +16,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import java.util.Collections;
 import java.util.Set;
+import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import org.opendaylight.controller.config.util.capability.Capability;
 import org.opendaylight.netconf.api.monitoring.NetconfManagementSession;
@@ -39,18 +40,13 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.mon
 public class DummyMonitoringService implements NetconfMonitoringService {
 
     private static final Sessions EMPTY_SESSIONS = new SessionsBuilder().setSession(Collections.emptyList()).build();
-    private static final Function<Capability, Uri> CAPABILITY_URI_FUNCTION = new Function<Capability, Uri>() {
-        @Nullable
-        @Override
-        public Uri apply(Capability capability) {
-            return new Uri(capability.getCapabilityUri());
-        }
-    };
+    private static final Function<Capability, Uri> CAPABILITY_URI_FUNCTION =
+        capability -> new Uri(capability.getCapabilityUri());
 
     private static final Function<Capability, Schema> CAPABILITY_SCHEMA_FUNCTION = new Function<Capability, Schema>() {
         @Nullable
         @Override
-        public Schema apply(@Nullable Capability capability) {
+        public Schema apply(@Nonnull Capability capability) {
             return new SchemaBuilder()
                     .setIdentifier(capability.getModuleName().get())
                     .setNamespace(new Uri(capability.getModuleNamespace().get()))
index e55f2de636d679b406ca87de432eb8d7301a8c7c..d4e6683278d10178e5613fe1a81edc273a6c0b1e 100644 (file)
@@ -13,7 +13,6 @@ import com.ning.http.client.AsyncCompletionHandler;
 import com.ning.http.client.AsyncHttpClient;
 import com.ning.http.client.AsyncHttpClientConfig;
 import com.ning.http.client.HttpResponseStatus;
-import com.ning.http.client.ListenableFuture;
 import com.ning.http.client.Realm;
 import com.ning.http.client.Request;
 import com.ning.http.client.Response;
@@ -112,7 +111,6 @@ public class Execution implements Callable<Void> {
     }
 
     private void invokeAsync() {
-        final ArrayList<ListenableFuture<Response>> futures = new ArrayList<>();
         LOG.info("Begin sending async requests");
 
         for (final Request request : payloads) {
@@ -121,7 +119,7 @@ public class Execution implements Callable<Void> {
             } catch (InterruptedException e) {
                 LOG.warn("Semaphore acquire interrupted");
             }
-            futures.add(asyncHttpClient.executeRequest(request, new AsyncCompletionHandler<Response>() {
+            asyncHttpClient.executeRequest(request, new AsyncCompletionHandler<Response>() {
                 @Override
                 public STATE onStatusReceived(HttpResponseStatus status) throws Exception {
                     super.onStatusReceived(status);
@@ -143,7 +141,7 @@ public class Execution implements Callable<Void> {
                     semaphore.release();
                     return response;
                 }
-            }));
+            });
         }
         LOG.info("Requests sent, waiting for responses");
 
index 6ec885d44cb687029c7ac6f8d5fa7d538318b09d..cff30f51bb48348592f004d57315cf1bccf0d743 100644 (file)
@@ -17,6 +17,7 @@ import com.google.common.collect.Lists;
 import com.google.common.io.ByteStreams;
 import com.google.common.io.CharStreams;
 import com.google.common.io.Files;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -42,6 +43,7 @@ import org.opendaylight.netconf.test.tool.config.ConfigurationBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@SuppressFBWarnings("DM_DEFAULT_ENCODING")
 public final class Main {
     private static final Logger LOG = LoggerFactory.getLogger(Main.class);
 
@@ -50,6 +52,7 @@ public final class Main {
     }
 
     @SuppressWarnings("checkstyle:IllegalCatch")
+    @SuppressFBWarnings({"UW_UNCOND_WAIT", "WA_NOT_IN_LOOP"})
     public static void main(final String[] args) {
         final TesttoolParameters params = TesttoolParameters.parseArgs(args, TesttoolParameters.getParser());
         params.validate();
@@ -84,7 +87,7 @@ public final class Main {
                     } else {
                         try {
                             future.get();
-                        } catch (final ExecutionException e) {
+                        } catch (final ExecutionException | InterruptedException e) {
                             LOG.info("{}. thread failed.", threadNum, e);
                         }
                     }
@@ -102,7 +105,7 @@ public final class Main {
                 configGenerator.updateFeatureFile(generated);
                 configGenerator.changeLoadOrder();
             }
-        } catch (final Exception e) {
+        } catch (RuntimeException | InterruptedException e) {
             LOG.error("Unhandled exception", e);
             netconfDeviceSimulator.close();
             System.exit(1);
@@ -150,9 +153,12 @@ public final class Main {
                 Preconditions.checkState(configDir.mkdirs(), "Unable to create directory " + configDir);
             }
 
-            for (final File file : configDir.listFiles(pathname ->
-                    !pathname.isDirectory() && pathname.getName().startsWith(SIM_DEVICE_CFG_PREFIX))) {
-                Preconditions.checkState(file.delete(), "Unable to clean previous generated file %s", file);
+            final File[] files = configDir.listFiles(pathname ->
+                    !pathname.isDirectory() && pathname.getName().startsWith(SIM_DEVICE_CFG_PREFIX));
+            if (files != null) {
+                for (final File file : files) {
+                    Preconditions.checkState(file.delete(), "Unable to clean previous generated file %s", file);
+                }
             }
 
             try (InputStream stream = Main.class.getResourceAsStream(NETCONF_CONNECTOR_XML)) {
@@ -183,7 +189,7 @@ public final class Main {
                         String configContent = String.format(
                             middleBlueprint, name, address, String.valueOf(openDevice), String.valueOf(!useSsh));
                         configContent = String.format(
-                            "%s%s%d%s\n%s\n", configContent, "<connection-timeout-millis>",
+                            "%s%s%d%s%n%s%n", configContent, "<connection-timeout-millis>",
                             generateConfigsTimeout, "</connection-timeout-millis>", "</module>");
 
                         builder.append(configContent);
index 42b162b2def8895f543eecc6422ab05cbe1e4e57..5472825edb5d73c1bf7d021a54c765e11c2a229b 100644 (file)
@@ -15,6 +15,7 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.channel.Channel;
 import io.netty.channel.ChannelFuture;
 import io.netty.channel.local.LocalAddress;
@@ -75,6 +76,7 @@ import org.opendaylight.yangtools.yang.parser.rfc7950.repo.TextToASTTransformer;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@SuppressFBWarnings("DM_DEFAULT_ENCODING")
 public class NetconfDeviceSimulator implements Closeable {
 
     private static final Logger LOG = LoggerFactory.getLogger(NetconfDeviceSimulator.class);
index 78f5b85434d7833034076069df8599f5e5e95d35..c8929e5132741974efe851d5eeacf2edd7565825 100644 (file)
@@ -15,6 +15,7 @@ import com.ning.http.client.AsyncHttpClient;
 import com.ning.http.client.AsyncHttpClientConfig.Builder;
 import com.ning.http.client.Request;
 import com.ning.http.client.Response;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
@@ -30,13 +31,12 @@ import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import net.sourceforge.argparse4j.inf.ArgumentParser;
-import net.sourceforge.argparse4j.inf.ArgumentParserException;
 import org.opendaylight.netconf.test.tool.config.Configuration;
 import org.opendaylight.netconf.test.tool.config.ConfigurationBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@SuppressFBWarnings({"DM_EXIT", "DM_DEFAULT_ENCODING"})
 public final class ScaleUtil {
     private static final ScheduledExecutorService EXECUTOR = new LoggingWrapperExecutor(4);
     private static final Semaphore SEMAPHORE = new Semaphore(0);
@@ -73,16 +73,20 @@ public final class ScaleUtil {
                     root.error("Failed to start any simulated devices, exiting...");
                     System.exit(1);
                 }
-                if (params.distroFolder != null) {
-                    final Main.ConfigGenerator configGenerator = new Main.ConfigGenerator(
-                        params.distroFolder, openDevices);
-                    final List<File> generated = configGenerator.generate(
-                            params.ssh, params.generateConfigBatchSize,
-                            params.generateConfigsTimeout, params.generateConfigsAddress,
-                            params.devicesPerPort);
-                    configGenerator.updateFeatureFile(generated);
-                    configGenerator.changeLoadOrder();
+
+                if (params.distroFolder == null) {
+                    root.error("Distro folder is not set, exiting...");
+                    System.exit(1);
                 }
+
+                final Main.ConfigGenerator configGenerator = new Main.ConfigGenerator(
+                        params.distroFolder, openDevices);
+                final List<File> generated = configGenerator.generate(
+                        params.ssh, params.generateConfigBatchSize,
+                        params.generateConfigsTimeout, params.generateConfigsAddress,
+                        params.devicesPerPort);
+                configGenerator.updateFeatureFile(generated);
+                configGenerator.changeLoadOrder();
             } catch (final Exception e) {
                 root.error("Unhandled exception", e);
                 netconfDeviceSimulator.close();
@@ -181,24 +185,15 @@ public final class ScaleUtil {
                 if (f.isDirectory()) {
                     deleteFolder(f);
                 } else {
-                    f.delete();
+                    if (!f.delete()) {
+                        root.warn("Failed to delete {}", f);
+                    }
                 }
             }
         }
-        folder.delete();
-    }
-
-    private static TesttoolParameters parseArgs(final String[] args, final ArgumentParser parser) {
-        final TesttoolParameters parameters = new TesttoolParameters();
-        try {
-            parser.parseArgs(args, parameters);
-            return parameters;
-        } catch (ArgumentParserException e) {
-            parser.handleError(e);
+        if (!folder.delete()) {
+            root.warn("Failed to delete {}", folder);
         }
-
-        System.exit(1);
-        return null;
     }
 
     private static class ScaleVerifyCallable implements Callable {
@@ -287,8 +282,8 @@ public final class ScaleUtil {
             return new LogOnExceptionCallable(callable);
         }
 
-        private class LogOnExceptionCallable implements Callable {
-            private Callable theCallable;
+        private static class LogOnExceptionCallable implements Callable {
+            private final Callable theCallable;
 
             LogOnExceptionCallable(Callable theCallable) {
                 this.theCallable = theCallable;
index dde89e478c94064545a7480840103b3a8ff2a8a9..6310eab644e398e7c4e8f85736c3599e561e177f 100644 (file)
@@ -13,6 +13,7 @@ import static com.google.common.base.Preconditions.checkArgument;
 import com.google.common.base.Preconditions;
 import com.google.common.io.CharStreams;
 import com.google.common.io.Files;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
@@ -23,6 +24,7 @@ import java.lang.reflect.Field;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 import java.util.StringJoiner;
@@ -34,6 +36,7 @@ import net.sourceforge.argparse4j.annotation.Arg;
 import net.sourceforge.argparse4j.inf.ArgumentParser;
 import net.sourceforge.argparse4j.inf.ArgumentParserException;
 
+@SuppressFBWarnings({"DM_EXIT", "DM_DEFAULT_ENCODING"})
 public class TesttoolParameters {
 
     private static final String HOST_KEY = "{HOST}";
@@ -303,13 +306,12 @@ public class TesttoolParameters {
             checkArgument(schemasDir.isDirectory(), "Schemas dir has to be a directory");
             checkArgument(schemasDir.canRead(), "Schemas dir has to be readable");
 
-            final List<File> files = Arrays.asList(schemasDir.listFiles());
+            final File[] filesArray = schemasDir.listFiles();
+            final List<File> files = filesArray != null ? Arrays.asList(filesArray) : Collections.emptyList();
             for (final File file : files) {
                 final Matcher matcher = YANG_FILENAME_PATTERN.matcher(file.getName());
                 if (!matcher.matches()) {
-                    final BufferedReader reader;
-                    try {
-                        reader = new BufferedReader(new FileReader(file));
+                    try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
                         String line = reader.readLine();
                         while (!DATE_PATTERN.matcher(line).find()) {
                             line = reader.readLine();
@@ -324,7 +326,9 @@ public class TesttoolParameters {
                             final String revision = m.group(1);
                             final String correctName = moduleName + "@" + revision + ".yang";
                             final File correctNameFile = new File(correctName);
-                            file.renameTo(correctNameFile);
+                            if (!file.renameTo(correctNameFile)) {
+                                System.err.println("Failed to rename " + file);
+                            }
                         }
                     } catch (final IOException e) {
                         // print error to console (test tool is running from console)
@@ -361,8 +365,8 @@ public class TesttoolParameters {
 
             final int batchedRequests = openDevices.size() / generateConfigBatchSize;
             final int batchedRequestsPerThread = batchedRequests / threadAmount;
-            final int leftoverBatchedRequests = (batchedRequests) % threadAmount;
-            final int leftoverRequests = openDevices.size() - (batchedRequests * generateConfigBatchSize);
+            final int leftoverBatchedRequests = batchedRequests % threadAmount;
+            final int leftoverRequests = openDevices.size() - batchedRequests * generateConfigBatchSize;
 
             final StringBuilder destBuilder = new StringBuilder(DEST);
             destBuilder.replace(destBuilder.indexOf(ADDRESS_PORT),
@@ -370,16 +374,16 @@ public class TesttoolParameters {
                 controllerDestination);
 
             for (int l = 0; l < threadAmount; l++) {
-                from = l * (batchedRequests * batchedRequestsPerThread);
-                to = from + (batchedRequests * batchedRequestsPerThread);
+                from = l * batchedRequests * batchedRequestsPerThread;
+                to = from + batchedRequests * batchedRequestsPerThread;
                 iterator = openDevices.subList(from, to).iterator();
                 allThreadsPayloads.add(createBatchedPayloads(batchedRequestsPerThread, iterator, editContentString,
                     destBuilder.toString()));
             }
             ArrayList<Execution.DestToPayload> payloads = null;
             if (leftoverBatchedRequests > 0) {
-                from = threadAmount * (batchedRequests * batchedRequestsPerThread);
-                to = from + (batchedRequests * batchedRequestsPerThread);
+                from = threadAmount * batchedRequests * batchedRequestsPerThread;
+                to = from + batchedRequests * batchedRequestsPerThread;
                 iterator = openDevices.subList(from, to).iterator();
                 payloads = createBatchedPayloads(leftoverBatchedRequests, iterator, editContentString,
                     destBuilder.toString());
@@ -413,7 +417,7 @@ public class TesttoolParameters {
             }
 
             if (leftoverRequests > 0) {
-                from = (threadAmount) * requestPerThreads;
+                from = threadAmount * requestPerThreads;
                 to = from + leftoverRequests;
                 iterator = openDevices.subList(from, to).iterator();
                 allThreadsPayloads.add(createPayloads(iterator, editContentString));
@@ -464,13 +468,13 @@ public class TesttoolParameters {
         final ArrayList<Execution.DestToPayload> payloads = new ArrayList<>();
 
         for (int i = 0; i < batchedRequestsCount; i++) {
-            String payload = "";
+            StringBuilder payload = new StringBuilder();
             for (int j = 0; j < generateConfigBatchSize; j++) {
                 final StringBuilder payloadBuilder = new StringBuilder(
                     prepareMessage(openDevices.next(), editContentString));
-                payload += modifyMessage(payloadBuilder, j, generateConfigBatchSize);
+                payload.append(modifyMessage(payloadBuilder, j, generateConfigBatchSize));
             }
-            payloads.add(new Execution.DestToPayload(destination, payload));
+            payloads.add(new Execution.DestToPayload(destination, payload.toString()));
         }
         return payloads;
     }
index 180dad7d120fd42bbc8bc8777f1305a4530ae467..98d38dd475e46d4cafe5f426e301c94d73fe9b82 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.netconf.test.tool.client.http.perf;
 import com.ning.http.client.AsyncCompletionHandler;
 import com.ning.http.client.AsyncHttpClient;
 import com.ning.http.client.HttpResponseStatus;
-import com.ning.http.client.ListenableFuture;
 import com.ning.http.client.Request;
 import com.ning.http.client.Response;
 import java.util.ArrayList;
@@ -39,7 +38,6 @@ public class AsyncExecutionStrategy implements ExecutionStrategy {
 
     @Override
     public void invoke() {
-        final ArrayList<ListenableFuture<Response>> futures = new ArrayList<>();
         LOG.info("Begin sending async requests");
 
         for (final Request request : payloads) {
@@ -48,7 +46,7 @@ public class AsyncExecutionStrategy implements ExecutionStrategy {
             } catch (InterruptedException e) {
                 LOG.warn("Semaphore acquire interrupted");
             }
-            futures.add(asyncHttpClient.executeRequest(request, new AsyncCompletionHandler<Response>() {
+            asyncHttpClient.executeRequest(request, new AsyncCompletionHandler<Response>() {
                 @Override
                 public STATE onStatusReceived(HttpResponseStatus status) throws Exception {
                     super.onStatusReceived(status);
@@ -64,7 +62,7 @@ public class AsyncExecutionStrategy implements ExecutionStrategy {
                     semaphore.release();
                     return response;
                 }
-            }));
+            });
         }
         LOG.info("Requests sent, waiting for responses");
 
index 334556704b3a946aaebc096bca30c7930d9b3c18..94eff3d25d8e64de4c06bf335651d7622df11ddd 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.netconf.test.tool.client.http.perf;
 
 import com.google.common.base.Stopwatch;
 import com.google.common.io.Files;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
@@ -25,6 +26,7 @@ import org.opendaylight.netconf.test.tool.TestToolUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+@SuppressFBWarnings("DM_EXIT")
 public final class RestPerfClient {
 
     private static final Logger LOG = LoggerFactory.getLogger(RestPerfClient.class);
@@ -188,7 +190,7 @@ public final class RestPerfClient {
         // and do not log it
         if (allThreadsCompleted) {
             LOG.info(
-                "Requests per second: {}", (parameters.editCount * 1000.0 / started.elapsed(TimeUnit.MILLISECONDS)));
+                "Requests per second: {}", parameters.editCount * 1000.0 / started.elapsed(TimeUnit.MILLISECONDS));
         }
         System.exit(0);
     }
index 90728207b05f584864e5bcc167aa0ed7d04028f4..4af92b70181b5465250104dbcef3c0a438e87cd5 100644 (file)
@@ -11,6 +11,7 @@ package org.opendaylight.netconf.test.tool.client.stress;
 import ch.qos.logback.classic.Level;
 import com.google.common.base.Stopwatch;
 import com.google.common.io.Files;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import io.netty.channel.nio.NioEventLoopGroup;
 import io.netty.util.HashedWheelTimer;
 import io.netty.util.Timer;
@@ -44,6 +45,7 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.xml.sax.SAXException;
 
+@SuppressFBWarnings("DM_EXIT")
 public final class StressClient {
 
     private static final Logger LOG = LoggerFactory.getLogger(StressClient.class);
@@ -183,7 +185,7 @@ public final class StressClient {
         started.stop();
 
         LOG.info("FINISHED. Execution time: {}", started);
-        LOG.info("Requests per second: {}", (params.editCount * 1000.0 / started.elapsed(TimeUnit.MILLISECONDS)));
+        LOG.info("Requests per second: {}", params.editCount * 1000.0 / started.elapsed(TimeUnit.MILLISECONDS));
 
         // Cleanup
         timer.stop();
index a1faa4495069910ee3d0b99a9cf3994a03935033..3b6722f76fb127603c3c85c2a049bca66de819af 100644 (file)
@@ -125,7 +125,7 @@ class RpcMapping {
                 }
             }
 
-            if (e1Children.isEmpty() && e1Children.isEmpty()) {
+            if (e1Children.isEmpty() && e2Children.isEmpty()) {
                 try {
                     return e1.getTextContent().equals(e2.getTextContent());
                 } catch (final DocumentedException e) {
index f139a9000d50976943fdc56448377ea8c2cecf9e..f7b942125e532fb2da446e5cf46dd5a2bd0138a7 100644 (file)
@@ -11,7 +11,6 @@ package org.opendaylight.netconf.test.tool.rpc;
 import com.google.common.base.Optional;
 import java.io.File;
 import java.io.IOException;
-import java.util.Collections;
 import java.util.List;
 import org.opendaylight.controller.config.util.xml.DocumentedException;
 import org.opendaylight.controller.config.util.xml.XmlElement;
@@ -46,11 +45,10 @@ public class SimulatedGetConfig extends AbstractConfigNetconfOperation {
     private static DataList loadInitialConfigXMLFile(final File file) {
         LOG.info("Loading initial config xml file: {}", file.getName());
         DataList configData = new DataList();
-        List<XmlElement> xmlElementList = Collections.emptyList();
         try {
             Element element = XmlUtil.readXmlToElement(file);
             XmlElement xmlElement = XmlElement.fromDomElement(element);
-            xmlElementList = xmlElement.getChildElements();
+            List<XmlElement> xmlElementList = xmlElement.getChildElements();
             configData.setConfigList(xmlElementList);
         } catch (IOException e) {
             LOG.info("IO exception loading xml file: {} ", e.getMessage());
index 1cc85ae216af554549e3241f843047a9a3e9253d..cd8d546082b90b3465d1887b3980d3401f0986eb 100644 (file)
@@ -8,12 +8,14 @@
 
 package org.opendaylight.netconf.test.tool.scale.util;
 
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 import java.io.File;
 import net.sourceforge.argparse4j.ArgumentParsers;
 import net.sourceforge.argparse4j.annotation.Arg;
 import net.sourceforge.argparse4j.inf.ArgumentParser;
 import net.sourceforge.argparse4j.inf.ArgumentParserException;
 
+@SuppressFBWarnings("DM_EXIT")
 public class ScaleUtilParameters {
 
     @Arg(dest = "distro-folder")
index f01ce797fe0c6ec4810db3540f9eb457b1cd3cfd..58eb8bb640a750a9d3576033e9bfca87f4938d36 100644 (file)
          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.mdsal</groupId>
-        <artifactId>binding-parent</artifactId>
-        <version>0.13.0-SNAPSHOT</version>
-        <relativePath/>
+        <groupId>org.opendaylight.netconf</groupId>
+        <artifactId>netconf-parent</artifactId>
+        <version>1.5.0-SNAPSHOT</version>
+        <relativePath>../netconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
                     </instructions>
                 </configuration>
             </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-checkstyle-plugin</artifactId>
-                <configuration>
-                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
-                </configuration>
-            </plugin>
         </plugins>
     </build>
 
-    <dependencyManagement>
-        <dependencies>
-            <dependency>
-                <groupId>org.opendaylight.netconf</groupId>
-                <artifactId>netconf-artifacts</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-            <dependency>
-                <groupId>org.opendaylight.controller</groupId>
-                <artifactId>mdsal-artifacts</artifactId>
-                <version>1.8.0-SNAPSHOT</version>
-                <type>pom</type>
-                <scope>import</scope>
-            </dependency>
-        </dependencies>
-    </dependencyManagement>
-
     <dependencies>
         <dependency>
             <groupId>org.opendaylight.controller</groupId>
index ba7e22a025bc26bcb5ef251821293bd85f9fdecd..a89233727eef93e82593b0be1ce9cf66bf453ef3 100644 (file)
@@ -41,9 +41,6 @@ import org.opendaylight.yangtools.yang.model.repo.spi.SchemaListenerRegistration
 import org.opendaylight.yangtools.yang.model.repo.spi.SchemaSourceListener;
 import org.opendaylight.yangtools.yang.model.repo.util.FilesystemSchemaSourceCache;
 import org.opendaylight.yangtools.yang.parser.repo.SharedSchemaRepository;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -192,10 +189,4 @@ public class YangLibProvider implements AutoCloseable, SchemaSourceListener {
         return sourceIdentifier.getRevision().map(rev -> new OptionalRevision(new RevisionIdentifier(rev.toString())))
                 .orElse(NO_REVISION);
     }
-
-    private <T> T getObjectFromBundleContext(final Class<T> type, final String serviceRefName) {
-        final BundleContext bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext();
-        final ServiceReference<?> serviceReference = bundleContext.getServiceReference(serviceRefName);
-        return (T) bundleContext.getService(serviceReference);
-    }
 }
index e75776f84b533c6f7baefa94ab5d0b198ffce754..7b942dd0072f38b146772299b20485354584075b 100644 (file)
@@ -12,6 +12,7 @@ import com.google.common.base.Preconditions;
 import com.google.common.io.ByteStreams;
 import com.google.common.util.concurrent.ListenableFuture;
 import java.io.IOException;
+import java.nio.charset.Charset;
 import java.util.concurrent.ExecutionException;
 import org.opendaylight.yanglib.api.YangLibService;
 import org.opendaylight.yangtools.yang.common.Revision;
@@ -51,7 +52,7 @@ public class YangLibServiceImpl implements YangLibService {
 
         try {
             final YangTextSchemaSource source = sourceFuture.get();
-            return new String(ByteStreams.toByteArray(source.openStream()));
+            return new String(ByteStreams.toByteArray(source.openStream()), Charset.defaultCharset());
         } catch (InterruptedException | ExecutionException | IOException e) {
             throw new IllegalStateException("Unable to get schema " + sourceId, e);
         }
diff --git a/pom.xml b/pom.xml
index a189ff18fbefc9ba758affe8fa2b9e776436f5d6..50305a5800ba84f500742771ff9d81574b54eb03 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>netconf-parent</artifactId>
+    <artifactId>netconf-aggregator</artifactId>
     <version>1.5.0-SNAPSHOT</version>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
index a883eaf4ea1fa55980f3f897d4dcb45ca500c2bf..a7ec22f56ab723edfe6da3e546c1aa3c1eb61b57 100644 (file)
@@ -7,17 +7,14 @@
  */
 package org.opendaylight.protocol.framework;
 
+import com.google.common.base.Preconditions;
 import io.netty.channel.Channel;
-import io.netty.channel.ChannelFutureListener;
 import io.netty.channel.ChannelHandlerContext;
 import io.netty.channel.ChannelInboundHandlerAdapter;
 import io.netty.util.concurrent.Promise;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import com.google.common.base.Preconditions;
-
 /**
  * Abstract base class for session negotiators. It implements the basic
  * substrate to implement SessionNegotiator API specification, with subclasses
@@ -27,7 +24,8 @@ import com.google.common.base.Preconditions;
  * @param <S> Protocol session type, has to extend {@code ProtocolSession<M>}
  */
 @Deprecated
-public abstract class AbstractSessionNegotiator<M, S extends AbstractProtocolSession<?>> extends ChannelInboundHandlerAdapter implements SessionNegotiator<S> {
+public abstract class AbstractSessionNegotiator<M, S extends AbstractProtocolSession<?>>
+        extends ChannelInboundHandlerAdapter implements SessionNegotiator<S> {
     private final Logger LOG = LoggerFactory.getLogger(AbstractSessionNegotiator.class);
     private final Promise<S> promise;
     protected final Channel channel;
@@ -59,15 +57,14 @@ public abstract class AbstractSessionNegotiator<M, S extends AbstractProtocolSes
      * @param msg Message which should be sent.
      */
     protected final void sendMessage(final M msg) {
-        this.channel.writeAndFlush(msg).addListener(
-                (ChannelFutureListener) f -> {
-                    if (!f.isSuccess()) {
-                        LOG.info("Failed to send message {}", msg, f.cause());
-                        negotiationFailed(f.cause());
-                    } else {
-                        LOG.trace("Message {} sent to socket", msg);
-                    }
-                });
+        this.channel.writeAndFlush(msg).addListener(f -> {
+            if (!f.isSuccess()) {
+                LOG.info("Failed to send message {}", msg, f.cause());
+                negotiationFailed(f.cause());
+            } else {
+                LOG.trace("Message {} sent to socket", msg);
+            }
+        });
     }
 
     @Override
index f449b51d0deff211b5469e56f4504ea4788e0bbc..87313f4e4cfb1140bc8f2c59e63dc39bddb06bcf 100644 (file)
@@ -14,7 +14,6 @@ import io.netty.channel.ChannelInboundHandlerAdapter;
 import io.netty.util.concurrent.DefaultPromise;
 import io.netty.util.concurrent.EventExecutor;
 import io.netty.util.concurrent.Future;
-import io.netty.util.concurrent.GenericFutureListener;
 import java.net.InetSocketAddress;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -53,7 +52,7 @@ final class ReconnectPromise<S extends ProtocolSession<?>, L extends SessionList
             channel.pipeline().addLast(new ClosedChannelHandler(ReconnectPromise.this));
         });
 
-        pending.addListener((GenericFutureListener<Future<Object>>) future -> {
+        pending.addListener(future -> {
             if (!future.isSuccess() && !ReconnectPromise.this.isDone()) {
                 ReconnectPromise.this.setFailure(future.cause());
             }
index 1c59a4b0a9444f407cfc504327802111c59a633f..e12e5e2ca2de29e598c3364f7ce32a925a919069 100644 (file)
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>restconf-parent</artifactId>
+    <artifactId>restconf-subsystem</artifactId>
     <version>1.8.0-SNAPSHOT</version>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
 
     <modules>
-        <module>restconf-binding-parent</module>
+        <module>restconf-parent</module>
         <module>restconf-artifacts</module>
         <module>restconf-models</module>
         <module>restconf-common-models</module>
index 1a43e381527d257280f079a35ffd247e98305dc0..1d7a42134e4856f10557f3fd8bf6524bc026da3f 100644 (file)
@@ -13,9 +13,9 @@
 
   <parent>
     <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>restconf-binding-parent</artifactId>
+    <artifactId>restconf-parent</artifactId>
     <version>1.8.0-SNAPSHOT</version>
-    <relativePath>../restconf-binding-parent</relativePath>
+    <relativePath>../restconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
index 5cdbd8963e1407dd386e23dd7bc25fcc096dd11b..ccbeb2dd1a4b44b90600a6a2b3e973b7f041a8fb 100644 (file)
@@ -13,9 +13,9 @@
 
   <parent>
     <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>restconf-binding-parent</artifactId>
+    <artifactId>restconf-parent</artifactId>
     <version>1.8.0-SNAPSHOT</version>
-    <relativePath>../restconf-binding-parent</relativePath>
+    <relativePath>../restconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
index eb7849d8036df2f069e1bc7222c687e97a9a8ca5..6cb76000b4979295aad35791e2d6d494b97c767a 100644 (file)
@@ -12,9 +12,9 @@
 
     <parent>
         <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>restconf-binding-parent</artifactId>
+        <artifactId>restconf-parent</artifactId>
         <version>1.8.0-SNAPSHOT</version>
-        <relativePath>../../restconf-binding-parent</relativePath>
+        <relativePath>../../restconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
index d4bcdb4e8081219e037884621a9bdf0548eac663..1b01b55f23467a82c901bba27e84db9126524f67 100644 (file)
@@ -12,9 +12,9 @@
 
     <parent>
         <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>restconf-binding-parent</artifactId>
+        <artifactId>restconf-parent</artifactId>
         <version>1.8.0-SNAPSHOT</version>
-        <relativePath>../../restconf-binding-parent</relativePath>
+        <relativePath>../../restconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
index a50ed299a28d0fc62a64780875d01d5633827cfa..285d35af58edab10a2e8fa24f74831ecf625269a 100644 (file)
@@ -12,9 +12,9 @@
 
     <parent>
         <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>restconf-binding-parent</artifactId>
+        <artifactId>restconf-parent</artifactId>
         <version>1.8.0-SNAPSHOT</version>
-        <relativePath>../../restconf-binding-parent</relativePath>
+        <relativePath>../../restconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
index cadda6787beddaa91791e9a40c78d43c4f02a8f8..f10ee72d51f10b01a7fbbb584e2849c0d6fc033f 100644 (file)
@@ -10,9 +10,9 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>restconf-binding-parent</artifactId>
+    <artifactId>restconf-parent</artifactId>
     <version>1.8.0-SNAPSHOT</version>
-    <relativePath>../restconf-binding-parent</relativePath>
+    <relativePath>../restconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
index 294decd75406f83dad86129375b824fece2fdcd5..910bd7e1be859fabcd9847bed65f7698f453a9d7 100644 (file)
@@ -35,7 +35,6 @@ import org.junit.Ignore;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
-import org.opendaylight.controller.md.sal.common.api.TransactionStatus;
 import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
 import org.opendaylight.controller.md.sal.dom.api.DOMMountPointService;
@@ -48,7 +47,6 @@ import org.opendaylight.netconf.sal.rest.impl.XmlNormalizedNodeBodyReader;
 import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
-import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
 import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 import org.opendaylight.yangtools.yang.model.api.Module;
@@ -137,9 +135,6 @@ public class RestPostOperationTest extends JerseyTest {
     // - we expecting problems with singletons ControllerContext as schemaContext holder
     public void createConfigurationDataTest() throws UnsupportedEncodingException, ParseException {
         initMocking();
-        final RpcResult<TransactionStatus> rpcResult = new DummyRpcResult.Builder<TransactionStatus>().result(
-                TransactionStatus.COMMITED).build();
-
         when(brokerFacade.commitConfigurationDataPost((SchemaContext) null, any(YangInstanceIdentifier.class),
                 any(NormalizedNode.class), null, null))
                 .thenReturn(mock(CheckedFuture.class));
index 1ee8149e242e17415ae807ea7d2e6d07ffd73df2..a820477b600edc53f4b06d219f880dbca77e03f9 100644 (file)
@@ -12,9 +12,9 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>restconf-binding-parent</artifactId>
+    <artifactId>restconf-parent</artifactId>
     <version>1.8.0-SNAPSHOT</version>
-    <relativePath>../restconf-binding-parent</relativePath>
+    <relativePath>../restconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
similarity index 98%
rename from restconf/restconf-binding-parent/pom.xml
rename to restconf/restconf-parent/pom.xml
index 8b7279ae087affb36a7e10cfa11c6c4ee7afd22d..11febca35ed50778f8b6d837307ea1bfe996e243 100644 (file)
@@ -16,7 +16,7 @@
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
-  <artifactId>restconf-binding-parent</artifactId>
+  <artifactId>restconf-parent</artifactId>
   <version>1.8.0-SNAPSHOT</version>
   <packaging>pom</packaging>
 
index f6b388131c4bea9d9517b4a94df6578c7ec28ac0..6e952dceac213a349a233e807d414952c5093a1b 100644 (file)
@@ -11,9 +11,9 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.opendaylight.netconf</groupId>
-        <artifactId>restconf-binding-parent</artifactId>
+        <artifactId>restconf-parent</artifactId>
         <version>1.8.0-SNAPSHOT</version>
-        <relativePath>../restconf-binding-parent</relativePath>
+        <relativePath>../restconf-parent</relativePath>
     </parent>
 
     <groupId>org.opendaylight.netconf</groupId>
index af26bbfd3521e835f167fac1f6c348d0ce59b4c3..a3086cf765f86aa9f3c95f089f99f97a77570082 100644 (file)
@@ -10,9 +10,9 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>restconf-binding-parent</artifactId>
+    <artifactId>restconf-parent</artifactId>
     <version>1.8.0-SNAPSHOT</version>
-    <relativePath>../restconf-binding-parent</relativePath>
+    <relativePath>../restconf-parent</relativePath>
   </parent>
 
   <groupId>org.opendaylight.netconf</groupId>
index ec985b025bc69967e9d978c99d791ff755d8491b..016742b1b5f669f8c303b8c2c033797a4972332e 100644 (file)
@@ -3,9 +3,9 @@
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.opendaylight.netconf</groupId>
-    <artifactId>restconf-binding-parent</artifactId>
+    <artifactId>restconf-parent</artifactId>
     <version>1.8.0-SNAPSHOT</version>
-    <relativePath>../restconf-binding-parent</relativePath>
+    <relativePath>../restconf-parent</relativePath>
   </parent>
 
   <artifactId>sal-restconf-broker</artifactId>