Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt 21.1.0 ODL MRI versions #2068

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lighty-core/dependency-versions/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<dependency>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent</artifactId>
<version>14.0.3</version>
<version>14.0.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -34,49 +34,49 @@
<dependency>
<groupId>org.opendaylight.aaa</groupId>
<artifactId>aaa-artifacts</artifactId>
<version>0.20.1</version>
<version>0.20.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>controller-artifacts</artifactId>
<version>10.0.2</version>
<version>10.0.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
<artifactId>infrautils-artifacts</artifactId>
<version>7.0.3</version>
<version>7.0.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
<version>14.0.2</version>
<version>14.0.4</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
<version>8.0.2</version>
<version>8.0.3</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yangtools-artifacts</artifactId>
<version>14.0.4</version>
<version>14.0.5</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.bgpcep</groupId>
<artifactId>bgpcep-artifacts</artifactId>
<version>0.22.4</version>
<version>0.22.6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
4 changes: 2 additions & 2 deletions lighty-core/lighty-binding-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@
<plugin>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-maven-plugin</artifactId>
<version>14.0.4</version>
<version>14.0.5</version>
<dependencies>
<dependency>
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>binding-codegen</artifactId>
<version>14.0.4</version>
<version>14.0.5</version>
</dependency>
</dependencies>
<executions>
Expand Down
4 changes: 2 additions & 2 deletions lighty-core/lighty-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
<dependency>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>checkstyle</artifactId>
<version>14.0.3</version>
<version>14.0.4</version>
</dependency>
</dependencies>
</plugin>
Expand All @@ -220,7 +220,7 @@
<dependency>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>spotbugs</artifactId>
<version>14.0.3</version>
<version>14.0.4</version>
</dependency>
<!-- The SpotBugs Maven plugin uses SLF4J-2 -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev240611.credentials.credentials.LoginPwUnencryptedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev240611.credentials.credentials.login.pw.unencrypted.LoginPasswordUnencryptedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev241009.credentials.credentials.LoginPwUnencryptedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev241009.credentials.credentials.login.pw.unencrypted.LoginPasswordUnencryptedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev240911.NetconfNodeAugmentBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev240911.netconf.node.augment.NetconfNodeBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev240611.ConnectionOper.ConnectionStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev241009.ConnectionOper.ConnectionStatus;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev240911.NetconfNodeAugment;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev240611.credentials.Credentials;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev240611.credentials.credentials.LoginPwUnencryptedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev240611.credentials.credentials.login.pw.unencrypted.LoginPasswordUnencryptedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev241009.credentials.Credentials;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev241009.credentials.credentials.LoginPwUnencryptedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.device.rev241009.credentials.credentials.login.pw.unencrypted.LoginPasswordUnencryptedBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev240911.NetconfNodeAugment;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev240911.NetconfNodeAugmentBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netconf.node.topology.rev240911.netconf.node.augment.NetconfNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/
package io.lighty.openapi;

import com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider;
import com.fasterxml.jackson.core.JsonFactoryBuilder;
import com.google.common.annotations.VisibleForTesting;
import io.lighty.core.controller.api.AbstractLightyModule;
import io.lighty.core.controller.api.LightyServices;
Expand All @@ -21,8 +21,9 @@
import org.eclipse.jetty.servlet.ServletHolder;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletContainer;
import org.opendaylight.restconf.openapi.api.OpenApiService;
import org.opendaylight.restconf.openapi.impl.OpenApiServiceImpl;
import org.opendaylight.restconf.openapi.jaxrs.JaxRsOpenApi;
import org.opendaylight.restconf.openapi.jaxrs.OpenApiBodyWriter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -40,7 +41,7 @@ public class OpenApiLighty extends AbstractLightyModule {
private final LightyServerBuilder jettyServerBuilder;
private final LightyServices lightyServices;

private OpenApiService apiDocService;
private JaxRsOpenApi jaxRsOpenApi;

public OpenApiLighty(RestConfConfiguration restConfConfiguration,
LightyServerBuilder jettyServerBuilder, LightyServices lightyServices) {
Expand All @@ -57,14 +58,17 @@ protected boolean initProcedure() {
String basePathString = restConfConfiguration.getRestconfServletContextPath().replaceAll("^/+", "");
LOG.info("basePath: {}", basePathString);

this.apiDocService = new OpenApiServiceImpl(lightyServices.getDOMSchemaService(),
lightyServices.getDOMMountPointService(), lightyServices.getJaxRsEndpoint());
final var openApiService = new OpenApiServiceImpl(lightyServices.getDOMSchemaService(),
lightyServices.getDOMMountPointService(), lightyServices.getJaxRsEndpoint());

this.jaxRsOpenApi = new JaxRsOpenApi(openApiService);

final ServletContainer restServletContainer = new ServletContainer(ResourceConfig
.forApplication((new Application() {
@Override
public Set<Object> getSingletons() {
return Set.of(apiDocService, new JacksonJaxbJsonProvider());
return Set.of(new JaxRsOpenApi(openApiService),
new OpenApiBodyWriter(new JsonFactoryBuilder().build()));
}
})));

Expand Down Expand Up @@ -100,7 +104,7 @@ private void addStaticResources(ServletContextHandler mainHandler, String path,
}

@VisibleForTesting
OpenApiService getApiDocService() {
return apiDocService;
JaxRsOpenApi getJaxRsOpenApi() {
return jaxRsOpenApi;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ public void simpleOpenApiModuleTest() {
}

public void testGetListOfMounts(UriInfo uriInfo) {
assertSuccessResponse(getOpenApiModule().getApiDocService().getListOfMounts(uriInfo));
assertSuccessResponse(getOpenApiModule().getJaxRsOpenApi().getListOfMounts(uriInfo));
}

public void testGetAllModulesDoc(UriInfo uriInfo) throws IOException {
assertSuccessResponse(getOpenApiModule().getApiDocService().getAllModulesDoc(uriInfo, 0, 0, 0, 0));
assertSuccessResponse(getOpenApiModule().getJaxRsOpenApi().getAllModulesDoc(uriInfo, 0, 0, 0, 0));
}

public void testGetDocByModule(UriInfo uriInfo, String modelName, String revisionDate) throws IOException {
assertSuccessResponse(
getOpenApiModule().getApiDocService().getDocByModule(modelName, revisionDate, uriInfo, 0, 0));
getOpenApiModule().getJaxRsOpenApi().getDocByModule(modelName, revisionDate, uriInfo, 0, 0));
}

public void testGetApiExplorer(UriInfo uriInfo) {
final Response response = getOpenApiModule().getApiDocService().getApiExplorer(uriInfo);
final Response response = getOpenApiModule().getJaxRsOpenApi().getApiExplorer(uriInfo);

final int redirectCode = 303;
Assert.assertEquals(response.getStatus(), redirectCode);
Expand All @@ -58,7 +58,7 @@ protected UriInfo mockUriInfo(String path) {
Mockito.when(uriInfo.getAbsolutePath()).thenReturn(absolutePathUri);
Mockito.when(uriInfo.getBaseUri()).thenReturn(URI.create(path));
Mockito.when(uriInfo.getBaseUriBuilder()).thenReturn(UriBuilder.fromPath(path));
Mockito.when(uriInfo.getRequestUriBuilder()).thenReturn(UriBuilder.fromUri(absolutePathUri));
Mockito.when(uriInfo.getRequestUri()).thenReturn(absolutePathUri);

return uriInfo;
}
Expand Down
Loading