neutron now works with jetty 46/13546/7
authorEd Warnicke <eaw@cisco.com>
Wed, 10 Dec 2014 16:55:24 +0000 (10:55 -0600)
committerEd Warnicke <eaw@cisco.com>
Tue, 3 Feb 2015 20:20:43 +0000 (13:20 -0700)
This patch makes the feature neutron-northbound work with
jetty.

It also moves the adsal to port 8282, and the stock
karaf jetty to port 8080 (in additional to 8181).

GET, POST, and PUT for neutron network has been
tested:

GET:

curl -u admin:admin http://127.0.0.1:8080/controller/nb/v2/neutron/networks

POST:

curl -u admin:admin -H "Content-Type: application/json" -d @network.post http://127.0.0.1:8080/controller/nb/v2/neutron/networks

PUT:

curl -u admin:admin -H "Content-Type: application/json" -d @network2.post -X PUT  http://127.0.0.1:8080/controller/nb/v2/neutron/networks/d6220bbb-35f3-48ab-8eae-69c60aef3544

where:

cat network.post
{"network": {"status": "ACTIVE", "subnets": [], "name": "net-dedicated", "provider:physical_network": null, "admin_state_up": true, "tenant_id": "aa902936679e4ea29bfe1158e3450a13", "provider:network_type": "gre", "router:external": false, "shared": false, "id": "d6220bbb-35f3-48ab-8eae-69c60aef3544", "provider:segmentation_id": 1}}

cat network2.post
{"network": {"subnets": [], "name": "net-dedicated", "provider:physical_network": null, "admin_state_up": true, "provider:network_type": "gre", "router:external": true, "shared": false, "provider:segmentation_id": 1}}

This patch should not be merged before 2/1/2015 to allow time for discussion.

Change-Id: I6a003c2868adc5b060f05d228a56a744c092e963
Signed-off-by: Ed Warnicke <eaw@cisco.com>
features/neutron/pom.xml
features/neutron/src/main/resources/features.xml
karaf/opendaylight-karaf-resources/src/main/resources/configuration/tomcat-server.xml
karaf/opendaylight-karaf-resources/src/main/resources/etc/jetty.xml [new file with mode: 0644]
karaf/opendaylight-karaf/pom.xml
opendaylight/commons/opendaylight/pom.xml
opendaylight/networkconfiguration/neutron/northbound/src/main/resources/WEB-INF/web.xml

index 642ce98..cd7dce5 100644 (file)
   </properties>
 
   <dependencies>
+    <dependency>
+      <groupId>org.opendaylight.aaa</groupId>
+      <artifactId>features-aaa</artifactId>
+      <version>${aaa.version}</version>
+      <classifier>features</classifier>
+      <type>xml</type>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>networkconfig.neutron</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.osgi</groupId>
       <artifactId>org.osgi.core</artifactId>
index 263f907..b244d4d 100644 (file)
@@ -3,15 +3,19 @@
 <features name="odl-neutron-${networkconfig.neutron.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0 http://karaf.apache.org/xmlns/features/v1.2.0">
+   <repository>mvn:org.opendaylight.aaa/features-aaa/${aaa.version}/xml/features</repository>
    <feature name='odl-neutron-all' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: API">
     <feature version='${networkconfig.neutron.version}'>odl-neutron-api</feature>
     <feature version='${networkconfig.neutron.version}'>odl-neutron-northbound</feature>
     <feature version='${networkconfig.neutron.version}'>odl-neutron-implementation</feature>
   </feature>
   <feature name='odl-neutron-northbound' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: Northbound">
+    <feature version='${aaa.version}'>odl-aaa-authn</feature>
+    <feature>war</feature>
     <feature version='${networkconfig.neutron.version}'>odl-neutron-api</feature>
     <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.moxy/${eclipse.persistence.version}</bundle>
     <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.core/${eclipse.persistence.version}</bundle>
+    <bundle>mvn:org.eclipse.persistence/org.eclipse.persistence.antlr/${eclipse.persistence.version}</bundle>
     <bundle>mvn:org.opendaylight.controller/networkconfig.neutron.northbound/${networkconfig.neutron.northbound.version}</bundle>
     <bundle>mvn:com.sun.jersey/jersey-core/${jersey.version}</bundle>
     <bundle>mvn:com.sun.jersey/jersey-server/${jersey.version}</bundle>
@@ -26,7 +30,8 @@
   </feature>
   <feature name='odl-neutron-implementation' version='${networkconfig.neutron.version}' description="OpenDaylight :: Neutron :: Implementation">
     <feature version='${networkconfig.neutron.version}'>odl-neutron-api</feature>
+    <feature>war</feature>
     <bundle>mvn:org.opendaylight.controller/networkconfig.neutron.implementation/${networkconfig.neutron.implementation.version}</bundle>
     <bundle>mvn:org.osgi/org.osgi.core/${osgi.core.version}</bundle>
   </feature>
-</features>
\ No newline at end of file
+</features>
index fbcd0a4..5092a5e 100644 (file)
@@ -26,9 +26,9 @@
   <Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />
 
   <Service name="Catalina">
-    <Connector port="8080" protocol="HTTP/1.1"
+    <Connector port="8282" protocol="HTTP/1.1"
                connectionTimeout="20000"
-               redirectPort="8443" />
+               redirectPort="8663" />
 
 <!--
         Please remove the comments around the following Connector tag to enable HTTPS Authentication support.
diff --git a/karaf/opendaylight-karaf-resources/src/main/resources/etc/jetty.xml b/karaf/opendaylight-karaf-resources/src/main/resources/etc/jetty.xml
new file mode 100644 (file)
index 0000000..064e8a8
--- /dev/null
@@ -0,0 +1,106 @@
+<?xml version="1.0"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//
+DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">
+
+<Configure class="org.eclipse.jetty.server.Server">
+
+    <!-- =========================================================== -->
+    <!-- Set connectors -->
+    <!-- =========================================================== -->
+    <!-- One of each type! -->
+    <!-- =========================================================== -->
+
+    <!-- Use this connector for many frequently idle connections and for
+        threadless continuations. -->
+    <Call name="addConnector">
+        <Arg>
+            <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
+                <Set name="host">
+                    <Property name="jetty.host" />
+                </Set>
+                <Set name="port">
+                    <Property name="jetty.port" default="8181" />
+                </Set>
+                <Set name="maxIdleTime">300000</Set>
+                <Set name="Acceptors">2</Set>
+                <Set name="statsOn">false</Set>
+                <Set name="confidentialPort">8543</Set>
+                <Set name="lowResourcesConnections">20000</Set>
+                <Set name="lowResourcesMaxIdleTime">5000</Set>
+            </New>
+        </Arg>
+    </Call>
+    <Call name="addConnector">
+      <Arg>
+        <New class="org.eclipse.jetty.server.nio.SelectChannelConnector">
+          <Set name="host">
+            <Property name="jetty.host" />
+          </Set>
+          <Set name="port">
+            <Property name="jetty.port" default="8080" />
+          </Set>
+          <Set name="maxIdleTime">300000</Set>
+          <Set name="Acceptors">2</Set>
+          <Set name="statsOn">false</Set>
+          <Set name="confidentialPort">8443</Set>
+          <Set name="lowResourcesConnections">20000</Set>
+          <Set name="lowResourcesMaxIdleTime">5000</Set>
+        </New>
+      </Arg>
+    </Call>
+
+    <!-- =========================================================== -->
+    <!-- Configure Authentication Realms -->
+    <!-- Realms may be configured for the entire server here, or -->
+    <!-- they can be configured for a specific web app in a context -->
+    <!-- configuration (see $(jetty.home)/contexts/test.xml for an -->
+    <!-- example). -->
+    <!-- =========================================================== -->
+    <Call name="addBean">
+        <Arg>
+            <New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
+                <Set name="name">karaf</Set>
+                <Set name="loginModuleName">karaf</Set>
+                <Set name="roleClassNames">
+                    <Array type="java.lang.String">
+                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
+                        </Item>
+                    </Array>
+                </Set>
+            </New>
+        </Arg>
+    </Call>
+    <Call name="addBean">
+        <Arg>
+            <New class="org.eclipse.jetty.plus.jaas.JAASLoginService">
+                <Set name="name">default</Set>
+                <Set name="loginModuleName">karaf</Set>
+                <Set name="roleClassNames">
+                    <Array type="java.lang.String">
+                        <Item>org.apache.karaf.jaas.boot.principal.RolePrincipal
+                        </Item>
+                    </Array>
+                </Set>
+            </New>
+        </Arg>
+    </Call>
+
+</Configure>
index e0ea4c0..9bf2309 100644 (file)
       <type>xml</type>
     </dependency>
 
+    <dependency>
+      <groupId>org.opendaylight.controller</groupId>
+      <artifactId>features-neutron</artifactId>
+      <classifier>features</classifier>
+      <type>xml</type>
+      <scope>runtime</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
index 32aa9a3..ba5d69a 100644 (file)
         <scope>runtime</scope>
       </dependency>
 
+      <dependency>
+        <groupId>org.opendaylight.controller</groupId>
+        <artifactId>features-neutron</artifactId>
+        <classifier>features</classifier>
+        <type>xml</type>
+        <scope>runtime</scope>
+        <version>${networkconfig.neutron.version}</version>
+      </dependency>
+
       <!-- JMH Benchmark dependencies -->
       <dependency>
         <groupId>org.openjdk.jmh</groupId>
index dccd133..08a314a 100644 (file)
@@ -9,6 +9,11 @@
       <param-name>javax.ws.rs.Application</param-name>\r
       <param-value>org.opendaylight.controller.networkconfig.neutron.northbound.NeutronNorthboundRSApplication</param-value>\r
     </init-param>\r
+    <!-- AAA Auth Filter -->\r
+    <init-param>\r
+      <param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>\r
+      <param-value> org.opendaylight.aaa.sts.TokenAuthFilter</param-value>\r
+    </init-param>\r
     <load-on-startup>1</load-on-startup>\r
   </servlet>\r
 \r
     <servlet-name>JAXRSNeutron</servlet-name>\r
     <url-pattern>/*</url-pattern>\r
   </servlet-mapping>\r
-        <security-constraint>\r
-                <web-resource-collection>\r
-                        <web-resource-name>NB api</web-resource-name>\r
-                        <url-pattern>/*</url-pattern>\r
-                </web-resource-collection>\r
-                <auth-constraint>\r
-                        <role-name>System-Admin</role-name>\r
-                        <role-name>Network-Admin</role-name>\r
-                        <role-name>Network-Operator</role-name>\r
-                        <role-name>Container-User</role-name>\r
-                </auth-constraint>\r
-        </security-constraint>\r
-\r
-        <security-role>\r
-                <role-name>System-Admin</role-name>\r
-        </security-role>\r
-        <security-role>\r
-                <role-name>Network-Admin</role-name>\r
-        </security-role>\r
-        <security-role>\r
-                <role-name>Network-Operator</role-name>\r
-        </security-role>\r
-        <security-role>\r
-                <role-name>Container-User</role-name>\r
-        </security-role>\r
 \r
-        <login-config>\r
-                <auth-method>BASIC</auth-method>\r
-                <realm-name>opendaylight</realm-name>\r
-        </login-config>\r
+  <filter>\r
+    <filter-name>cross-origin-restconf</filter-name>\r
+    <filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>\r
+    <init-param>\r
+      <param-name>allowedOrigins</param-name>\r
+      <param-value>*</param-value>\r
+    </init-param>\r
+    <init-param>\r
+      <param-name>allowedMethods</param-name>\r
+      <param-value>GET,POST,OPTIONS,DELETE,PUT,HEAD</param-value>\r
+    </init-param>\r
+    <init-param>\r
+      <param-name>allowedHeaders</param-name>\r
+      <param-value>origin, content-type, accept, authorization</param-value>\r
+    </init-param>\r
+  </filter>\r
+  <filter-mapping>\r
+    <filter-name>cross-origin-restconf</filter-name>\r
+    <url-pattern>/*</url-pattern>\r
+  </filter-mapping>\r
+  <security-constraint>\r
+    <web-resource-collection>\r
+      <web-resource-name>NB api</web-resource-name>\r
+      <url-pattern>/*</url-pattern>\r
+      <http-method>POST</http-method>\r
+      <http-method>GET</http-method>\r
+      <http-method>PUT</http-method>\r
+      <http-method>PATCH</http-method>\r
+      <http-method>DELETE</http-method>\r
+      <http-method>HEAD</http-method>\r
+    </web-resource-collection>\r
+  </security-constraint>\r
 </web-app>\r

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.