summaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-vcpe/src/main/resources/logic
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-onap-vcpe/src/main/resources/logic')
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js46
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js44
-rw-r--r--examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js2
3 files changed, 60 insertions, 32 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 7d17e25bc..dd69dcb1d 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFRequestTask.js
@@ -21,34 +21,44 @@
executor.logger.info(executor.subject.id);
executor.logger.info(executor.inFields);
-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 appcRequest = new org.onap.policy.appclcm.AppcLcmDmaapWrapper;
+appcRequest.setBody(new org.onap.policy.appclcm.AppcLcmBody);
+appcRequest.getBody().setInput(new org.onap.policy.appclcm.AppcLcmInput);
+appcRequest.getBody().getInput().setCommonHeader(
+ new org.onap.policy.appclcm.AppcLcmCommonHeader);
appcRequest.setVersion("2.0.0");
appcRequest.setRpcName("restart");
appcRequest.setCorrelationId(executor.inFields.get("requestID"));
appcRequest.setType("request");
-var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(executor.inFields.get("vnfID").toString());
+var vcpeClosedLoopStatus = executor
+ .getContextAlbum("VCPEClosedLoopStatusAlbum").get(
+ executor.inFields.get("vnfID").toString());
-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");
+appcRequest.getBody().getInput().getCommonHeader().setTimeStamp(java.time.Instant.now());
+appcRequest.getBody().getInput().getCommonHeader().setApiVer("2.00");
+appcRequest.getBody().getInput().getCommonHeader().setOriginatorId(
+ executor.inFields.get("requestID").toString());
+appcRequest.getBody().getInput().getCommonHeader().setRequestId(
+ executor.inFields.get("requestID"));
+appcRequest.getBody().getInput().getCommonHeader().setSubRequestId("1");
+appcRequest.getBody().getInput().getCommonHeader().getFlags().put("ttl", "10000");
+appcRequest.getBody().getInput().getCommonHeader().getFlags().put("force", "TRUE");
+appcRequest.getBody().getInput().getCommonHeader().getFlags().put("mode", "EXCLUSIVE");
-appcRequest.getBody().setAction("Restart");
-appcRequest.getBody().setActionIdentifiers(new java.util.HashMap());
-appcRequest.getBody().getActionIdentifiers().put("vnf-id", executor.inFields.get("vnfID").toString());
+appcRequest.getBody().getInput().setAction("Restart");
+appcRequest.getBody().getInput().setActionIdentifiers(new java.util.HashMap());
+appcRequest.getBody().getInput().getActionIdentifiers().put("vnf-id",
+ executor.inFields.get("vnfID").toString());
-executor.getContextAlbum("RequestIDVNFIDAlbum").put(executor.inFields.get("requestID").toString(), executor.inFields.get("vnfID"));
+executor.getContextAlbum("RequestIDVNFIDAlbum").put(
+ executor.inFields.get("requestID").toString(),
+ executor.inFields.get("vnfID"));
-vcpeClosedLoopStatus.put("notification", "OPERATION");
-vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+vcpeClosedLoopStatus.put("notification", "OPERATION");
+vcpeClosedLoopStatus.put("notificationTime", java.lang.System
+ .currentTimeMillis());
executor.outFields.put("APPCLCMRequestEvent", appcRequest);
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js
index afaa72536..75ab6a3af 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/APPCRestartVNFResponseTask.js
@@ -32,29 +32,46 @@ var appcResponse = executor.inFields.get("APPCLCMResponseEvent");
var requestIDString = appcResponse.getCorrelationId().substr(0, 36);
executor.logger.info("requestIDString = " + requestIDString);
-var vnfID = executor.getContextAlbum("RequestIDVNFIDAlbum").get(requestIDString);
-executor.logger.info("Size of RequestIDVNFIDAlbum = " + executor.getContextAlbum("RequestIDVNFIDAlbum").size());
+var vnfID = executor.getContextAlbum("RequestIDVNFIDAlbum")
+ .get(requestIDString);
+executor.logger.info("Size of RequestIDVNFIDAlbum = "
+ + executor.getContextAlbum("RequestIDVNFIDAlbum").size());
executor.logger.info("vnfID = " + vnfID);
var returnValue = executor.isTrue;
if (vnfID != null) {
- var vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(vnfID.toString());
- var requestId = java.util.UUID.fromString(vcpeClosedLoopStatus.get("requestID"));
+ var vcpeClosedLoopStatus = executor.getContextAlbum(
+ "VCPEClosedLoopStatusAlbum").get(vnfID.toString());
+ var requestId = java.util.UUID.fromString(vcpeClosedLoopStatus
+ .get("requestID"));
- vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis());
+ vcpeClosedLoopStatus.put("notificationTime", java.lang.System
+ .currentTimeMillis());
- executor.logger.info("Got from APPC code: " + org.onap.policy.appclcm.LcmResponseCode.toResponseValue(appcResponse.getBody().getStatus().getCode()));
+ executor.logger.info("Got from APPC code: "
+ + org.onap.policy.appclcm.AppcLcmResponseCode
+ .toResponseValue(appcResponse.getBody().getOutput()
+ .getStatus().getCode()));
- if (org.onap.policy.appclcm.LcmResponseCode.toResponseValue(appcResponse.getBody().getStatus().getCode()) == org.onap.policy.appclcm.LcmResponseCode.SUCCESS) {
+ if (org.onap.policy.appclcm.AppcLcmResponseCode
+ .toResponseValue(appcResponse.getBody().getOutput().getStatus()
+ .getCode()) == org.onap.policy.appclcm.AppcLcmResponseCode.SUCCESS) {
vcpeClosedLoopStatus.put("notification", "OPERATION_SUCCESS");
vcpeClosedLoopStatus.put("message", "vCPE restarted");
executor.getContextAlbum("RequestIDVNFIDAlbum").remove(requestIDString);
- } else if (org.onap.policy.appclcm.LcmResponseCode.toResponseValue(appcResponse.getBody().getStatus().getCode()) == "ACCEPTED" ||
- org.onap.policy.appclcm.LcmResponseCode.toResponseValue(appcResponse.getBody().getStatus().getCode()) == "REJECT" ) {
- executor.logger.info("Got ACCEPTED 100 or REJECT 312, keep the context, wait for next response. Code is: " + org.onap.policy.appclcm.LcmResponseCode.toResponseValue(appcResponse.getBody().getStatus().getCode()));
- }
- else {
+ } else if (org.onap.policy.appclcm.AppcLcmResponseCode
+ .toResponseValue(appcResponse.getBody().getOutput().getStatus()
+ .getCode()) == "ACCEPTED"
+ || org.onap.policy.appclcm.AppcLcmResponseCode
+ .toResponseValue(appcResponse.getBody().getOutput()
+ .getStatus().getCode()) == "REJECT") {
+ executor.logger
+ .info("Got ACCEPTED 100 or REJECT 312, keep the context, wait for next response. Code is: "
+ + org.onap.policy.appclcm.AppcLcmResponseCode
+ .toResponseValue(appcResponse.getBody()
+ .getOutput().getStatus().getCode()));
+ } else {
executor.getContextAlbum("RequestIDVNFIDAlbum").remove(requestIDString);
vcpeClosedLoopStatus.put("notification", "OPERATION_FAILURE");
vcpeClosedLoopStatus.put("message", "vCPE restart failed");
@@ -63,7 +80,8 @@ if (vnfID != null) {
executor.outFields.put("requestID", requestId);
executor.outFields.put("vnfID", vnfID);
} else {
- executor.message = "VNF ID not found in context album for request ID " + requestIDString;
+ executor.message = "VNF ID not found in context album for request ID "
+ + requestIDString;
returnValue = executor.isFalse;
}
diff --git a/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js b/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js
index d42aef9d0..aa816ca95 100644
--- a/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js
+++ b/examples/examples-onap-vcpe/src/main/resources/logic/ControlLoopLogTask.js
@@ -39,7 +39,7 @@ clNotification.setClosedLoopAlarmEnd(java.time.Instant.ofEpochMilli(vcpeClosedLo
clNotification.setClosedLoopEventClient(vcpeClosedLoopStatus.get("closedLoopEventClient"));
clNotification.setVersion(vcpeClosedLoopStatus.get("version"));
clNotification.setRequestId(java.util.UUID.fromString(vcpeClosedLoopStatus.get("requestID")));
-clNotification.setTargetType(org.onap.policy.controlloop.ControlLoopTargetType.toType(vcpeClosedLoopStatus.get("target_type")));
+clNotification.setTargetType(vcpeClosedLoopStatus.get("target_type"));
clNotification.setTarget(org.onap.policy.controlloop.ControlLoopEventStatus.toStatus(vcpeClosedLoopStatus.get("target")));
clNotification.setFrom(vcpeClosedLoopStatus.get("from"));
clNotification.setPolicyScope(vcpeClosedLoopStatus.get("policyScope"));