From 62abb22f7c495892afc45d72b8994112ebf1dfb5 Mon Sep 17 00:00:00 2001 From: "halil.cakal" Date: Fri, 11 Oct 2024 17:22:06 +0100 Subject: DMI simulator serving yang modules dynamically - all modules and module references are created once, then are served as requested - 5 module-set-tag supported from tagA to tagE - 200 yang modules per module-set-tag - module sizes are fixed at 32KiB each - the average response size is 200 * 32KiB = 6.4MiB for each Issue-ID: CPS-2410 Change-Id: Ie7ac73b8c0bd464b114a8d76104db4b569ae36f4 Signed-off-by: halil.cakal --- dmi-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml | 2 +- .../cps/ncmp/dmi/rest/stub/DmiDemoApplication.java | 32 ++++ .../rest/stub/config/NcmpRequestLoggingConfig.java | 45 ++++++ .../rest/stub/controller/DmiDemoApplication.java | 32 ---- .../config/NcmpRequestLoggingConfig.java | 45 ------ .../stub/controller/DmiRestStubController.java | 51 ++++--- .../rest/stub/model/module/ModuleReference.java | 26 ++++ .../rest/stub/model/module/ModuleReferences.java | 27 ++++ .../dmi/rest/stub/model/module/ModuleResource.java | 27 ++++ .../dmi/rest/stub/service/YangModuleFactory.java | 161 +++++++++++++++++++++ .../dmi/rest/stub/utils/ModuleResponseType.java | 27 ++++ .../module/tagA-ModuleResourcesResponse.json | 17 --- .../main/resources/module/tagA-ModuleResponse.json | 16 -- .../module/tagB-ModuleResourcesResponse.json | 17 --- .../main/resources/module/tagB-ModuleResponse.json | 16 -- .../module/tagC-ModuleResourcesResponse.json | 17 --- .../main/resources/module/tagC-ModuleResponse.json | 16 -- .../module/tagD-ModuleResourcesResponse.json | 17 --- .../main/resources/module/tagD-ModuleResponse.json | 16 -- dmi-stub/pom.xml | 3 +- 20 files changed, 378 insertions(+), 232 deletions(-) create mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/DmiDemoApplication.java create mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/config/NcmpRequestLoggingConfig.java delete mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiDemoApplication.java delete mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/config/NcmpRequestLoggingConfig.java create mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleReference.java create mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleReferences.java create mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleResource.java create mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/service/YangModuleFactory.java create mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/utils/ModuleResponseType.java delete mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagA-ModuleResourcesResponse.json delete mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagA-ModuleResponse.json delete mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagB-ModuleResourcesResponse.json delete mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagB-ModuleResponse.json delete mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagC-ModuleResourcesResponse.json delete mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagC-ModuleResponse.json delete mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagD-ModuleResourcesResponse.json delete mode 100644 dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagD-ModuleResponse.json diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml b/dmi-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml index 73105fd5..3d7ccf6b 100644 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-app/pom.xml @@ -28,7 +28,7 @@ dmi-plugin-demo-and-csit-stub-app - org.onap.cps.ncmp.dmi.rest.stub.controller.DmiDemoApplication + org.onap.cps.ncmp.dmi.rest.stub.DmiDemoApplication yyyyMMdd'T'HHmmss'Z' ${docker.pull.registry}/onap/integration-java17:12.0.0 ${project.version}-${maven.build.timestamp} diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/DmiDemoApplication.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/DmiDemoApplication.java new file mode 100644 index 00000000..98ded215 --- /dev/null +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/DmiDemoApplication.java @@ -0,0 +1,32 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2023-2024 Nordix Foundation + * ================================================================================ + * Licensed 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ncmp.dmi.rest.stub; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class DmiDemoApplication { + + public static void main(final String[] args) { + SpringApplication.run(DmiDemoApplication.class, args); + } +} diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/config/NcmpRequestLoggingConfig.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/config/NcmpRequestLoggingConfig.java new file mode 100644 index 00000000..e91f48f7 --- /dev/null +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/config/NcmpRequestLoggingConfig.java @@ -0,0 +1,45 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation. + * ================================================================================ + * Licensed 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ncmp.dmi.rest.stub.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.filter.CommonsRequestLoggingFilter; + +@Configuration +public class NcmpRequestLoggingConfig { + + /** + * Configuration class to log NCMP request headers and payload. + * logged request information before it is processed. + */ + @Bean + public CommonsRequestLoggingFilter logNcmpRequestInfo() { + final CommonsRequestLoggingFilter commonsRequestLoggingFilter = new CommonsRequestLoggingFilter(); + commonsRequestLoggingFilter.setIncludeHeaders(true); + commonsRequestLoggingFilter.setIncludeQueryString(true); + commonsRequestLoggingFilter.setIncludePayload(true); + commonsRequestLoggingFilter.setMaxPayloadLength(1000); + commonsRequestLoggingFilter.setAfterMessagePrefix("NCMP REQUEST DATA: "); + return commonsRequestLoggingFilter; + } +} + diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiDemoApplication.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiDemoApplication.java deleted file mode 100644 index 2d14020b..00000000 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiDemoApplication.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2023 Nordix Foundation - * ================================================================================ - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.cps.ncmp.dmi.rest.stub.controller; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class DmiDemoApplication { - - public static void main(final String[] args) { - SpringApplication.run(DmiDemoApplication.class, args); - } -} diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/config/NcmpRequestLoggingConfig.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/config/NcmpRequestLoggingConfig.java deleted file mode 100644 index 6ef19fa1..00000000 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-app/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/config/NcmpRequestLoggingConfig.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ============LICENSE_START======================================================= - * Copyright (C) 2024 Nordix Foundation. - * ================================================================================ - * Licensed 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. - * - * SPDX-License-Identifier: Apache-2.0 - * ============LICENSE_END========================================================= - */ - -package org.onap.cps.ncmp.dmi.rest.stub.controller.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.web.filter.CommonsRequestLoggingFilter; - -@Configuration -public class NcmpRequestLoggingConfig { - - /** - * Configuration class to log NCMP request headers and payload. - * logged request information before it is processed. - */ - @Bean - public CommonsRequestLoggingFilter logNcmpRequestInfo() { - final CommonsRequestLoggingFilter commonsRequestLoggingFilter = new CommonsRequestLoggingFilter(); - commonsRequestLoggingFilter.setIncludeHeaders(true); - commonsRequestLoggingFilter.setIncludeQueryString(true); - commonsRequestLoggingFilter.setIncludePayload(true); - commonsRequestLoggingFilter.setMaxPayloadLength(1000); - commonsRequestLoggingFilter.setAfterMessagePrefix("NCMP REQUEST DATA: "); - return commonsRequestLoggingFilter; - } -} - diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java index 85d454b2..cf18f239 100644 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java @@ -20,6 +20,9 @@ package org.onap.cps.ncmp.dmi.rest.stub.controller; +import static org.onap.cps.ncmp.dmi.rest.stub.utils.ModuleResponseType.MODULE_REFERENCE_RESPONSE; +import static org.onap.cps.ncmp.dmi.rest.stub.utils.ModuleResponseType.MODULE_RESOURCE_RESPONSE; + import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; @@ -43,14 +46,15 @@ import org.onap.cps.ncmp.dmi.rest.stub.controller.aop.ModuleInitialProcess; import org.onap.cps.ncmp.dmi.rest.stub.model.data.operational.DataOperationRequest; import org.onap.cps.ncmp.dmi.rest.stub.model.data.operational.DmiDataOperationRequest; import org.onap.cps.ncmp.dmi.rest.stub.model.data.operational.DmiOperationCmHandle; +import org.onap.cps.ncmp.dmi.rest.stub.service.YangModuleFactory; import org.onap.cps.ncmp.dmi.rest.stub.utils.EventDateTimeFormatter; +import org.onap.cps.ncmp.dmi.rest.stub.utils.ModuleResponseType; import org.onap.cps.ncmp.dmi.rest.stub.utils.ResourceFileReaderUtil; import org.onap.cps.ncmp.events.async1_0_0.Data; import org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent; import org.onap.cps.ncmp.events.async1_0_0.Response; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.ApplicationContext; -import org.springframework.core.io.Resource; import org.springframework.core.io.ResourceLoader; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -73,11 +77,17 @@ import org.springframework.web.bind.annotation.RestController; public class DmiRestStubController { private static final String DEFAULT_PASSTHROUGH_OPERATION = "read"; - private static final String dataOperationEventType = "org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent"; + private static final String DATA_OPERATION_EVENT_TYPE = "org.onap.cps.ncmp.events.async1_0_0.DataOperationEvent"; private static final Map moduleSetTagPerCmHandleId = new HashMap<>(); + private static final List MODULE_SET_TAGS = YangModuleFactory.generateTags(); + private static final String DEFAULT_TAG = "tagDefault"; + private final KafkaTemplate cloudEventKafkaTemplate; private final ObjectMapper objectMapper; private final ApplicationContext applicationContext; + private final AtomicInteger subJobWriteRequestCounter = new AtomicInteger(); + private final YangModuleFactory yangModuleFactory; + @Value("${app.ncmp.async-m2m.topic}") private String ncmpAsyncM2mTopic; @Value("${delay.module-references-delay-ms}") @@ -88,7 +98,6 @@ public class DmiRestStubController { private long readDataForCmHandleDelayMs; @Value("${delay.write-data-for-cm-handle-delay-ms}") private long writeDataForCmHandleDelayMs; - private final AtomicInteger subJobWriteRequestCounter = new AtomicInteger(); /** * This code defines a REST API endpoint for adding new the module set tag mapping. The endpoint receives the @@ -163,7 +172,7 @@ public class DmiRestStubController { @ModuleInitialProcess public ResponseEntity getModuleReferences(@PathVariable("cmHandleId") final String cmHandleId, @RequestBody final Object moduleReferencesRequest) { - return processModuleRequest(moduleReferencesRequest, "ModuleResponse.json", moduleReferencesDelayMs); + return processModuleRequest(moduleReferencesRequest, MODULE_REFERENCE_RESPONSE, moduleReferencesDelayMs); } /** @@ -179,7 +188,7 @@ public class DmiRestStubController { public ResponseEntity getModuleResources( @PathVariable("cmHandleId") final String cmHandleId, @RequestBody final Object moduleResourcesReadRequest) { - return processModuleRequest(moduleResourcesReadRequest, "ModuleResourcesResponse.json", moduleResourcesDelayMs); + return processModuleRequest(moduleResourcesReadRequest, MODULE_RESOURCE_RESPONSE, moduleResourcesDelayMs); } /** @@ -308,8 +317,8 @@ public class DmiRestStubController { cloudEvent = CloudEventBuilder.v1() .withId(UUID.randomUUID().toString()) .withSource(URI.create("DMI")) - .withType(dataOperationEventType) - .withDataSchema(URI.create("urn:cps:" + dataOperationEventType + ":1.0.0")) + .withType(DATA_OPERATION_EVENT_TYPE) + .withDataSchema(URI.create("urn:cps:" + DATA_OPERATION_EVENT_TYPE + ":1.0.0")) .withTime(EventDateTimeFormatter.toIsoOffsetDateTime( EventDateTimeFormatter.getCurrentIsoFormattedDateTime())) .withData(objectMapper.writeValueAsBytes(dataOperationEvent)) @@ -350,11 +359,22 @@ public class DmiRestStubController { return dataOperationEvent; } - private ResponseEntity processModuleRequest(final Object moduleRequest, final String responseFileName, + private ResponseEntity processModuleRequest(final Object moduleRequest, + final ModuleResponseType moduleResponseType, final long simulatedResponseDelay) { - final String moduleSetTag = extractModuleSetTagFromRequest(moduleRequest); logRequestBody(moduleRequest); - final String moduleResponseContent = getModuleResponseContent(moduleSetTag, responseFileName); + String moduleResponseContent = ""; + String moduleSetTag = extractModuleSetTagFromRequest(moduleRequest); + + moduleSetTag = (!isModuleSetTagNullOrEmpty(moduleSetTag) + && MODULE_SET_TAGS.contains(moduleSetTag)) ? moduleSetTag : DEFAULT_TAG; + + if (MODULE_RESOURCE_RESPONSE == moduleResponseType) { + moduleResponseContent = yangModuleFactory.getModuleResourcesJson(moduleSetTag); + } else { + moduleResponseContent = yangModuleFactory.getModuleReferencesJson(moduleSetTag); + } + delay(simulatedResponseDelay); return ResponseEntity.ok(moduleResponseContent); } @@ -376,17 +396,6 @@ public class DmiRestStubController { } } - private String getModuleResponseContent(final String moduleSetTag, final String responseFileName) { - final String moduleResponseFilePath = isModuleSetTagNullOrEmpty(moduleSetTag) - ? String.format("module/ietfYang-%s", responseFileName) - : String.format("module/%s-%s", moduleSetTag, responseFileName); - log.info("Using module responses from : {}", moduleResponseFilePath); - - final Resource moduleResponseResource = applicationContext.getResource( - ResourceLoader.CLASSPATH_URL_PREFIX + moduleResponseFilePath); - return ResourceFileReaderUtil.getResourceFileContent(moduleResponseResource); - } - private String getPassthroughOperationType(final String requestBody) { try { final JsonNode rootNode = objectMapper.readTree(requestBody); diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleReference.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleReference.java new file mode 100644 index 00000000..5b1c30e2 --- /dev/null +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleReference.java @@ -0,0 +1,26 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation. + * ================================================================================ + * Licensed 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ncmp.dmi.rest.stub.model.module; + +public record ModuleReference ( + String moduleName, + String revision +){ } diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleReferences.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleReferences.java new file mode 100644 index 00000000..36516452 --- /dev/null +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleReferences.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation. + * ================================================================================ + * Licensed 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ncmp.dmi.rest.stub.model.module; + +import java.util.List; + +public record ModuleReferences( + List schemas +) { } diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleResource.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleResource.java new file mode 100644 index 00000000..f4decb8d --- /dev/null +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/model/module/ModuleResource.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation. + * ================================================================================ + * Licensed 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ncmp.dmi.rest.stub.model.module; + +public record ModuleResource ( + String moduleName, + String revision, + String yangSource +) { } diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/service/YangModuleFactory.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/service/YangModuleFactory.java new file mode 100644 index 00000000..42459222 --- /dev/null +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/service/YangModuleFactory.java @@ -0,0 +1,161 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation. + * ================================================================================ + * Licensed 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ncmp.dmi.rest.stub.service; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import jakarta.annotation.PostConstruct; +import java.time.LocalDate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.onap.cps.ncmp.dmi.rest.stub.model.module.ModuleReference; +import org.onap.cps.ncmp.dmi.rest.stub.model.module.ModuleReferences; +import org.onap.cps.ncmp.dmi.rest.stub.model.module.ModuleResource; +import org.springframework.stereotype.Service; + +@Slf4j +@Service +@RequiredArgsConstructor +public class YangModuleFactory { + + private static final int TARGET_FILE_SIZE_IN_KB = 32 * 1024; + private static final List MODULE_SET_TAGS = generateTags(); + private static final String DEFAULT_TAG = "tagDefault"; + private static final int NUMBER_OF_MODULES_PER_MODULE_SET = 200; + private static final int NUMBER_OF_MODULES_NOT_IN_MODULE_SET = 10; + private static final String SERIALIZATION_ERROR = "Error serializing {}: {}"; + private static final String MODULE_TEMPLATE = """ + module { + yang-version 1.1; + namespace "org:onap:cps:test:"; + prefix tree; + revision "" { + description ""; + } + container tree { + list branch { + key "name"; + leaf name { + type string; + } + } + } + } + """; + + private final ObjectMapper objectMapper; + private final Map moduleReferencesJsonMap = new HashMap<>(); + private final Map moduleResourcesJsonMap = new HashMap<>(); + + @PostConstruct + private void initializeModuleJsonStrings() { + MODULE_SET_TAGS.forEach(tag -> { + moduleReferencesJsonMap.put(tag, createModuleReferencesJson(tag, NUMBER_OF_MODULES_PER_MODULE_SET)); + moduleResourcesJsonMap.put(tag, createModuleResourcesJson(tag, NUMBER_OF_MODULES_PER_MODULE_SET)); + }); + + // Initialize default tag + moduleReferencesJsonMap.put(DEFAULT_TAG, + createModuleReferencesJson(DEFAULT_TAG, NUMBER_OF_MODULES_NOT_IN_MODULE_SET)); + moduleResourcesJsonMap.put(DEFAULT_TAG, + createModuleResourcesJson(DEFAULT_TAG, NUMBER_OF_MODULES_NOT_IN_MODULE_SET)); + } + + /** + * Retrieves the JSON representation of module references for the given tag. + * + * @param tag the tag identifying the set of module references + * @return the JSON string of module references for the specified tag, or the default tag if not found + */ + public String getModuleReferencesJson(final String tag) { + return moduleReferencesJsonMap.getOrDefault(tag, moduleReferencesJsonMap.get(DEFAULT_TAG)); + } + + /** + * Retrieves the JSON representation of module resources for the given tag. + * + * @param tag the tag identifying the set of module resources + * @return the JSON string of module resources for the specified tag, or the default tag if not found + */ + public String getModuleResourcesJson(final String tag) { + return moduleResourcesJsonMap.getOrDefault(tag, moduleResourcesJsonMap.get(DEFAULT_TAG)); + } + + /** + * Generates a list of tags from 'A' to 'E'. + * + * @return a list of tags in the format "tagX" where X is each character from 'A' to 'E' + */ + public static List generateTags() { + final List tags = new ArrayList<>(5); + for (char currentChar = 'A'; currentChar <= 'E'; currentChar++) { + tags.add("tag" + currentChar); + } + return tags; + } + + private String createModuleReferencesJson(final String tag, final int numberOfModules) { + final List moduleReferencesList = new ArrayList<>(numberOfModules); + final String moduleRevision = generateModuleRevision(tag); + for (int i = 0; i < numberOfModules; i++) { + moduleReferencesList.add(new ModuleReference("module" + i, moduleRevision)); + } + return serializeToJson(new ModuleReferences(moduleReferencesList), "ModuleReferences"); + } + + private String createModuleResourcesJson(final String tag, final int numberOfModules) { + final List moduleResourceList = new ArrayList<>(numberOfModules); + final String moduleRevision = generateModuleRevision(tag); + for (int i = 0; i < numberOfModules; i++) { + final String moduleName = "module" + i; + final String yangSource = generateYangSource(moduleName, moduleRevision); + moduleResourceList.add(new ModuleResource(moduleName, moduleRevision, yangSource)); + } + return serializeToJson(moduleResourceList, "ModuleResources"); + } + + private String serializeToJson(final Object objectToSerialize, final String objectType) { + try { + return objectMapper.writeValueAsString(objectToSerialize); + } catch (final JsonProcessingException jsonProcessingException) { + log.error(SERIALIZATION_ERROR, objectType, jsonProcessingException.getMessage()); + return null; + } + } + + private String generateModuleRevision(final String tag) { + // set tagIndex to 0 for the default tag, otherwise set it to the index of the tag in the list + final int tagIndex = tag.equals(DEFAULT_TAG) ? 0 : MODULE_SET_TAGS.indexOf(tag); + return LocalDate.of(2024, tagIndex + 1, tagIndex + 1).toString(); + } + + private static String generateYangSource(final String moduleName, final String moduleRevision) { + final int paddingSize = TARGET_FILE_SIZE_IN_KB - MODULE_TEMPLATE.length(); + final String padding = "*".repeat(Math.max(0, paddingSize)); + return MODULE_TEMPLATE.replaceAll("", moduleName) + .replace("", moduleRevision) + .replace("", padding); + } +} \ No newline at end of file diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/utils/ModuleResponseType.java b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/utils/ModuleResponseType.java new file mode 100644 index 00000000..9c5482d1 --- /dev/null +++ b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/utils/ModuleResponseType.java @@ -0,0 +1,27 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2024 Nordix Foundation. + * ================================================================================ + * Licensed 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.cps.ncmp.dmi.rest.stub.utils; + +public enum ModuleResponseType { + MODULE_REFERENCE_RESPONSE, + MODULE_RESOURCE_RESPONSE; +} + diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagA-ModuleResourcesResponse.json b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagA-ModuleResourcesResponse.json deleted file mode 100644 index b9766ccb..00000000 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagA-ModuleResourcesResponse.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "moduleName": "ietf-yang-types", - "revision": "2013-07-15", - "yangSource": "module ietf-yang-types {\n\n namespace \"urn:ietf:params:xml:ns:yang:ietf-yang-types\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2013-07-15 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - }, - { - "moduleName": "M1", - "revision": "2024-01-01", - "yangSource": "module M1 {\n\n namespace \"urn:ietf:params:xml:ns:yang:M1\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2024-01-01 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - }, - { - "moduleName": "M2", - "revision": "2024-01-02", - "yangSource": "module M2 {\n\n namespace \"urn:ietf:params:xml:ns:yang:M2\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2024-01-02 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - } -] diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagA-ModuleResponse.json b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagA-ModuleResponse.json deleted file mode 100644 index 2e61e9d3..00000000 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagA-ModuleResponse.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "schemas": [ - { - "moduleName": "ietf-yang-types", - "revision": "2013-07-15" - }, - { - "moduleName": "M1", - "revision": "2024-01-01" - }, - { - "moduleName": "M2", - "revision": "2024-01-02" - } - ] -} diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagB-ModuleResourcesResponse.json b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagB-ModuleResourcesResponse.json deleted file mode 100644 index b20e807b..00000000 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagB-ModuleResourcesResponse.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "moduleName": "ietf-yang-types", - "revision": "2013-07-15", - "yangSource": "module ietf-yang-types {\n\n namespace \"urn:ietf:params:xml:ns:yang:ietf-yang-types\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2013-07-15 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - }, - { - "moduleName": "M1", - "revision": "2024-01-01", - "yangSource": "module M1 {\n\n namespace \"urn:ietf:params:xml:ns:yang:M1\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2024-01-01 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - }, - { - "moduleName": "M3", - "revision": "2024-01-03", - "yangSource": "module M3 {\n\n namespace \"urn:ietf:params:xml:ns:yang:M3\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2024-01-03 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - } -] diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagB-ModuleResponse.json b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagB-ModuleResponse.json deleted file mode 100644 index bfdefdfd..00000000 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagB-ModuleResponse.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "schemas": [ - { - "moduleName": "ietf-yang-types", - "revision": "2013-07-15" - }, - { - "moduleName": "M1", - "revision": "2024-01-01" - }, - { - "moduleName": "M3", - "revision": "2024-01-03" - } - ] -} diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagC-ModuleResourcesResponse.json b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagC-ModuleResourcesResponse.json deleted file mode 100644 index 3389b4f5..00000000 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagC-ModuleResourcesResponse.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "moduleName": "ietf-yang-types", - "revision": "2013-07-15", - "yangSource": "module ietf-yang-types {\n\n namespace \"urn:ietf:params:xml:ns:yang:ietf-yang-types\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2013-07-15 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - }, - { - "moduleName": "M4", - "revision": "2024-01-04", - "yangSource": "module M4 {\n\n namespace \"urn:ietf:params:xml:ns:yang:M1\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2024-01-04 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - }, - { - "moduleName": "M5", - "revision": "2024-01-05", - "yangSource": "module M5 {\n\n namespace \"urn:ietf:params:xml:ns:yang:M2\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2024-01-05 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - } -] diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagC-ModuleResponse.json b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagC-ModuleResponse.json deleted file mode 100644 index c3369456..00000000 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagC-ModuleResponse.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "schemas": [ - { - "moduleName": "ietf-yang-types", - "revision": "2013-07-15" - }, - { - "moduleName": "M4", - "revision": "2024-01-04" - }, - { - "moduleName": "M5", - "revision": "2024-01-05" - } - ] -} diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagD-ModuleResourcesResponse.json b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagD-ModuleResourcesResponse.json deleted file mode 100644 index b9766ccb..00000000 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagD-ModuleResourcesResponse.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "moduleName": "ietf-yang-types", - "revision": "2013-07-15", - "yangSource": "module ietf-yang-types {\n\n namespace \"urn:ietf:params:xml:ns:yang:ietf-yang-types\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2013-07-15 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - }, - { - "moduleName": "M1", - "revision": "2024-01-01", - "yangSource": "module M1 {\n\n namespace \"urn:ietf:params:xml:ns:yang:M1\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2024-01-01 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - }, - { - "moduleName": "M2", - "revision": "2024-01-02", - "yangSource": "module M2 {\n\n namespace \"urn:ietf:params:xml:ns:yang:M2\";\n prefix \"yang\";\n\n organization\n \"IETF NETMOD (NETCONF Data Modeling Language) Working Group\";\n\n contact\n \"WG Web: \n WG List: \n\n WG Chair: David Kessens\n \n\n WG Chair: Juergen Schoenwaelder\n \n\n Editor: Juergen Schoenwaelder\n \";\n\n description\n \"This module contains a collection of generally useful derived\n YANG data types.\n\n Copyright (c) 2013 IETF Trust and the persons identified as\n authors of the code. All rights reserved.\n\n Redistribution and use in source and binary forms, with or\n without modification, is permitted pursuant to, and subject\n to the license terms contained in, the Simplified BSD License\n set forth in Section 4.c of the IETF Trust's Legal Provisions\n Relating to IETF Documents\n (http://trustee.ietf.org/license-info).\n\n This version of this YANG module is part of RFC 6991; see\n the RFC itself for full legal notices.\";\n\n revision 2024-01-02 {\n description\n \"This revision adds the following new data types:\n - yang-identifier\n - hex-string\n - uuid\n - dotted-quad\";\n reference\n \"RFC 6991: Common YANG Data Types\";\n }\n\n revision 2010-09-24 {\n description\n \"Initial revision.\";\n reference\n \"RFC 6021: Common YANG Data Types\";\n }\n\n /*** collection of counter and gauge types ***/\n\n typedef counter32 {\n type uint32;\n description\n \"The counter32 type represents a non-negative integer\n that monotonically increases until it reaches a\n maximum value of 2^32-1 (4294967295 decimal), when it\n wraps around and starts increasing again from zero.\n\n Counters have no defined 'initial' value, and thus, a\n single value of a counter has (in general) no information\n content. Discontinuities in the monotonically increasing\n value normally occur at re-initialization of the\n management system, and at other times as specified in the\n description of a schema node using this type. If such\n other times can occur, for example, the creation of\n a schema node of type counter32 at times other than\n re-initialization, then a corresponding schema node\n should be defined, with an appropriate type, to indicate\n the last discontinuity.\n\n The counter32 type should not be used for configuration\n schema nodes. A default statement SHOULD NOT be used in\n combination with the type counter32.\n\n In the value set and its semantics, this type is equivalent\n to the Counter32 type of the SMIv2.\";\n reference\n \"RFC 2578: Structure of Management Information Version 2\n (SMIv2)\";\n }\n}\n" - } -] diff --git a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagD-ModuleResponse.json b/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagD-ModuleResponse.json deleted file mode 100644 index 2e61e9d3..00000000 --- a/dmi-stub/dmi-plugin-demo-and-csit-stub-service/src/main/resources/module/tagD-ModuleResponse.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "schemas": [ - { - "moduleName": "ietf-yang-types", - "revision": "2013-07-15" - }, - { - "moduleName": "M1", - "revision": "2024-01-01" - }, - { - "moduleName": "M2", - "revision": "2024-01-02" - } - ] -} diff --git a/dmi-stub/pom.xml b/dmi-stub/pom.xml index 17def900..64df918e 100644 --- a/dmi-stub/pom.xml +++ b/dmi-stub/pom.xml @@ -33,6 +33,8 @@ true true + 17 + 17 @@ -97,5 +99,4 @@ - \ No newline at end of file -- cgit 1.2.3-korg