Merge changes from topic 'netconf-clustering'
authorTony Tkacik <ttkacik@cisco.com>
Mon, 4 Jan 2016 13:25:10 +0000 (13:25 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 4 Jan 2016 13:25:10 +0000 (13:25 +0000)
* changes:
  Move mount point registration after schema resolution
  Cluster schema resolution pipeline
  Clustered sources resolution
  Change onNodeUpdated to first cleanup previous state
  Use normal identify messages first
  Use lock in topology node writer
  Prevent NPE's on failures
  RemoteDeviceDataBroker proxy

39 files changed:
features/restconf/pom.xml
opendaylight/netconf/abstract-topology/pom.xml
opendaylight/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/NetconfMdsalMonitoringMapperModule.java
opendaylight/netconf/mdsal-netconf-monitoring/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/monitoring/NetconfMdsalMonitoringMapperModuleFactory.java
opendaylight/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NetconfMdsalNotificationMapperModule.java
opendaylight/netconf/mdsal-netconf-notification/src/main/java/org/opendaylight/controller/config/yang/netconf/mdsal/notification/NetconfMdsalNotificationMapperModuleFactory.java
opendaylight/netconf/messagebus-netconf/src/main/java/org/opendaylight/controller/config/yang/messagebus/netconf/MessageBusNetconfModule.java
opendaylight/netconf/messagebus-netconf/src/main/java/org/opendaylight/controller/config/yang/messagebus/netconf/MessageBusNetconfModuleFactory.java
opendaylight/netconf/netconf-config-dispatcher/src/test/java/org/opendaylight/controller/config/yang/config/netconf/client/dispatcher/NetconfClientDispatcherModuleTest.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfMapperAggregatorModule.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfMapperAggregatorModuleFactory.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerDispatcherModule.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerDispatcherModuleFactory.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerMonitoringModule.java
opendaylight/netconf/netconf-impl/src/main/java/org/opendaylight/controller/config/yang/config/netconf/northbound/impl/NetconfServerMonitoringModuleFactory.java
opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/exi/EXIParameters.java
opendaylight/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/notification/impl/NetconfNotificationManagerModule.java
opendaylight/netconf/netconf-notifications-impl/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/notification/impl/NetconfNotificationManagerModuleFactory.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/ssh/NetconfNorthboundSshModule.java
opendaylight/netconf/netconf-ssh/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/ssh/NetconfNorthboundSshModuleFactory.java
opendaylight/netconf/netconf-tcp/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/tcp/NetconfNorthboundTcpModule.java
opendaylight/netconf/netconf-tcp/src/main/java/org/opendaylight/controller/config/yang/netconf/northbound/tcp/NetconfNorthboundTcpModuleFactory.java
opendaylight/netconf/netconf-topology/pom.xml
opendaylight/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/clustered/netconf/topology/ClusteredNetconfTopologyModule.java
opendaylight/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/clustered/netconf/topology/ClusteredNetconfTopologyModuleFactory.java
opendaylight/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/shared/schema/repository/SchemaRepositoryImplModule.java
opendaylight/netconf/netconf-topology/src/main/java/org/opendaylight/controller/config/yang/netconf/topology/shared/schema/repository/SchemaRepositoryImplModuleFactory.java
opendaylight/netconf/sal-netconf-connector/src/main/java/org/opendaylight/netconf/sal/connect/netconf/listener/NetconfSessionPreferences.java
opendaylight/netconf/sal-netconf-connector/src/test/java/org/opendaylight/netconf/sal/connect/netconf/listener/NetconfSessionPreferencesTest.java
opendaylight/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/NetconfDeviceSimulator.java
opendaylight/restconf/sal-rest-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/rest/connector/RestConnectorModule.java
opendaylight/restconf/sal-rest-connector/src/main/java/org/opendaylight/controller/config/yang/md/sal/rest/connector/RestConnectorModuleFactory.java
opendaylight/restconf/sal-rest-connector/src/main/java/org/opendaylight/controller/config/yang/sal/restconf/service/JSONRestconfServiceModule.java
opendaylight/restconf/sal-rest-connector/src/main/java/org/opendaylight/controller/config/yang/sal/restconf/service/JSONRestconfServiceModuleFactory.java
opendaylight/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java
opendaylight/restconf/sal-rest-connector/src/test/java/org/opendaylight/controller/sal/restconf/impl/test/RestconfImplTest.java
opendaylight/restconf/sal-rest-docgen/pom.xml
opendaylight/restconf/sal-rest-docgen/src/main/resources/WEB-INF/web.xml
pom.xml

index d130180040ce8048b0015ab189f71ed9f336d6b0..df2201cc2ed524891c2eff50b16299d08b846726 100644 (file)
@@ -24,7 +24,6 @@
     <commons.opendaylight.version>1.6.0-SNAPSHOT</commons.opendaylight.version>
     <controller.mdsal.version>1.3.0-SNAPSHOT</controller.mdsal.version>
     <features.test.version>1.6.0-SNAPSHOT</features.test.version>
-    <jersey-servlet.version>1.17</jersey-servlet.version>
     <mdsal.version>2.0.0-SNAPSHOT</mdsal.version>
     <mdsal.model.version>0.8.0-SNAPSHOT</mdsal.model.version>
     <restconf.version>1.3.0-SNAPSHOT</restconf.version>
index 703ee4e9bfa5fb349db5a27050151563bd2f8cc9..b600b6a98aab7e2af52ccc05c46db9330e42872f 100644 (file)
@@ -61,7 +61,6 @@
         <dependency>
             <groupId>com.typesafe</groupId>
             <artifactId>config</artifactId>
-            <version>${typesafe.config.version}</version>
         </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
             <version>1.9.5</version>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>com.typesafe</groupId>
-            <artifactId>config</artifactId>
-            <version>1.2.1</version>
-        </dependency>
         <dependency>
             <groupId>com.jayway.awaitility</groupId>
             <artifactId>awaitility</artifactId>
index 985c728788438b93898f954fcd4587aa394a1919..9b779ac5571c294cec99d90a16ee80287612bb93 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.netconf.mdsal.monitoring;
 
 import java.util.Collections;
index e0d459318fe6be4c366e9cb386f4c4eabeb19c33..026b4159ed21778398f1be23a8954c4fd9cf1dfa 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index df97717531303b56728695b8afd84f1d2c9d33aa..584f59de7e131583feab4f634e364a2ddcce646d 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.netconf.mdsal.notification;
 
 import org.opendaylight.controller.md.sal.common.api.data.AsyncDataBroker;
index 0f8f08f69a4324c251b82563ae4e032985d17e85..c87382cea19a4b608d61dc94a64ed69d44bec1d0 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index 9b90f4798af1a43362dc95d203885c5361ab0fe6..19761d495d1d2c4121d11cd8882ee21907ae1621 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.messagebus.netconf;
 
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
index 7681cdf02d33281ee60feaaae5363be532b3b49c..fe41f43d812e3b00320e86e0c2d749aa5a4685d6 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index 85477a02377af870142092de73a8c223308c703b..bd4f4e8dff98c9a47b01ff945c2b9c7488e8b14a 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.config.netconf.client.dispatcher;
 
 import javax.management.InstanceAlreadyExistsException;
index 59f20373592ba5a2e1b0cb001644ac51509466bf..4b49941ae80ee9c4ad962136f202e2ed8b5734d3 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.config.netconf.northbound.impl;
 
 import org.opendaylight.netconf.impl.osgi.AggregatedNetconfOperationServiceFactory;
index 0e415bdfcb440db004ab24f244fe922ab2605056..8a8ffb748af07b64ab93a86fac7d99d00534d41c 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index 5135d268312e1459ce6dac84d697a899671418d4..ce91d01334ab58e4dcfb02ba4d0f77d2b9dca554 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.config.netconf.northbound.impl;
 
 import org.opendaylight.controller.config.api.JmxAttributeValidationException;
index de44caddaca201849799439e608eaaba43d28a4d..61c0c7137e054afaf567fe2f9dc80c8785cdf9c9 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index 4bb0345c3561403656027a0ba0eaa51bfeabaae5..5a7aa06ad72148600a024fc0e211545f1f498c1e 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.config.netconf.northbound.impl;
 
 import org.opendaylight.netconf.impl.osgi.NetconfMonitoringServiceImpl;
index fe74486a7717dcdbf959e105b4c36674341b71ef..8b4cb65ed2731cf5e6b9ad7d2d526f7c53bf8ad4 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index 2bc96beb0517d766a6dcbd8aefea1d184cd77363..6fcea5130a7e18b42fc3d069f0c0d179386e229f 100644 (file)
@@ -14,6 +14,8 @@ import org.openexi.proc.common.EXIOptions;
 import org.openexi.proc.common.EXIOptionsException;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public final class EXIParameters {
     private static final String EXI_PARAMETER_ALIGNMENT = "alignment";
@@ -30,6 +32,7 @@ public final class EXIParameters {
     private static final String EXI_FIDELITY_PREFIXES = "prefixes";
 
     private final EXIOptions options;
+    private static final Logger LOG = LoggerFactory.getLogger(EXIParameters.class);
 
     private EXIParameters(final EXIOptions options) {
         this.options = Preconditions.checkNotNull(options);
@@ -38,18 +41,12 @@ public final class EXIParameters {
 
     public static EXIParameters fromXmlElement(final XmlElement root) throws EXIOptionsException {
         final EXIOptions options =  new EXIOptions();
-
-        options.setAlignmentType(AlignmentType.bitPacked);
-
         final NodeList alignmentElements = root.getElementsByTagName(EXI_PARAMETER_ALIGNMENT);
         if (alignmentElements.getLength() > 0) {
             final Element alignmentElement = (Element) alignmentElements.item(0);
             final String alignmentTextContent = alignmentElement.getTextContent().trim();
 
             switch (alignmentTextContent) {
-            case EXI_PARAMETER_BIT_PACKED:
-                options.setAlignmentType(AlignmentType.bitPacked);
-                break;
             case EXI_PARAMETER_BYTE_ALIGNED:
                 options.setAlignmentType(AlignmentType.byteAligned);
                 break;
@@ -59,7 +56,14 @@ public final class EXIParameters {
             case EXI_PARAMETER_PRE_COMPRESSION:
                 options.setAlignmentType(AlignmentType.preCompress);
                 break;
+            default:
+                LOG.warn("Unexpected value in alignmentTextContent: {} , using default value", alignmentTextContent);
+            case EXI_PARAMETER_BIT_PACKED:
+                options.setAlignmentType(AlignmentType.bitPacked);
+                break;
             }
+        } else {
+            options.setAlignmentType(AlignmentType.bitPacked);
         }
 
         if (root.getElementsByTagName(EXI_PARAMETER_FIDELITY).getLength() > 0) {
index b50ff024c6c970cb54237142a6ddeb1b580ac51b..d9dce4b99d95327b0ef5a4326fa7a38573d817e2 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.netconf.northbound.notification.impl;
 
 import org.opendaylight.netconf.notifications.impl.NetconfNotificationManager;
index 624c262d20640e9d0d934cc5f82ae796ca643f5d..dadf7562006e935300970cffef73e4586b93c0c8 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index f212edc2d3f3a4f44aae85d53c1fa06d993d2afa..be457f961d78f9ba07fd5023ec0aed3bc80fc9c0 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.netconf.northbound.ssh;
 
 import io.netty.channel.ChannelFuture;
index 4e107ec24d6c291c315d6adca8747101405aac4c..88ad64bcf74a10f6a6181a18f5aa2de7abb79919 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index b9156f6c82538ac0546fa123ff665439ec90a240..bb33aaa23340f4afd438f403153f402bc31284df 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.netconf.northbound.tcp;
 
 import io.netty.channel.ChannelFuture;
index 081486ecf4cafb8c7647580d0f639b4568ff1ba7..3ed70d9ce5ce86b70f929a72517761e491957934 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index fb36a67f2d5dcbb3d92293b45ea86b3720afb31d..4944abfa417f62120677a5680115cb346b1d0331 100644 (file)
@@ -89,7 +89,6 @@
         <dependency>
             <groupId>com.typesafe</groupId>
             <artifactId>config</artifactId>
-            <version>${typesafe.config.version}</version>
         </dependency>
         <dependency>
             <groupId>org.mockito</groupId>
index 61e15700c015a39dd94926087d64825bcfa8c2f4..54be237e369d9da9d51e704d2eda7f138934893d 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.clustered.netconf.topology;
 
 import org.opendaylight.netconf.topology.impl.ClusteredNetconfTopology;
index 6017de309733e24fd1a21f6b0c308554ad67daf3..0fb3a5bcc44b5aab83a68cc874d8c29572e13673 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index 5ea2f50fc93ff5b5102ae194a8fc2af2522e0a1b..c4f5f98820609cb8aad41522edeee925ef1a00a2 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.netconf.topology.shared.schema.repository;
 
 import org.opendaylight.netconf.topology.SchemaRepositoryProvider;
index b3a64d496e4c62ff65bc4df6f60daf7ff5518dd8..9cf6e1cc6a02bd46ecdef6e8ec9c6d8fd63ddc24 100644 (file)
@@ -1,3 +1,11 @@
+/*
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 /*
 * Generated file
 *
index b4f14eef05fc3aba89d428b048e9dc0a72b5ebff..5016067cd1862eacf6805f282069582d3adbc6a5 100644 (file)
@@ -13,6 +13,7 @@ import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Predicate;
 import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Sets;
@@ -135,11 +136,11 @@ public final class NetconfSessionPreferences {
     }
 
     private static QName cachedQName(final String namespace, final String revision, final String moduleName) {
-        return QName.cachedReference(QName.create(namespace, revision, moduleName));
+        return QName.create(namespace, revision, moduleName).intern();
     }
 
     private static QName cachedQName(final String namespace, final String moduleName) {
-        return QName.cachedReference(QName.create(URI.create(namespace), null, moduleName).withoutRevision());
+        return QName.create(URI.create(namespace), null, moduleName).withoutRevision().intern();
     }
 
     public static NetconfSessionPreferences fromStrings(final Collection<String> capabilities) {
@@ -155,12 +156,12 @@ public final class NetconfSessionPreferences {
             final String namespace = capability.substring(0, qmark);
             final Iterable<String> queryParams = AMP_SPLITTER.split(capability.substring(qmark + 1));
             final String moduleName = MODULE_PARAM.from(queryParams);
-            if (moduleName == null) {
+            if (Strings.isNullOrEmpty(moduleName)) {
                 continue;
             }
 
             String revision = REVISION_PARAM.from(queryParams);
-            if (revision != null) {
+            if (!Strings.isNullOrEmpty(revision)) {
                 addModuleQName(moduleBasedCaps, nonModuleCaps, capability, cachedQName(namespace, revision, moduleName));
                 continue;
             }
@@ -173,7 +174,7 @@ public final class NetconfSessionPreferences {
 
                 LOG.debug("Netconf device was not reporting revision correctly, trying to get amp;revision=");
                 revision = BROKEN_REVISON_PARAM.from(queryParams);
-                if (revision == null) {
+                if (Strings.isNullOrEmpty(revision)) {
                     LOG.warn("Netconf device returned revision incorrectly escaped for {}, ignoring it", capability);
                     addModuleQName(moduleBasedCaps, nonModuleCaps, capability, cachedQName(namespace, moduleName));
                 } else {
index 9b34fbf31f9be463db6812eb68b672fd90b71ef0..0e5150949d4981853d27a2215e635d41e02bb912 100644 (file)
@@ -57,11 +57,14 @@ public class NetconfSessionPreferencesTest {
                 "namespace:2?module=module2",
                 "namespace:2?module=module2&amp;revision=2012-12-12",
                 "namespace:2?module=module1&amp;RANDOMSTRING;revision=2013-12-12",
-                "namespace:2?module=module2&amp;RANDOMSTRING;revision=2013-12-12" // This one should be ignored(same as first), since revision is in wrong format
+                // Revision parameter present, but no revision defined
+                "namespace:2?module=module4&amp;RANDOMSTRING;revision=",
+                // This one should be ignored(same as first), since revision is in wrong format
+                "namespace:2?module=module2&amp;RANDOMSTRING;revision=2013-12-12"
         );
 
         final NetconfSessionPreferences sessionCaps1 = NetconfSessionPreferences.fromStrings(caps1);
-        assertCaps(sessionCaps1, 0, 3);
+        assertCaps(sessionCaps1, 0, 4);
     }
 
     private void assertCaps(final NetconfSessionPreferences sessionCaps1, final int nonModuleCaps, final int moduleCaps) {
index 212385f2943f62799143242a2c0103faddd7dff8..97739e1614dd0cb8d27db203dc9e7b5f7fb07803 100644 (file)
@@ -298,21 +298,28 @@ public class NetconfDeviceSimulator implements Closeable {
         final Set<Capability> capabilities = Sets.newHashSet();
 
         for (final Module module : schemaContext.getModules()) {
-            final SourceIdentifier moduleSourceIdentifier = new SourceIdentifier(module.getName(),
-                    SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision()));
-            try {
-                String moduleContent = new String(consumer.getSchemaSource(moduleSourceIdentifier, YangTextSchemaSource.class)
-                        .checkedGet().read());
-                capabilities.add(new YangModuleCapability(module, moduleContent));
-                //IOException would be thrown in creating SchemaContext already
-            } catch (SchemaSourceException|IOException e) {
-                throw new RuntimeException("Cannot retrieve schema source for module " + moduleSourceIdentifier.toString() + " from schema repository", e);
+            for (final Module subModule : module.getSubmodules()) {
+                addModuleCapability(consumer, capabilities, subModule);
             }
+            addModuleCapability(consumer, capabilities, module);
         }
-
         return capabilities;
     }
 
+    private void addModuleCapability(SharedSchemaRepository consumer, Set<Capability> capabilities, Module module) {
+        final SourceIdentifier moduleSourceIdentifier = SourceIdentifier.create(module.getName(),
+                (SimpleDateFormatUtil.DEFAULT_DATE_REV == module.getRevision() ? Optional.<String>absent() :
+                        Optional.of(SimpleDateFormatUtil.getRevisionFormat().format(module.getRevision()))));
+        try {
+            String moduleContent = new String(consumer.getSchemaSource(moduleSourceIdentifier, YangTextSchemaSource.class)
+                    .checkedGet().read());
+            capabilities.add(new YangModuleCapability(module, moduleContent));
+            //IOException would be thrown in creating SchemaContext already
+        } catch (SchemaSourceException |IOException e) {
+            throw new RuntimeException("Cannot retrieve schema source for module " + moduleSourceIdentifier.toString() + " from schema repository", e);
+        }
+    }
+
     private void addDefaultSchemas(final SharedSchemaRepository consumer) {
         SourceIdentifier sId = new SourceIdentifier("ietf-netconf-monitoring", "2010-10-04");
         registerSource(consumer, "/META-INF/yang/ietf-netconf-monitoring.yang", sId);
index a7d6c8816b8cd46a0721c5eca9ce3c067a46079f..6b2aedcce459f7796831b175e06675eb46bb8157 100644 (file)
@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.md.sal.rest.connector;
 
 import org.opendaylight.netconf.sal.restconf.impl.RestconfProviderImpl;
index 1964a174729f2133159f0cacb5fdbb90fd7fc387..fb664628903d017b149831949ba804b555e2c6f1 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 /*
 * Generated file
 *
index 8da5dcb6cbb4ce54dae9713f2f4d335fc1e95444..5aa0e8ebd52ea175f5171f0c1f96b58c5721612f 100644 (file)
@@ -1,3 +1,11 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.yang.sal.restconf.service;
 
 import org.opendaylight.netconf.sal.restconf.impl.JSONRestconfServiceImpl;
index d822afd76e689b4173e11167e14a800b2cd77d43..68e3856529091c100f81427f15fd92cb56e3d6f6 100644 (file)
@@ -1,3 +1,10 @@
+/**
+ * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 /*
 * Generated file
 *
index 6d19dfc9235afc184fd82a2dad767f8cc96bdc9f..18b02cfa3449f32954f54320852aa500bf20947d 100644 (file)
@@ -108,8 +108,6 @@ public class RestconfImpl implements RestconfService {
 
     private static final int CHAR_NOT_FOUND = -1;
 
-    private static final String MOUNT_POINT_MODULE_NAME = "ietf-netconf";
-
     private static final SimpleDateFormat REVISION_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
 
     private static final String SAL_REMOTE_NAMESPACE = "urn:opendaylight:params:xml:ns:yang:controller:md:sal:remote";
@@ -434,7 +432,7 @@ public class RestconfImpl implements RestconfService {
         final CheckedFuture<DOMRpcResult, DOMRpcException> response;
         final DOMMountPoint mountPoint = payload.getInstanceIdentifierContext().getMountPoint();
         final SchemaContext schemaContext;
-        if (identifier.contains(MOUNT_POINT_MODULE_NAME) && mountPoint != null) {
+        if (mountPoint != null) {
             final Optional<DOMRpcService> mountRpcServices = mountPoint.getService(DOMRpcService.class);
             if ( ! mountRpcServices.isPresent()) {
                 LOG.debug("Error: Rpc service is missing.");
index ca5fbfeb357778d952d80fc72f8c63d31dc12951..72b5b3d9f7e131cd2d59e506175317db174b14b6 100644 (file)
@@ -10,23 +10,39 @@ package org.opendaylight.controller.sal.restconf.impl.test;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyBoolean;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.Futures;
 import java.io.FileNotFoundException;
 import java.text.ParseException;
 import java.util.Set;
+import javax.ws.rs.core.MultivaluedHashMap;
+import javax.ws.rs.core.UriInfo;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
+import org.opendaylight.controller.md.sal.dom.api.DOMMountPoint;
+import org.opendaylight.controller.md.sal.dom.api.DOMRpcResult;
+import org.opendaylight.controller.md.sal.dom.api.DOMRpcService;
 import org.opendaylight.netconf.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.netconf.sal.restconf.impl.ControllerContext;
+import org.opendaylight.netconf.sal.restconf.impl.InstanceIdentifierContext;
+import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfImpl;
+import org.opendaylight.yangtools.yang.common.QName;
 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;
 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
+import org.opendaylight.yangtools.yang.model.api.SchemaNode;
+import org.opendaylight.yangtools.yang.model.api.SchemaPath;
 
 /**
  * @See {@link InvokeRpcMethodTest}
@@ -65,4 +81,26 @@ public class RestconfImplTest {
                 brokerFacade.readOperationalData(null));
     }
 
+    @Test
+    public void testRpcForMountpoint() throws Exception {
+        final UriInfo uriInfo = mock(UriInfo.class);
+        doReturn(new MultivaluedHashMap<>()).when(uriInfo).getQueryParameters(anyBoolean());
+
+        final NormalizedNodeContext ctx = mock(NormalizedNodeContext.class);
+        final InstanceIdentifierContext iiCtx = mock(InstanceIdentifierContext.class);
+        doReturn(iiCtx).when(ctx).getInstanceIdentifierContext();
+        final SchemaNode schemaNode = mock(SchemaNode.class);
+        doReturn(schemaNode).when(iiCtx).getSchemaNode();
+        doReturn(mock(SchemaPath.class)).when(schemaNode).getPath();
+        doReturn(QName.create("namespace", "2010-10-10", "localname")).when(schemaNode).getQName();
+
+        final DOMMountPoint mount = mock(DOMMountPoint.class);
+        doReturn(mount).when(iiCtx).getMountPoint();
+        final DOMRpcService rpcService = mock(DOMRpcService.class);
+        doReturn(Optional.of(rpcService)).when(mount).getService(DOMRpcService.class);
+        doReturn(Futures.immediateCheckedFuture(mock(DOMRpcResult.class))).when(rpcService).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class));
+        restconfImpl.invokeRpc("randomId", ctx, uriInfo);
+        restconfImpl.invokeRpc("ietf-netconf", ctx, uriInfo);
+        verify(rpcService, times(2)).invokeRpc(any(SchemaPath.class), any(NormalizedNode.class));
+    }
 }
index 2a14fe28aaa8f0f44cfb53b1dc80b9c6440e033c..30f78ea494ace7f4cfec7cd23583606c8558eb78 100644 (file)
               !org.apache.maven.project,
               !org.opendaylight.yangtools.yang2sources.spi,
               *,
-              com.sun.jersey.spi.container.servlet, org.eclipse.jetty.servlets
+              com.sun.jersey.spi.container.servlet,
+              org.eclipse.jetty.servlets,
+              org.opendaylight.aaa.shiro.filters,
+              org.opendaylight.aaa.shiro.realm,
+              org.opendaylight.aaa.shiro.web.env,
+              org.apache.shiro.web.env
             </Import-Package>
             <Bundle-Activator>org.opendaylight.netconf.sal.rest.doc.DocProvider</Bundle-Activator>
             <Web-ContextPath>/apidoc</Web-ContextPath>
index 930a39db8e8083c3f394d20d6d3991bde385a453..cd267696304312eac072d295aba47b1529b6b343 100644 (file)
             <param-name>javax.ws.rs.Application</param-name>
             <param-value>org.opendaylight.netconf.sal.rest.doc.jaxrs.ApiDocApplication</param-value>
         </init-param>
-        <!-- AAA Auth Filter -->
-        <init-param>
-            <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
-            <param-value> org.opendaylight.aaa.sts.TokenAuthFilter</param-value>
-        </init-param>
         <load-on-startup>1</load-on-startup>
     </servlet>
 
+    <context-param>
+      <param-name>shiroEnvironmentClass</param-name>
+      <param-value>org.opendaylight.aaa.shiro.web.env.KarafIniWebEnvironment</param-value>
+    </context-param>
+
+    <listener>
+        <listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
+    </listener>
+
+    <filter>
+        <filter-name>ShiroFilter</filter-name>
+        <filter-class>org.opendaylight.aaa.shiro.filters.AAAFilter</filter-class>
+    </filter>
+
+    <filter-mapping>
+        <filter-name>ShiroFilter</filter-name>
+        <url-pattern>/*</url-pattern>
+    </filter-mapping>
+
     <servlet-mapping>
         <servlet-name>JAXRSApiDoc</servlet-name>
         <url-pattern>/apis/*</url-pattern>
diff --git a/pom.xml b/pom.xml
index 55532876972bee49c50efbb84d22b2113d142f00..51077a81914b108f74b4b3958912907da00b3d18 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -35,7 +35,6 @@
         <ietf-restconf.version>2013.10.19.8-SNAPSHOT</ietf-restconf.version>
         <ietf-topology.version>2013.10.21.8-SNAPSHOT</ietf-topology.version>
         <ietf-yang-types.version>2010.09.24.8-SNAPSHOT</ietf-yang-types.version>
-        <jersey-servlet.version>1.17</jersey-servlet.version>
 
         <mdsal.version>2.0.0-SNAPSHOT</mdsal.version>
         <mdsal.model.version>0.8.0-SNAPSHOT</mdsal.model.version>
@@ -47,7 +46,6 @@
         <scala.major.version>2.10</scala.major.version>
         <scala.minor.version>4</scala.minor.version>
         <surefire.version>2.15</surefire.version>
-        <typesafe.config.version>1.2.1</typesafe.config.version>
         <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
 
         <jmxGeneratorPath>src/main/yang-gen-config</jmxGeneratorPath>