* Extend OSGi bundle load timeout to 10 minutes.
* Added missing capabilities.
* Don't use AD-SAL northbound bundlescanner.
* AD-SAL bundlescanner is no longer available because of asm-all
version up.
* Extend heap size for test VM.
* Kill test VM after 20 minutes.
Change-Id: I95851181ad05f2e57c60714464877bba40977ba6
Signed-off-by: Shigeru Yasuda <s-yasuda@da.jp.nec.com>
<!-- Use checkstyle 6.5. -->
<checkstyle.engine.version>6.5</checkstyle.engine.version>
- <testvm.argLine>-Xmx1024m -XX:MaxPermSize=256m</testvm.argLine>
+ <testvm.argLine>-Xmx2048m -XX:MaxPermSize=1024m</testvm.argLine>
<!-- Karaf properties -->
<karaf.empty.version>1.6.0-SNAPSHOT</karaf.empty.version>
<artifactId>bundlescanner</artifactId>
<version>0.6.0-SNAPSHOT</version>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>bundlescanner.implementation</artifactId>
- <version>0.6.0-SNAPSHOT</version>
- </dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
in /tmp.
-->
<vtn.it.tmpdir>${project.build.directory}/it-tmp</vtn.it.tmpdir>
+
+ <!-- Kill test VM after 20 minutes. -->
+ <failsafe.timeout>1200</failsafe.timeout>
</properties>
<dependencies>
<groupId>org.opendaylight.controller</groupId>
<artifactId>bundlescanner</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.controller</groupId>
- <artifactId>bundlescanner.implementation</artifactId>
- </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>javax.servlet.jsp.jstl.impl</artifactId>
</dependency>
- <dependency>
- <groupId>org.ow2.asm</groupId>
- <artifactId>asm-all</artifactId>
- </dependency>
-
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.asm</artifactId>
import static org.ops4j.pax.exam.CoreOptions.frameworkProperty;
import static org.ops4j.pax.exam.CoreOptions.systemPackages;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
+import static org.ops4j.pax.exam.CoreOptions.systemTimeout;
import static org.ops4j.pax.exam.CoreOptions.workingDirectory;
import java.io.Closeable;
* </p>
*/
public final class TestOption {
+ /**
+ * The number of milliseconds to wait for the framework to start.
+ */
+ private static final int SYSTEM_TIMEOUT = 600000;
+
/**
* The size of internal buffer used by
* {@link #copyFile(InputStream, File)}.
// Set fail if unresolved bundle present.
systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
+ // Set system timeout.
+ systemTimeout(SYSTEM_TIMEOUT),
+
// Use own working directory in order to prevent from creating
// temporary files in /tmp.
workingDirectory(tmpPath),
mavenBundle(SPRING_FRAMEWORK_SECURITY, "spring-security-taglibs"),
// Miscellaneous.
- mavenBundle("org.ow2.asm", "asm-all"),
mavenBundle("org.ow2.chameleon.management", "chameleon-mbeans"),
mavenBundle("org.aopalliance", "com.springsource.org.aopalliance"),
mavenBundle("commons-io", "commons-io"),
mavenBundle(TestHelper.CONTROLLER, "usermanager.implementation"),
mavenBundle(TestHelper.CONTROLLER, "security").noStart(),
mavenBundle(TestHelper.CONTROLLER, "bundlescanner"),
- mavenBundle(TestHelper.CONTROLLER, "bundlescanner.implementation"),
mavenBundle(TestHelper.CONTROLLER, "commons.northbound"),
mavenBundle(CONTROLLER_THIRD_PARTY,
<capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:config-dom-store?module=opendaylight-config-dom-datastore&revision=2014-06-17</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:md:sal:core:spi:operational-dom-store?module=opendaylight-operational-dom-datastore&revision=2014-06-17</capability>
<capability>urn:opendaylight:params:xml:ns:yang:controller:inmemory-datastore-provider?module=opendaylight-inmemory-datastore-provider&revision=2014-06-17</capability>
+ <capability>urn:ietf:params:xml:ns:yang:rpc-context?module=rpc-context&revision=2013-06-17</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:config?module=config&revision=2013-04-05</capability>
+ <capability>urn:opendaylight:params:xml:ns:yang:controller:logback:config?module=config-logging&revision=2013-07-16</capability>
- <!-- Required YANG models: yangtools -->
+ <!-- Required YANG models: MD-SAL -->
<capability>urn:TBD:params:xml:ns:yang:network-topology?module=network-topology&revision=2013-10-21</capability>
<!-- Required YANG models: controller -->
/**
* The number of milliseconds to wait for OSGi service.
*/
- public static final long OSGI_TIMEOUT = 120000L;
+ public static final long OSGI_TIMEOUT = 600000L;
/**
* The number of milliseconds to sleep for short delay.
<Import-Package>
org.opendaylight.controller.northbound.commons,
org.opendaylight.controller.northbound.commons.exception,
+ org.opendaylight.controller.northbound.commons.query,
org.opendaylight.controller.northbound.commons.utils,
org.opendaylight.controller.sal.authorization,
org.opendaylight.controller.sal.core,
org.opendaylight.controller.sal.utils,
org.opendaylight.vtn.manager*,
org.opendaylight.yang.gen.v1.*,
+ com.fasterxml.jackson.core,
+ com.fasterxml.jackson.databind,
com.fasterxml.jackson.databind.annotation,
+ com.fasterxml.jackson.jaxrs.json,
com.sun.jersey.spi.container.servlet,
+ com.google.common.collect,
javax.ws.rs,
javax.ws.rs.core,
+ javax.ws.rs.ext,
+ javax.xml.bind,
javax.xml.bind.annotation,
org.apache.catalina.filters,
!org.codehaus.enunciate.jaxrs
</Import-Package>
<Web-ContextPath>/controller/nb/v2/vtn</Web-ContextPath>
- <Jaxrs-Resources>
- ,${classes;ANNOTATION;javax.ws.rs.Path}
- </Jaxrs-Resources>
</instructions>
</configuration>
</plugin>
<artifactId>jackson-databind</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>
+
<!-- Jackson JAXB support is used in unit tests. -->
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
--- /dev/null
+/*
+ * Copyright (c) 2015 NEC Corporation. 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.vtn.manager.northbound;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.ext.ExceptionMapper;
+import javax.ws.rs.ext.Provider;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+/**
+ * Exception mapper for handling Jackson exception.
+ */
+@Provider
+@Consumes(MediaType.APPLICATION_JSON)
+public final class JsonExceptionMapper
+ implements ExceptionMapper<JsonProcessingException> {
+ /**
+ * Convert the given Jackson exception to a REST response.
+ *
+ * @param e A {@link JsonProcessingException} exception.
+ * @return A {@link Response} instance.
+ */
+ @Override
+ public Response toResponse(JsonProcessingException e) {
+ String msg = e.getMessage();
+ GenericEntity<String> entity = new GenericEntity<String>(msg) {};
+ return Response.status(Response.Status.BAD_REQUEST).
+ entity(entity).build();
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 NEC Corporation. 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.vtn.manager.northbound;
+
+import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
+
+import java.util.Set;
+
+import javax.ws.rs.core.Application;
+
+import com.google.common.collect.ImmutableSet;
+
+import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
+
+import org.opendaylight.controller.northbound.commons.exception.GenericExceptionMapper;
+import org.opendaylight.controller.northbound.commons.query.QueryContextProvider;
+
+/**
+ * Describes JAX-RS application for VTN Manager.
+ */
+public final class VTNNorthboundApplication extends Application {
+ /**
+ * A set of root resource and provider instances.
+ */
+ private final Set<Object> providerInstances;
+
+ /**
+ * A set of provider classes.
+ */
+ private final Set<Class<?>> providerClasses;
+
+ /**
+ * Construct a new instance.
+ */
+ public VTNNorthboundApplication() {
+ JacksonJaxbJsonProvider jsonProvider = new JacksonJaxbJsonProvider();
+ jsonProvider.configure(FAIL_ON_UNKNOWN_PROPERTIES, false);
+ providerInstances = ImmutableSet.<Object>builder().
+ add(jsonProvider).
+ add(new JsonExceptionMapper()).
+ add(new QueryContextProvider()).
+ add(new GenericExceptionMapper()).
+ build();
+
+ providerClasses = ImmutableSet.<Class<?>>builder().
+ add(ContainerPathMapNorthbound.class).
+ add(FlowConditionNorthbound.class).
+ add(FlowNorthbound.class).
+ add(GlobalNorthbound.class).
+ add(MacMapNorthbound.class).
+ add(PathPolicyNorthbound.class).
+ add(VBridgeFlowFilterNorthbound.class).
+ add(VBridgeIfFlowFilterNorthbound.class).
+ add(VBridgeInterfaceNorthbound.class).
+ add(VBridgeNorthbound.class).
+ add(VTenantFlowFilterNorthbound.class).
+ add(VTenantNorthbound.class).
+ add(VTenantPathMapNorthbound.class).
+ add(VTerminalIfFlowFilterNorthbound.class).
+ add(VTerminalInterfaceNorthbound.class).
+ add(VTerminalNorthbound.class).
+ build();
+ }
+
+ /**
+ * Return a set of root resource and provider instances.
+ *
+ * @return A set of root resource and provider instances.
+ */
+ @Override
+ public Set<Object> getSingletons() {
+ return providerInstances;
+ }
+
+ /**
+ * Return a set of root resource and provider classes.
+ *
+ * @return A set of root resource and provider classes.
+ */
+ @Override
+ public Set<Class<?>> getClasses() {
+ return providerClasses;
+ }
+}
<!--
#
-# Copyright (c) 2013 NEC Corporation
-# All rights reserved.
+# Copyright (c) 2013, 2015 NEC Corporation. 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
+# terms of the Eclipse Public License v1.0 which accompanies this distribution,
+# and is available at http://www.eclipse.org/legal/epl-v10.html
#
-->
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>
- org.opendaylight.controller.northbound.commons.NorthboundApplication
+ org.opendaylight.vtn.manager.northbound.VTNNorthboundApplication
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>