diff options
author | s00370346 <swarup.nayak1@huawei.com> | 2019-04-17 23:32:08 +0530 |
---|---|---|
committer | s00370346 <swarup.nayak1@huawei.com> | 2019-04-22 10:20:54 +0530 |
commit | 39f7edcc4a181394b8895aef8b4b43a8a19b045b (patch) | |
tree | bb6445f96fcea9abf7391c45a29735b93bdc683c /examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js | |
parent | e5f139e3c865eb429dc11a987ad7a01b759c6692 (diff) |
ONAP BBS: Apex Nomadic ONT bug fixes
Issue-ID: DCAEGEN2-1237
Change-Id: I739f8e55113793f5cd4d3b70e0a1296d775bb414
Signed-off-by: s00370346 <swarup.nayak1@huawei.com>
Diffstat (limited to 'examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js')
-rw-r--r-- | examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js | 135 |
1 files changed, 74 insertions, 61 deletions
diff --git a/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js b/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js index 06b11acd5..57fe182e1 100644 --- a/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js +++ b/examples/examples-onap-bbs/src/main/resources/logic/GetBBSCloseLoopEventTask.js @@ -17,7 +17,6 @@ * SPDX-License-Identifier: Apache-2.0 * ============LICENSE_END========================================================= */ - load("nashorn:mozilla_compat.js"); executor.logger.info("Begin Execution GetBBSCloseLoopEventTask.js"); @@ -25,9 +24,8 @@ executor.logger.info(executor.subject.id); executor.logger.info(executor.inFields); var returnValue = executor.isTrue; -//**************************************************************************// - -var clEventType = Java.type("org.onap.policy.controlloop.VirtualControlLoopEvent"); +var clEventType = Java.type( + "org.onap.policy.controlloop.VirtualControlLoopEvent"); var clEvent = executor.inFields.get("VirtualControlLoopEvent"); executor.logger.info(clEvent.toString()); executor.logger.info(clEvent.getClosedLoopControlName()); @@ -35,65 +33,80 @@ executor.logger.info(clEvent.getClosedLoopControlName()); var requestID = clEvent.getRequestId(); executor.logger.info("requestID = " + requestID); var attachmentPoint = null; -var vcpeClosedLoopStatus = null; +var NomadicONTContext = null; var serviceInstanceId = null; if (clEvent.getAai().get("attachmentPoint") != null) { - attachmentPoint = clEvent.getAai().get("attachmentPoint"); - executor.logger.info("attachmentPoint = " + attachmentPoint); - vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").get(attachmentPoint); - serviceInstanceId = clEvent.getAai().get("service-information.hsia-cfs-service-instance-id"); - executor.logger.info("serviceInstanceId = " + serviceInstanceId); - - if (vcpeClosedLoopStatus == null) { - executor.logger.info("Creating context information for new ONT Device \"" + attachmentPoint.toString() + "\""); - - vcpeClosedLoopStatus = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").getSchemaHelper().createNewInstance(); - - vcpeClosedLoopStatus.put("closedLoopControlName", clEvent.getClosedLoopControlName()); - vcpeClosedLoopStatus.put("closedLoopAlarmStart", clEvent.getClosedLoopAlarmStart().toEpochMilli()); - vcpeClosedLoopStatus.put("closedLoopEventClient", clEvent.getClosedLoopEventClient()); - vcpeClosedLoopStatus.put("closedLoopEventStatus", clEvent.getClosedLoopEventStatus().toString()); - vcpeClosedLoopStatus.put("version", clEvent.getVersion()); - vcpeClosedLoopStatus.put("requestID", clEvent.getRequestId().toString()); - vcpeClosedLoopStatus.put("target_type", clEvent.getTargetType().toString()); - vcpeClosedLoopStatus.put("target", clEvent.getTarget()); - vcpeClosedLoopStatus.put("from", clEvent.getFrom()); - vcpeClosedLoopStatus.put("policyScope", "Nomadic ONT"); - vcpeClosedLoopStatus.put("policyName", clEvent.getPolicyName()); - vcpeClosedLoopStatus.put("policyVersion", "1.0.0"); - vcpeClosedLoopStatus.put("notificationTime", java.lang.System.currentTimeMillis()); - vcpeClosedLoopStatus.put("message", ""); - vcpeClosedLoopStatus.put("result", "SUCCESS"); - var aaiInfo = executor.getContextAlbum("VCPEClosedLoopStatusAlbum").getSchemaHelper().createNewSubInstance("VCPE_AAI_Type"); - - aaiInfo.put("attachmentPoint", clEvent.getAai().get("attachmentPoint")); - aaiInfo.put("cvlan", clEvent.getAai().get("cvlan")); - aaiInfo.put("service_information_hsia_cfs_service_instance_id", clEvent.getAai().get("service-information.hsia-cfs-service-instance-id")); - aaiInfo.put("svlan", clEvent.getAai().get("svlan")); - aaiInfo.put("remoteId", clEvent.getAai().get("remoteId")); - - - vcpeClosedLoopStatus.put("AAI", aaiInfo); - - if (clEvent.getClosedLoopAlarmEnd() != null) { - vcpeClosedLoopStatus.put("closedLoopAlarmEnd", clEvent.getClosedLoopAlarmEnd().toEpochMilli()); - } else { - vcpeClosedLoopStatus.put("closedLoopAlarmEnd", java.lang.Long.valueOf(0)); - } - - executor.getContextAlbum("VCPEClosedLoopStatusAlbum").put(attachmentPoint.toString(), vcpeClosedLoopStatus); - executor.logger.info("Created context information for new vCPE VNF \"" + attachmentPoint.toString() + "\""); - } - - executor.outFields.put("requestID", requestID); - executor.outFields.put("attachmentPoint", attachmentPoint); - executor.outFields.put("serviceInstanceId", attachmentPoint); - executor.logger.info(executor.outFields); + attachmentPoint = clEvent.getAai().get("attachmentPoint"); + executor.logger.info("attachmentPoint = " + attachmentPoint); + NomadicONTContext = executor.getContextAlbum("NomadicONTContextAlbum").get( + attachmentPoint); + serviceInstanceId = clEvent.getAai().get( + "service-information.hsia-cfs-service-instance-id"); + executor.logger.info("serviceInstanceId = " + serviceInstanceId); + + if (NomadicONTContext == null) { + executor.logger.info( + "Creating context information for new ONT Device \"" + + attachmentPoint.toString() + "\""); + + NomadicONTContext = executor.getContextAlbum("NomadicONTContextAlbum").getSchemaHelper() + .createNewInstance(); + + NomadicONTContext.put("closedLoopControlName", clEvent.getClosedLoopControlName()); + NomadicONTContext.put("closedLoopAlarmStart", clEvent.getClosedLoopAlarmStart() + .toEpochMilli()); + NomadicONTContext.put("closedLoopEventClient", clEvent.getClosedLoopEventClient()); + NomadicONTContext.put("closedLoopEventStatus", clEvent.getClosedLoopEventStatus() + .toString()); + NomadicONTContext.put("version", clEvent.getVersion()); + NomadicONTContext.put("requestID", clEvent.getRequestId().toString()); + NomadicONTContext.put("target_type", clEvent.getTargetType().toString()); + NomadicONTContext.put("target", clEvent.getTarget()); + NomadicONTContext.put("from", clEvent.getFrom()); + NomadicONTContext.put("policyScope", "Nomadic ONT"); + NomadicONTContext.put("policyName", clEvent.getPolicyName()); + NomadicONTContext.put("policyVersion", "1.0.0"); + NomadicONTContext.put("notificationTime", java.lang.System.currentTimeMillis()); + NomadicONTContext.put("message", ""); + NomadicONTContext.put("result", "SUCCESS"); + var aaiInfo = executor.getContextAlbum("NomadicONTContextAlbum").getSchemaHelper() + .createNewSubInstance("VCPE_AAI_Type"); + + aaiInfo.put("attachmentPoint", clEvent.getAai().get("attachmentPoint")); + aaiInfo.put("cvlan", clEvent.getAai().get("cvlan")); + aaiInfo.put("service_information_hsia_cfs_service_instance_id", clEvent + .getAai().get( + "service-information.hsia-cfs-service-instance-id")); + aaiInfo.put("svlan", clEvent.getAai().get("svlan")); + aaiInfo.put("remoteId", clEvent.getAai().get("remoteId")); + + + NomadicONTContext.put("AAI", aaiInfo); + + if (clEvent.getClosedLoopAlarmEnd() != null) { + NomadicONTContext.put("closedLoopAlarmEnd", clEvent.getClosedLoopAlarmEnd() + .toEpochMilli()); + } else { + NomadicONTContext.put("closedLoopAlarmEnd", java.lang.Long.valueOf( + 0)); + } + + executor.getContextAlbum("NomadicONTContextAlbum").put(attachmentPoint.toString(), + NomadicONTContext); + executor.logger.info("Created context information for new vCPE VNF \"" + + attachmentPoint.toString() + "\""); + } + + executor.outFields.put("requestID", requestID); + executor.outFields.put("attachmentPoint", attachmentPoint); + executor.outFields.put("serviceInstanceId", serviceInstanceId); + executor.logger.info(executor.outFields); + executor.logger.info("Event Successfully Received and stored in album"); +} +else +{ + executor.message = "Received NULL attachment-point"; + returnValue = executor.isFalse; } - -executor.logger.info("********************* Event Successfully Received and stored in album *********************"); - -//**************************************************************************// - |