From e126a975d8c6f3970dbf87ead79fa69afe510301 Mon Sep 17 00:00:00 2001
From: daniel <dc443y@att.com>
Date: Mon, 11 Sep 2017 14:42:59 -0500
Subject: Add Support for Locking VNF Target Types

Fixed the target lock to support vnf target_types.
Generic-vnf.vnf-id and generic-vnf.vnf-name are also
supported when retrieving the target instance from the onset.
These changes are relfected in the vFW and vCPE junits as
they now work with VNF target types.

Issue-ID: POLICY-222
Change-Id: I92abeb02c769d35f3a9912cce6eaaec4c9cc8efb
Signed-off-by: Daniel Cruz <dc443y@att.com>
---
 .../policy/controlloop/eventmanager/ControlLoopEventManager.java  | 8 ++++++++
 1 file changed, 8 insertions(+)

(limited to 'controlloop/common/eventmanager/src/main/java')

diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
index b61eabc4b..0fe97bca9 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopEventManager.java
@@ -531,6 +531,7 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
 			if (! event.target.equalsIgnoreCase("VM_NAME") &&
 				! event.target.equalsIgnoreCase("VNF_NAME") &&
 				! event.target.equalsIgnoreCase("vserver.vserver-name") &&
+				! event.target.equalsIgnoreCase("generic-vnf.vnf-id") &&
 				! event.target.equalsIgnoreCase("generic-vnf.vnf-name") ) {
 				throw new ControlLoopException("target field invalid - expecting VM_NAME or VNF_NAME");
 			}
@@ -556,9 +557,16 @@ public class ControlLoopEventManager implements LockCallback, Serializable {
 				case PNF:
 					break;
 				case VM:
+				case VNF:
 					if (this.onset.target.equalsIgnoreCase("vserver.vserver-name")) {
 						return this.onset.AAI.get("vserver.vserver-name");
 					}
+					else if (this.onset.target.equalsIgnoreCase("generic-vnf.vnf-id")) {
+					    return this.onset.AAI.get("generic-vnf.vnf-id");
+					}
+					else if (this.onset.target.equalsIgnoreCase("generic-vnf.vnf-name")) {
+					    return this.onset.AAI.get("generic-vnf.vnf-name");
+					}
 					break;
 				default:
 					break;
-- 
cgit 1.2.3-korg