summaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js')
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js65
1 files changed, 23 insertions, 42 deletions
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js
index 184340288..7d17e25bc 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js
@@ -21,55 +21,36 @@
executor.logger.info(executor.subject.id);
executor.logger.info(executor.inFields);
-var genericDataRecordType = Java.type("org.apache.avro.generic.GenericData.Record");
+var appcRequest = new org.onap.policy.appclcm.LcmRequestWrapper;
+appcRequest.setBody(new org.onap.policy.appclcm.LcmRequest);
+appcRequest.getBody().setCommonHeader(new org.onap.policy.appclcm.LcmCommonHeader);
-var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(
- executor.inFields.get("vnfID").toString());
+appcRequest.setVersion("2.0.0");
+appcRequest.setRpcName("restart");
+appcRequest.setCorrelationId(executor.inFields.get("requestID"));
+appcRequest.setType("request");
-var appcBodyRecord = executor.subject.getOutFieldSchemaHelper("body").createNewInstance();
-var appcBodyRecordSchema = appcBodyRecord.getSchema();
+var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(executor.inFields.get("vnfID").toString());
-var inputRecord = new genericDataRecordType(appcBodyRecordSchema.getField("input").schema());
-var inputRecordRecordSchema = inputRecord.getSchema();
+appcRequest.getBody().getCommonHeader().setTimeStamp(java.time.Instant.now());
+appcRequest.getBody().getCommonHeader().setApiVer("2.00");
+appcRequest.getBody().getCommonHeader().setOriginatorId(executor.inFields.get("requestID").toString());
+appcRequest.getBody().getCommonHeader().setRequestId(executor.inFields.get("requestID"));
+appcRequest.getBody().getCommonHeader().setSubRequestId("1");
+appcRequest.getBody().getCommonHeader().getFlags().put("ttl", "10000");
+appcRequest.getBody().getCommonHeader().getFlags().put("force", "TRUE");
+appcRequest.getBody().getCommonHeader().getFlags().put("mode", "EXCLUSIVE");
-var actionIndentifiersRecord = new genericDataRecordType(inputRecordRecordSchema.getField("action_DasH_identifiers")
- .schema());
+appcRequest.getBody().setAction("Restart");
+appcRequest.getBody().setActionIdentifiers(new java.util.HashMap());
+appcRequest.getBody().getActionIdentifiers().put("vnf-id", executor.inFields.get("vnfID").toString());
-var commonHeaderRecord = new genericDataRecordType(inputRecordRecordSchema.getField("common_DasH_header").schema());
-var commonHeaderRecordSchema = commonHeaderRecord.getSchema();
+executor.getContextAlbum("RequestIDVNFIDAlbum").put(executor.inFields.get("requestID").toString(), executor.inFields.get("vnfID"));
-var commonHeaderFlagsRecord = new genericDataRecordType(commonHeaderRecordSchema.getField("flags").schema());
+vcpeClosedLoopStatus.put("notification", "OPERATION");
+vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
-appcBodyRecord.put("input", inputRecord);
-inputRecord.put("action_DasH_identifiers", actionIndentifiersRecord);
-inputRecord.put("common_DasH_header", commonHeaderRecord);
-commonHeaderRecord.put("flags", commonHeaderFlagsRecord);
-
-inputRecord.put("action", "Restart");
-inputRecord.put("payload", "{}");
-
-actionIndentifiersRecord.put("vnf_DasH_id", executor.inFields.get("vnfID").toString());
-
-commonHeaderRecord.put("timestamp", new Date().toISOString());
-commonHeaderRecord.put("api_DasH_ver", "2.00");
-commonHeaderRecord.put("originator_DasH_id", executor.inFields.get("requestID").toString());
-commonHeaderRecord.put("request_DasH_id", executor.inFields.get("requestID").toString());
-commonHeaderRecord.put("sub_DasH_request_DasH_id", "1");
-
-commonHeaderFlagsRecord.put("ttl", "10000");
-commonHeaderFlagsRecord.put("force", "TRUE");
-commonHeaderFlagsRecord.put("mode", "EXCLUSIVE");
-
-executor.outFields.put("version", "2.0");
-executor.outFields.put("rpc-name", "restart");
-executor.outFields.put("correlation-id", executor.inFields.get("vnfID"));
-executor.outFields.put("type", "request");
-executor.outFields.put("body", appcBodyRecord);
-
-executor.getContextAlbum("RequestIDVNFIDAlbum").put(executor.inFields.get("requestID").toString(),
- executor.inFields.get("vnfID"));
-
-vcpeClosedLoopStatus.put("notification", "OPERATION: RESTART REQUESTED");
+executor.outFields.put("APPCLCMRequestEvent", appcRequest);
executor.logger.info(executor.outFields);