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>
</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>
<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>
</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>
<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.
--- /dev/null
+<?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>
<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>
<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>
<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