Merge "Formatted code Bug-3894."
authorMaros Marsalek <mmarsale@cisco.com>
Mon, 14 Dec 2015 11:19:32 +0000 (11:19 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 14 Dec 2015 11:19:32 +0000 (11:19 +0000)
features/netconf/pom.xml
features/netconf/src/main/features/features.xml
features/restconf/pom.xml
features/restconf/src/main/features/features.xml
opendaylight/netconf/models/ietf-netconf-notifications/src/main/yang/ietf-netconf-notifications@2012-02-06.yang
opendaylight/netconf/tools/netconf-testtool/src/main/java/org/opendaylight/netconf/test/tool/client/http/perf/Parameters.java
opendaylight/restconf/sal-rest-connector/pom.xml
opendaylight/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java
opendaylight/restconf/sal-rest-connector/src/main/resources/WEB-INF/web.xml

index 9d24f37e543de15a7134445937adc614b7f91f74..b79e70badd9140036ce1bff4fac4532efa9ff112 100644 (file)
   </dependencyManagement>
 
   <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.aaa</groupId>
+      <artifactId>features-aaa-shiro</artifactId>
+      <version>${aaa.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>features-protocol-framework</artifactId>
       <groupId>io.netty</groupId>
       <artifactId>netty-transport</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.bouncycastle</groupId>
+      <artifactId>bcpkix-jdk15on</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.bouncycastle</groupId>
+      <artifactId>bcprov-jdk15on</artifactId>
+    </dependency>
     <dependency>
       <groupId>${project.groupId}</groupId>
       <artifactId>netconf-client</artifactId>
index 9a123722831d041fd961c64cb03aa71288182e11..65d89fe4310eb5f088e4db1bba24f32402202528 100644 (file)
@@ -81,8 +81,8 @@
     <feature version='${project.version}'>odl-netconf-mapping-api</feature>
     <feature version='${project.version}'>odl-netconf-util</feature>
     <bundle>mvn:org.opendaylight.netconf/netconf-netty-util/{{VERSION}}</bundle>
-    <bundle>mvn:org.bouncycastle/bcpkix-jdk15on/${bouncycastle.version}</bundle>
-    <bundle>mvn:org.bouncycastle/bcprov-jdk15on/${bouncycastle.version}</bundle>
+    <bundle>mvn:org.bouncycastle/bcpkix-jdk15on/{{VERSION}}</bundle>
+    <bundle>mvn:org.bouncycastle/bcprov-jdk15on/{{VERSION}}</bundle>
     <bundle>mvn:org.apache.sshd/sshd-core/{{VERSION}}</bundle>
     <bundle>mvn:openexi/nagasena/{{VERSION}}</bundle>
     <bundle>mvn:io.netty/netty-codec/{{VERSION}}</bundle>
index fa4c63882c97f3f93124b264aea2e78ea34175ce..d130180040ce8048b0015ab189f71ed9f336d6b0 100644 (file)
     <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>
-    <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
     <surefire.version>2.15</surefire.version>
+    <yangtools.version>0.8.0-SNAPSHOT</yangtools.version>
 
     <features.file>features.xml</features.file>
     <config.configfile.directory>etc/opendaylight/karaf</config.configfile.directory>
     </dependency>
     <dependency>
       <groupId>org.opendaylight.aaa</groupId>
-      <artifactId>features-aaa</artifactId>
+      <artifactId>features-aaa-shiro</artifactId>
       <version>${aaa.version}</version>
       <classifier>features</classifier>
       <type>xml</type>
     </dependency>
-
     <dependency>
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-remote</artifactId>
     <dependency>
       <groupId>com.sun.jersey</groupId>
       <artifactId>jersey-core</artifactId>
-      <version>${jersey.version}</version>
     </dependency>
     <dependency>
       <groupId>com.sun.jersey</groupId>
       <artifactId>jersey-server</artifactId>
-      <version>${jersey.version}</version>
     </dependency>
     <dependency>
       <groupId>com.sun.jersey</groupId>
       <artifactId>jersey-servlet</artifactId>
-      <version>${jersey.version}</version>
     </dependency>
     <dependency>
       <groupId>io.netty</groupId>
index 10060895fe0230b47dbda2492d66a686f2b1e9c5..2ede2bc45a21d2aa6bad2bcdbd88dc9fa8589030 100644 (file)
 
     <repository>mvn:org.opendaylight.controller/features-mdsal/{{VERSION}}/xml/features</repository>
     <repository>mvn:org.opendaylight.yangtools/features-yangtools/{{VERSION}}/xml/features</repository>
-    <repository>mvn:org.opendaylight.aaa/features-aaa/{{VERSION}}/xml/features</repository>
+    <repository>mvn:org.opendaylight.aaa/features-aaa-shiro/{{VERSION}}/xml/features</repository>
     <feature name='odl-restconf-all' version='${project.version}' description='OpenDaylight :: Restconf :: All'>
         <feature version='${project.version}'>odl-restconf</feature>
         <feature version='${project.version}'>odl-mdsal-apidocs</feature>
     </feature>
 
     <feature name='odl-restconf' version='${project.version}' description="OpenDaylight :: Restconf">
-        <feature version='${aaa.version}'>odl-aaa-authn</feature>
+        <!-- Enables AAA through the odl-shiro-act bundle Activator -->
+        <bundle>mvn:org.opendaylight.aaa/aaa-shiro-act/{{VERSION}}</bundle>
         <feature version='${project.version}'>odl-restconf-noauth</feature>
     </feature>
     <feature name='odl-restconf-noauth' version='${project.version}' description="OpenDaylight :: Restconf">
+        <feature version='${aaa.version}'>odl-aaa-shiro</feature>
         <feature version='${controller.mdsal.version}'>odl-mdsal-broker</feature>
         <feature>war</feature>
         <!-- presently we need sal-remote to be listed BEFORE sal-rest-connector because sal-rest-connector
index 1c8d94438e0f39963233214400d006ccc40d68e5..456fde49266c44f759073662ca801c081cf57ea8 100644 (file)
@@ -103,15 +103,13 @@ module ietf-netconf-notifications {
          of the session that made the change will be reported.";
       choice server-or-user {
         mandatory true;
-        //FIXME: After Bug 4414 is resolved, use shorthand version of case statement
-        case server {
-          leaf server {
-            type empty;
-            description
+        leaf server {
+          type empty;
+          description
             "If present, the change was caused
-            by the server.";
-          }
+             by the server.";
         }
+
         case by-user {
           uses common-session-parms;
         }
index 8ef49f3511a555073f421304ffb40c0dc2d9d51f..7985eef925204e3656fc75698cbaaf3081141dea 100644 (file)
@@ -132,6 +132,9 @@ public class Parameters {
         Preconditions.checkArgument(editContent.exists(), "Edit content file missing");
         Preconditions.checkArgument(editContent.isDirectory() == false, "Edit content file is a dir");
         Preconditions.checkArgument(editContent.canRead(), "Edit content file is unreadable");
+
+        Preconditions.checkArgument(destination.startsWith("/"), "Destination should start with a '/'");
+
         // TODO validate
     }
 
index 41d746284b07d603298980dd2df67396c6368341..31dc585104aa7bab90483220e91c2f3d6bc7b16d 100644 (file)
       <groupId>org.opendaylight.controller</groupId>
       <artifactId>sal-remote</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.yangtools</groupId>
+      <artifactId>yang-data-api</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.yangtools</groupId>
       <artifactId>yang-data-impl</artifactId>
       <artifactId>logback-classic</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>com.sun.jersey</groupId>
+      <artifactId>jersey-server</artifactId>
+    </dependency>
 
     <!-- Testing Dependencies -->
     <dependency>
 
   <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <configuration>
+          <classpathDependencyExcludes>
+            <!-- Removes com.sun.jersey from testing classpath so there is no conflict with org.glassfish.jersey -->
+            <classpathDependencyExclude>com.sun.jersey</classpathDependencyExclude>
+          </classpathDependencyExcludes>
+        </configuration>
+      </plugin>
       <plugin>
         <groupId>org.apache.felix</groupId>
         <artifactId>maven-bundle-plugin</artifactId>
               org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.md.sal.rest.connector.rev140724.*,
             </Private-Package>
             <Import-Package>
-              com.sun.jersey.spi.container.servlet, org.eclipse.jetty.servlets,
-              <!-- Set the javax packages version to 0. Relying on "*" includes versions from jsr305 dependency whic are
-              incompatible with karaf provided packages -->
-              javax.*;version="0.0",
               *,
+              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>
             <Embed-Dependency>stax-utils</Embed-Dependency>
             <Web-ContextPath>/restconf</Web-ContextPath>
index 22dabf42efbd20ebd8d2fba6ee5cc0d65a12b9ef..6cdb33bf8cfc7a4edfb36c1aef39dabbf08b12dc 100644 (file)
@@ -37,7 +37,6 @@ import org.opendaylight.netconf.sal.restconf.impl.NormalizedNodeContext;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfDocumentedException;
 import org.opendaylight.netconf.sal.restconf.impl.RestconfError;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.AugmentationIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
@@ -46,6 +45,7 @@ import org.opendaylight.yangtools.yang.data.api.schema.DataContainerChild;
 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.ForwardingNormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeStreamWriter;
 import org.opendaylight.yangtools.yang.data.api.schema.stream.NormalizedNodeWriter;
 import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactory;
@@ -239,7 +239,12 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
         // stream writer validates the node type against the schema and thus will expect a LeafSchemaNode but
         // the schema has a ContainerSchemaNode so, to avoid an error, we override the leafNode behavior
         // for error-info.
-        final NormalizedNodeStreamWriter streamWriter = new DelegatingNormalizedNodeStreamWriter(jsonStreamWriter) {
+        final NormalizedNodeStreamWriter streamWriter = new ForwardingNormalizedNodeStreamWriter() {
+            @Override
+            protected NormalizedNodeStreamWriter delegate() {
+                return jsonStreamWriter;
+            }
+
             @Override
             public void leafNode(final NodeIdentifier name, final Object value) throws IOException {
                 if(name.getNodeType().equals(Draft02.RestConfModule.ERROR_INFO_QNAME)) {
@@ -301,7 +306,12 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
         // stream writer validates the node type against the schema and thus will expect a LeafSchemaNode but
         // the schema has a ContainerSchemaNode so, to avoid an error, we override the leafNode behavior
         // for error-info.
-        final NormalizedNodeStreamWriter streamWriter = new DelegatingNormalizedNodeStreamWriter(xmlStreamWriter) {
+        final NormalizedNodeStreamWriter streamWriter = new ForwardingNormalizedNodeStreamWriter() {
+            @Override
+            protected NormalizedNodeStreamWriter delegate() {
+                return xmlStreamWriter;
+            }
+
             @Override
             public void leafNode(final NodeIdentifier name, final Object value) throws IOException {
                 if(name.getNodeType().equals(Draft02.RestConfModule.ERROR_INFO_QNAME)) {
@@ -365,99 +375,4 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco
             nnWriter.flush();
         }
     }
-
-    private static class DelegatingNormalizedNodeStreamWriter implements NormalizedNodeStreamWriter {
-        private final NormalizedNodeStreamWriter delegate;
-
-        DelegatingNormalizedNodeStreamWriter(NormalizedNodeStreamWriter delegate) {
-            this.delegate = delegate;
-        }
-
-        @Override
-        public void leafNode(NodeIdentifier name, Object value) throws IOException, IllegalArgumentException {
-            delegate.leafNode(name, value);
-        }
-
-        @Override
-        public void startLeafSet(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException {
-            delegate.startLeafSet(name, childSizeHint);
-        }
-
-        @Override
-        public void leafSetEntryNode(Object value) throws IOException, IllegalArgumentException {
-            delegate.leafSetEntryNode(value);
-        }
-
-        @Override
-        public void startContainerNode(NodeIdentifier name, int childSizeHint) throws IOException,
-                IllegalArgumentException {
-            delegate.startContainerNode(name, childSizeHint);
-        }
-
-        @Override
-        public void startUnkeyedList(NodeIdentifier name, int childSizeHint) throws IOException,
-                IllegalArgumentException {
-            delegate.startUnkeyedList(name, childSizeHint);
-        }
-
-        @Override
-        public void startUnkeyedListItem(NodeIdentifier name, int childSizeHint) throws IOException,
-                IllegalStateException {
-            delegate.startUnkeyedListItem(name, childSizeHint);
-        }
-
-        @Override
-        public void startMapNode(NodeIdentifier name, int childSizeHint) throws IOException, IllegalArgumentException {
-            delegate.startMapNode(name, childSizeHint);
-        }
-
-        @Override
-        public void startMapEntryNode(NodeIdentifierWithPredicates identifier, int childSizeHint) throws IOException,
-                IllegalArgumentException {
-            delegate.startMapEntryNode(identifier, childSizeHint);
-        }
-
-        @Override
-        public void startOrderedMapNode(NodeIdentifier name, int childSizeHint) throws IOException,
-                IllegalArgumentException {
-            delegate.startOrderedMapNode(name, childSizeHint);
-        }
-
-        @Override
-        public void startChoiceNode(NodeIdentifier name, int childSizeHint) throws IOException,
-                IllegalArgumentException {
-            delegate.startChoiceNode(name, childSizeHint);
-        }
-
-        @Override
-        public void startAugmentationNode(AugmentationIdentifier identifier) throws IOException,
-                IllegalArgumentException {
-            delegate.startAugmentationNode(identifier);
-        }
-
-        @Override
-        public void anyxmlNode(NodeIdentifier name, Object value) throws IOException, IllegalArgumentException {
-            delegate.anyxmlNode(name, value);
-        }
-
-        @Override
-        public void startYangModeledAnyXmlNode(NodeIdentifier name, int childSizeHint) throws IOException {
-            delegate.startYangModeledAnyXmlNode(name, childSizeHint);
-        }
-
-        @Override
-        public void endNode() throws IOException, IllegalStateException {
-            delegate.endNode();
-        }
-
-        @Override
-        public void close() throws IOException {
-            delegate.close();
-        }
-
-        @Override
-        public void flush() throws IOException {
-            delegate.flush();
-        }
-    }
 }
index 66cadd0cbce4ea9db0f9f83c67b52280c515b4bf..493572952598594c7cb32d0e80b3cab03c8ad461 100644 (file)
             <param-name>javax.ws.rs.Application</param-name>
             <param-value>org.opendaylight.netconf.sal.rest.impl.RestconfApplication</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>JAXRSRestconf</servlet-name>
         <url-pattern>/*</url-pattern>