diff options
Diffstat (limited to 'examples/examples-onap-vcpe/src/main')
8 files changed, 62 insertions, 66 deletions
diff --git a/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig.json b/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig.json index 862bba296..ce97eeb09 100644 --- a/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig.json +++ b/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig.json @@ -24,14 +24,6 @@ "Instant": { "adaptedClass": "java.time.Instant", "adaptorClass": "org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter" - }, - "APPC_LCM_REQUEST": { - "adaptedClass": "org.onap.policy.appclcm.LcmRequest", - "adaptorClass": "org.onap.policy.appclcm.util.Serialization$RequestAdapter" - }, - "APPC_LCM_RESPONSE": { - "adaptedClass": "org.onap.policy.appclcm.LcmResponse", - "adaptorClass": "org.onap.policy.appclcm.util.Serialization$ResponseAdapter" } } } diff --git a/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfigStdin.json b/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfigStdin.json index 12d72bccb..aa37f7ab2 100644 --- a/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfigStdin.json +++ b/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfigStdin.json @@ -24,14 +24,6 @@ "Instant": { "adaptedClass": "java.time.Instant", "adaptorClass": "org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter" - }, - "APPC_LCM_REQUEST": { - "adaptedClass": "org.onap.policy.appclcm.LcmRequest", - "adaptorClass": "org.onap.policy.appclcm.util.Serialization$RequestAdapter" - }, - "APPC_LCM_RESPONSE": { - "adaptedClass": "org.onap.policy.appclcm.LcmResponse", - "adaptorClass": "org.onap.policy.appclcm.util.Serialization$ResponseAdapter" } } } diff --git a/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig_Sim.json b/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig_Sim.json index 5bae09e7e..46c03af05 100644 --- a/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig_Sim.json +++ b/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig_Sim.json @@ -24,14 +24,6 @@ "Instant": { "adaptedClass": "java.time.Instant", "adaptorClass": "org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter" - }, - "APPC_LCM_REQUEST": { - "adaptedClass": "org.onap.policy.appclcm.LcmRequest", - "adaptorClass": "org.onap.policy.appclcm.util.Serialization$RequestAdapter" - }, - "APPC_LCM_RESPONSE": { - "adaptedClass": "org.onap.policy.appclcm.LcmResponse", - "adaptorClass": "org.onap.policy.appclcm.util.Serialization$ResponseAdapter" } } } diff --git a/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig_Sim_StdIO.json b/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig_Sim_StdIO.json index a903cb3c2..052568111 100644 --- a/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig_Sim_StdIO.json +++ b/examples/examples-onap-vcpe/src/main/resources/examples/config/ONAPvCPE/ApexConfig_Sim_StdIO.json @@ -24,14 +24,6 @@ "Instant": { "adaptedClass": "java.time.Instant", "adaptorClass": "org.onap.policy.controlloop.util.Serialization$GsonInstantAdapter" - }, - "APPC_LCM_REQUEST": { - "adaptedClass": "org.onap.policy.appclcm.LcmRequest", - "adaptorClass": "org.onap.policy.appclcm.util.Serialization$RequestAdapter" - }, - "APPC_LCM_RESPONSE": { - "adaptedClass": "org.onap.policy.appclcm.LcmResponse", - "adaptorClass": "org.onap.policy.appclcm.util.Serialization$ResponseAdapter" } } } 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")); diff --git a/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex b/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex index 490c4ad7c..571cea9cc 100644 --- a/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex +++ b/examples/examples-onap-vcpe/src/main/resources/policy/ONAPvCPEPolicyModel.apex @@ -31,8 +31,8 @@ schema create name=VirtualControlLoopNotificationType flavour=Java schema=org.on schema create name=AAIServiceNamedQueryRequestType flavour=Java schema=org.onap.policy.aai.AaiNqRequest schema create name=AAIServiceNamedQueryResponseType flavour=Java schema=org.onap.policy.aai.AaiNqResponse -schema create name=APPCLCMRequestType flavour=Java schema=org.onap.policy.appclcm.LcmRequestWrapper -schema create name=APPCLCMResponseType flavour=Java schema=org.onap.policy.appclcm.LcmResponseWrapper +schema create name=APPCLCMRequestType flavour=Java schema=org.onap.policy.appclcm.AppcLcmDmaapWrapper +schema create name=APPCLCMResponseType flavour=Java schema=org.onap.policy.appclcm.AppcLcmDmaapWrapper schema create name=GuardDecisionAttributesType flavour=Avro schema=LS #MACROFILE:"src/main/resources/schemas/GuardDecisionAttributesType.avsc" |