summaryrefslogtreecommitdiffstats
path: root/dmi-plugin-demo-and-csit-stub
diff options
context:
space:
mode:
authordanielhanrahan <daniel.hanrahan@est.tech>2023-11-29 18:51:16 +0000
committerDaniel Hanrahan <daniel.hanrahan@est.tech>2024-02-26 10:38:57 +0000
commit5543875f9f3a6a772a09c17f7f0b1a3939c78292 (patch)
tree6e0eb14a73a867cc0251dca671fa5b94f7e796d3 /dmi-plugin-demo-and-csit-stub
parenta167ab14ed2fdaeded5e1a7a9a22614353f47269 (diff)
Add passthrough read operation (synchronous) to DMI stub
- Implement DMI stub endpoint needed for for NCMP passthrough data operation, returning a fixed JSON response and adding delay. POST /dmi/v1/ch/{cmHandleId}/data/ds/{datastoreName} - Add script to measure average overhead for many requests Test results indicate the NCMP adds up to 150ms per request. Issue-ID: CPS-2099 Signed-off-by: danielhanrahan <daniel.hanrahan@est.tech> Change-Id: I2aba8285f8a52f3570fc1699a8687caffa9d9c77
Diffstat (limited to 'dmi-plugin-demo-and-csit-stub')
-rw-r--r--dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java34
1 files changed, 28 insertions, 6 deletions
diff --git a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java
index d77cbcc969..1819dcc47b 100644
--- a/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java
+++ b/dmi-plugin-demo-and-csit-stub/dmi-plugin-demo-and-csit-stub-service/src/main/java/org/onap/cps/ncmp/dmi/rest/stub/controller/DmiRestStubController.java
@@ -118,6 +118,30 @@ public class DmiRestStubController {
}
/**
+ * Get resource data from passthrough operational or running for a cm handle.
+ *
+ * @param cmHandleId The identifier for a network function, network element, subnetwork,
+ * or any other cm object by managed Network CM Proxy
+ * @param datastoreName datastore name
+ * @param resourceIdentifier resource identifier
+ * @param options options
+ * @param topic client given topic name
+ * @return (@ code ResponseEntity) response entity
+ */
+ @PostMapping("/v1/ch/{cmHandleId}/data/ds/{datastoreName}")
+ public ResponseEntity<String> getResourceDataForCmHandle(
+ @PathVariable("cmHandleId") final String cmHandleId,
+ @PathVariable("datastoreName") final String datastoreName,
+ @RequestParam(value = "resourceIdentifier") final String resourceIdentifier,
+ @RequestParam(value = "options", required = false) final String options,
+ @RequestParam(value = "topic", required = false) final String topic) {
+ delay(dataForCmHandleDelayMs);
+ final String sampleJson = ResourceFileReaderUtil.getResourceFileContent(applicationContext.getResource(
+ ResourceLoader.CLASSPATH_URL_PREFIX + "data/operational/ietf-network-topology-sample-rfc8345.json"));
+ return ResponseEntity.ok(sampleJson);
+ }
+
+ /**
* This method is not implemented for ONAP DMI plugin.
*
* @param topic client given topic name
@@ -126,12 +150,10 @@ public class DmiRestStubController {
* @return (@ code ResponseEntity) response entity
*/
@PostMapping("/v1/data")
- public ResponseEntity<Void> getResourceDataForCmHandleDataOperation(@RequestParam(value = "topic")
- final String topic,
- @RequestParam(value = "requestId")
- final String requestId,
- @RequestBody final DmiDataOperationRequest
- dmiDataOperationRequest) {
+ public ResponseEntity<Void> getResourceDataForCmHandleDataOperation(
+ @RequestParam(value = "topic") final String topic,
+ @RequestParam(value = "requestId") final String requestId,
+ @RequestBody final DmiDataOperationRequest dmiDataOperationRequest) {
delay(dataForCmHandleDelayMs);
try {
log.info("Request received from the NCMP to DMI Plugin: {}",