From 92fc7744a4df901d1688b9fa8da899372ea76fd8 Mon Sep 17 00:00:00 2001 From: "vamshi.nemalikonda" Date: Wed, 10 Apr 2019 16:37:08 +0530 Subject: Parse new model ids from operation policy Takes VFModule info from policy yaml,instead AAI. Change-Id: If745b3ba32562cbc37571cea29ec7797ee697e88 Issue-ID: POLICY-1545 Signed-off-by: vamshi.nemalikonda --- .../eventmanager/ControlLoopOperationManager.java | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'controlloop/common/eventmanager/src/main') diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java index 8b7b15909..7bd0a0e54 100644 --- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java +++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2019 Huawei Technologies Co., Ltd. All rights reserved. + * Modifications Copyright (C) 2019 Tech Mahindra * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -227,6 +228,31 @@ public class ControlLoopOperationManager implements Serializable { return vnfId; } throw new ControlLoopException("Target does not match target type"); + case VFMODULE: + VirtualControlLoopEvent virtualOnsetEvent = (VirtualControlLoopEvent) this.onset; + if (this.onset.getTarget().equalsIgnoreCase(VSERVER_VSERVER_NAME)) { + return virtualOnsetEvent.getAai().get(VSERVER_VSERVER_NAME); + } else if (this.onset.getTarget().equalsIgnoreCase(GENERIC_VNF_VNF_ID)) { + return virtualOnsetEvent.getAai().get(GENERIC_VNF_VNF_ID); + } else if (this.onset.getTarget().equalsIgnoreCase(GENERIC_VNF_VNF_NAME)) { + /* + * If the onset is enriched with the vnf-id, we don't need an A&AI response + */ + if (virtualOnsetEvent.getAai().containsKey(GENERIC_VNF_VNF_ID)) { + return virtualOnsetEvent.getAai().get(GENERIC_VNF_VNF_ID); + } + + /* + * If the vnf-name was retrieved from the onset then the vnf-id must be obtained + * from the event manager's A&AI GET query + */ + String vnfId = this.eventManager.getVnfResponse().getVnfId(); + if (vnfId == null) { + throw new AaiException("No vnf-id found"); + } + return vnfId; + } + throw new ControlLoopException("Target does not match target type"); default: throw new ControlLoopException("The target type is not supported"); } @@ -989,7 +1015,7 @@ public class ControlLoopOperationManager implements Serializable { /** * Construct a ControlLoopResponse object from actor response and input event. - * + * * @param response the response from actor * @param event the input event * -- cgit 1.2.3-korg