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

Odl mri scandium sr1 #2075

Merged
merged 4 commits into from
Nov 13, 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
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,11 @@ private ConverterUtils() {
* Returns the {@link RpcDefinition} from the given {@link EffectiveModelContext} and given {@link QName}.
* The {@link QName} of a rpc can be constructed via
*
* <p>
* {@code
* <p>{@code
* QName.create("http://netconfcentral.org/ns/toaster", "2009-11-20", "make-toast");
* } , where {@code "make-toast"} is the name of the RPC given in the yang model.
*
* <p>
* If the given RPC was found in the {@link EffectiveModelContext} the {@link RpcDefinition} will be returned
* <p>If the given RPC was found in the {@link EffectiveModelContext} the {@link RpcDefinition} will be returned
*
* @param effectiveModelContext the effective model context used for the RPC resolution
* @param rpcQName {@link QName} of the RPC
Expand Down Expand Up @@ -175,8 +173,7 @@ public static XmlElement rpcAsOutput(final XmlElement inputXmlElement, final Str
/**
* Finds the {@link DataSchemaContext} for the given {@link QName} in {@link EffectiveModelContext}.
*
* <p>
* Search is performed only on first level nodes of the modules, for recursive search,
* <p>Search is performed only on first level nodes of the modules, for recursive search,
* the {@link YangInstanceIdentifier} is needed, thus consider using
* {@link ConverterUtils#getSchemaNode(EffectiveModelContext, YangInstanceIdentifier)}.
*
Expand Down Expand Up @@ -206,8 +203,7 @@ public static XmlElement rpcAsOutput(final XmlElement inputXmlElement, final Str
* Finds the {@link DataSchemaContext} for the given namespace, revision and local name
* in {@link EffectiveModelContext}.
*
* <p>
* Search is performed only on first level nodes of the modules, for recursive search,
* <p>Search is performed only on first level nodes of the modules, for recursive search,
* the {@link YangInstanceIdentifier} is needed, thus consider using
* {@link ConverterUtils#getSchemaNode(EffectiveModelContext, YangInstanceIdentifier)}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,9 @@ public class JsonNodeConverter implements NodeConverter {
* This constructor will create an instance of {@link JsonNodeConverter} with the given
* {@link EffectiveModelContext}.
*
* <p>
* The effective model context will be used for proper RPC and Node resolution.
* <p>The effective model context will be used for proper RPC and Node resolution.
*
* <p>
* The {@code JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02} will be used for JSON
* <p>The {@code JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02} will be used for JSON
* serialization/deserialization of data.
*
* @param effectiveModelContext initial effective model context
Expand All @@ -69,11 +67,9 @@ public JsonNodeConverter(final EffectiveModelContext effectiveModelContext) {
* This constructor will create an instance of {@link JsonNodeConverter} with the given
* {@link EffectiveModelContext} and customizable {@link JSONCodecFactorySupplier}.
*
* <p>
* The effective model context will be used for proper RPC and Node resolution.
* <p>The effective model context will be used for proper RPC and Node resolution.
*
* <p>
* The {@code JSONCodecFactorySupplier} instance will be used for JSON serialization/deserialization of data.
* <p>The {@code JSONCodecFactorySupplier} instance will be used for JSON serialization/deserialization of data.
*
* @param effectiveModelContext initial effective model context
* @param jsonCodecFactorySupplier JSON codec factory supplier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,7 @@ public Writer serializeRpc(final Inference inference, final NormalizedNode norma
/**
* Deserializes a given XML input data into {@link NormalizedNode}.
*
* <p>
* In the case of deserializing multiple top level list entries, entries are expected to be wrapped in
* <p>In the case of deserializing multiple top level list entries, entries are expected to be wrapped in
* {@code <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">}.
*
* @param inference {@link Inference} pointing to a node we are trying to deserialize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
* {@link LightyController} shutdown process. This configuration initializes all core lighty.io services as spring
* beans.
*
* <p>
* Example:
* <p>Example:
* <pre>
* &#64;Configuration
* public class LightyConfiguration extends LightyCoreSprigConfiguration {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
* {@link AbstractLightyModule#startBlocking()} and
* {@link AbstractLightyModule#shutdown()} methods.
*
* <p>
* <b>Example usage:</b>
* <p><b>Example usage:</b>
* <pre>
* <code>
* public class MyLightyModule extends AbstractLightyModule {
Expand Down Expand Up @@ -212,8 +211,7 @@ public final boolean shutdown(final long duration, final TimeUnit unit) {
/**
* Invoke blocking shutdown after blocking start.
*
* <p>
* Release CountDownLatch locking this thread and shutdown.
* <p>Release CountDownLatch locking this thread and shutdown.
* @param duration duration to wait for shutdown to complete
* @param unit {@link TimeUnit} of {@code duration}
* @return {@code boolean} indicating shutdown sucess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,9 @@ public static void importConfigDataFile(final InputStream inputStream,
/**
* Writes/merges input stream containing serialized normalized node data into config datastore.
*
* <p>
* Node is written at root node, that means only top level nodes are supported.
* <p>Node is written at root node, that means only top level nodes are supported.
*
* <p>
* In the case of importing XML file, node needs to be wrapped in
* <p>In the case of importing XML file, node needs to be wrapped in
* {@code <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">} element.
*
* @param inputStream stream of serialized node to deserialize
Expand Down
6 changes: 3 additions & 3 deletions lighty-core/lighty-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<!-- This should match the dependency management on com.puppycrawl.tools:checkstyle above -->
<version>10.18.1</version>
<version>10.18.2</version>
</dependency>
<dependency>
<groupId>com.github.sevntu-checkstyle</groupId>
Expand All @@ -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