diff options
5 files changed, 27 insertions, 21 deletions
diff --git a/openapi/components.yml b/openapi/components.yml index a339134e..3104a6dc 100644 --- a/openapi/components.yml +++ b/openapi/components.yml @@ -137,7 +137,6 @@ components: YangResources: type: array items: - type: object $ref: '#/components/schemas/YangResource' YangResource: @@ -173,6 +172,7 @@ components: cmHandleProperties: type: object + nullable: true additionalProperties: type: string example: {"prop1":"value1","prop2":"value2"} @@ -56,7 +56,7 @@ <dependency> <groupId>io.swagger.core.v3</groupId> <artifactId>swagger-annotations</artifactId> - <version>2.1.4</version> + <version>2.2.10</version> </dependency> <dependency> <groupId>net.logstash.logback</groupId> @@ -247,8 +247,9 @@ </resources> <plugins> <plugin> - <groupId>io.swagger.codegen.v3</groupId> - <artifactId>swagger-codegen-maven-plugin</artifactId> + <groupId>org.openapitools</groupId> + <artifactId>openapi-generator-maven-plugin</artifactId> + <version>6.6.0</version> <executions> <execution> <goals> @@ -256,15 +257,19 @@ </goals> <configuration> <inputSpec>${project.basedir}/openapi/openapi.yml</inputSpec> - <language>spring</language> + <generatorName>spring</generatorName> <generateSupportingFiles>false</generateSupportingFiles> + <invokerPackage>org.onap.cps.ncmp.dmi.rest.controller</invokerPackage> <apiPackage>org.onap.cps.ncmp.dmi.rest.api</apiPackage> <modelPackage>org.onap.cps.ncmp.dmi.model</modelPackage> + <generateAliasAsModel>true</generateAliasAsModel> <configOptions> <sourceFolder>src/gen/java</sourceFolder> <dateLibrary>java11</dateLibrary> <interfaceOnly>true</interfaceOnly> <useTags>true</useTags> + <openApiNullable>false</openApiNullable> + <skipDefaultInterface>true</skipDefaultInterface> </configOptions> </configuration> </execution> @@ -276,7 +281,7 @@ <phase>compile</phase> <configuration> <inputSpec>${project.basedir}/openapi/openapi.yml</inputSpec> - <language>openapi-yaml</language> + <generatorName>openapi-yaml</generatorName> </configuration> </execution> </executions> @@ -294,7 +299,7 @@ <outputDirectory>${project.basedir}/target/classes/static/api-docs</outputDirectory> <resources> <resource> - <directory>${project.basedir}/target/generated-sources/swagger/</directory> + <directory>${project.basedir}/target/generated-sources/openapi/openapi</directory> <includes> <include>openapi.yaml</include> </includes> diff --git a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java index b0ee4cf0..2ed1ebd3 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/rest/controller/DmiRestController.java @@ -32,10 +32,10 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.onap.cps.ncmp.dmi.model.CmHandles; import org.onap.cps.ncmp.dmi.model.DataAccessRequest; -import org.onap.cps.ncmp.dmi.model.DataOperationRequest; import org.onap.cps.ncmp.dmi.model.ModuleReferencesRequest; import org.onap.cps.ncmp.dmi.model.ModuleResourcesReadRequest; import org.onap.cps.ncmp.dmi.model.ModuleSet; +import org.onap.cps.ncmp.dmi.model.ResourceDataOperationRequests; import org.onap.cps.ncmp.dmi.model.YangResources; import org.onap.cps.ncmp.dmi.notifications.async.AsyncTaskExecutor; import org.onap.cps.ncmp.dmi.rest.api.DmiPluginApi; @@ -80,6 +80,7 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi { return ResponseEntity.ok(moduleSet); } + @Override public ResponseEntity<YangResources> retrieveModuleResources( final String cmHandle, @@ -107,14 +108,14 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi { /** * This method is not implemented for ONAP DMI plugin. * - * @param requestId requestId generated by NCMP as an ack for client * @param topic client given topic name - * @param dataOperationRequests list of operation details + * @param requestId requestId generated by NCMP as an ack for client + * @param resourceDataOperationRequests list of operation details * @return (@ code ResponseEntity) response entity */ @Override - public ResponseEntity<Void> getResourceDataForCmHandleDataOperation(final String requestId, final String topic, - final List<DataOperationRequest> dataOperationRequests) { + public ResponseEntity<Void> getResourceDataForCmHandleDataOperation(final String topic, final String requestId, + final ResourceDataOperationRequests resourceDataOperationRequests) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -123,18 +124,18 @@ public class DmiRestController implements DmiPluginApi, DmiPluginInternalApi { * It filters the response on the basis of options query parameters and returns response. Passthrough Running * supports both read and write operation whereas passthrough operational does not support write operations. * - * @param resourceIdentifier resource identifier to fetch data * @param datastoreName name of the datastore * @param cmHandle cm handle identifier + * @param resourceIdentifier resource identifier to fetch data * @param optionsParamInQuery options query parameter * @param topicParamInQuery topic name for (triggering) async responses * @param dataAccessRequest data Access Request * @return {@code ResponseEntity} response entity */ @Override - public ResponseEntity<Object> dataAccessPassthrough(final String resourceIdentifier, - final String datastoreName, + public ResponseEntity<Object> dataAccessPassthrough(final String datastoreName, final String cmHandle, + final String resourceIdentifier, final String optionsParamInQuery, final String topicParamInQuery, final DataAccessRequest dataAccessRequest) { diff --git a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java index 753d16f7..a9a13a38 100644 --- a/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java +++ b/src/main/java/org/onap/cps/ncmp/dmi/service/DmiServiceImpl.java @@ -38,7 +38,7 @@ import org.onap.cps.ncmp.dmi.exception.ModuleResourceNotFoundException; import org.onap.cps.ncmp.dmi.exception.ModulesNotFoundException; import org.onap.cps.ncmp.dmi.model.DataAccessRequest; import org.onap.cps.ncmp.dmi.model.ModuleSet; -import org.onap.cps.ncmp.dmi.model.ModuleSetSchemas; +import org.onap.cps.ncmp.dmi.model.ModuleSetSchemasInner; import org.onap.cps.ncmp.dmi.model.YangResource; import org.onap.cps.ncmp.dmi.model.YangResources; import org.onap.cps.ncmp.dmi.service.client.NcmpRestClient; @@ -137,8 +137,8 @@ public class DmiServiceImpl implements DmiService { } } - private ModuleSetSchemas toModuleSetSchemas(final ModuleSchema moduleSchema) { - final ModuleSetSchemas moduleSetSchemas = new ModuleSetSchemas(); + private ModuleSetSchemasInner toModuleSetSchemas(final ModuleSchema moduleSchema) { + final ModuleSetSchemasInner moduleSetSchemas = new ModuleSetSchemasInner(); moduleSetSchemas.setModuleName(moduleSchema.getIdentifier()); moduleSetSchemas.setNamespace(moduleSchema.getNamespace()); moduleSetSchemas.setRevision(moduleSchema.getVersion()); diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy index 96c1ed8e..8ce9735a 100644 --- a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy +++ b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/DmiRestControllerSpec.groovy @@ -27,12 +27,12 @@ import org.onap.cps.ncmp.dmi.config.WebSecurityConfig import org.onap.cps.ncmp.dmi.exception.DmiException import org.onap.cps.ncmp.dmi.exception.ModuleResourceNotFoundException import org.onap.cps.ncmp.dmi.exception.ModulesNotFoundException +import org.onap.cps.ncmp.dmi.model.ModuleSetSchemasInner import org.onap.cps.ncmp.dmi.notifications.async.AsyncTaskExecutor import org.onap.cps.ncmp.dmi.notifications.async.DmiAsyncRequestResponseEventProducer import org.onap.cps.ncmp.dmi.service.model.ModuleReference import org.onap.cps.ncmp.dmi.model.ModuleSet -import org.onap.cps.ncmp.dmi.model.ModuleSetSchemas import org.onap.cps.ncmp.dmi.model.YangResource import org.onap.cps.ncmp.dmi.model.YangResources import org.onap.cps.ncmp.dmi.service.DmiService @@ -84,10 +84,10 @@ class DmiRestControllerSpec extends Specification { def getModuleUrl = "$basePathV1/ch/node1/modules" def someValidJson = '{}' and: 'DMI service returns some module' - def moduleSetSchema = new ModuleSetSchemas(namespace:'some-namespace', + def moduleSetSchema = new ModuleSetSchemasInner(namespace:'some-namespace', moduleName:'some-moduleName', revision:'some-revision') - def moduleSetSchemasList = [moduleSetSchema] as List<ModuleSetSchemas> + def moduleSetSchemasList = [moduleSetSchema] as List<ModuleSetSchemasInner> def moduleSet = new ModuleSet() moduleSet.schemas(moduleSetSchemasList) mockDmiService.getModulesForCmHandle('node1') >> moduleSet |