diff options
author | daniel <dc443y@att.com> | 2017-10-24 06:33:31 -0500 |
---|---|---|
committer | daniel <dc443y@att.com> | 2017-10-24 13:16:10 -0500 |
commit | 1480d327ff8559c1d912108f7d3353fed03fcd2c (patch) | |
tree | 8745bec65ea2ee8962f42048ed0362961d0dfc60 /controlloop/common/actors/actor.appc/src/main/java | |
parent | baea880ddf0564d81d61bf87ae7f124229bf08f0 (diff) |
Change vnf-id to vnf-name
These changes now allow a lookup of the source vnf-id
based on the onset's vnf-name.
Issue-Id: POLICY-366
Change-Id: I6f6bd500b892dddbbb9e12156b4486208309e21d
Signed-off-by: Daniel Cruz <dc443y@att.com>
Diffstat (limited to 'controlloop/common/actors/actor.appc/src/main/java')
-rw-r--r-- | controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java b/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java index 6ae62bbcd..44411ca72 100644 --- a/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java +++ b/controlloop/common/actors/actor.appc/src/main/java/org/onap/policy/controlloop/actor/appc/APPCActorServiceProvider.java @@ -25,6 +25,7 @@ import java.util.List; import org.onap.policy.controlloop.VirtualControlLoopEvent; import org.onap.policy.controlloop.actor.appclcm.AppcLcmActorServiceProvider; +import org.onap.policy.aai.AAIGETVnfResponse; import org.onap.policy.aai.util.AAIException; import org.onap.policy.appc.CommonHeader; import org.onap.policy.appc.Request; @@ -89,7 +90,8 @@ public class APPCActorServiceProvider implements Actor { * @return an APPC request conforming to the legacy API * @throws AAIException */ - public static Request constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy) throws AAIException { + public static Request constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, + Policy policy, AAIGETVnfResponse vnfResponse) throws AAIException { /* * Construct an APPC request */ @@ -105,24 +107,24 @@ public class APPCActorServiceProvider implements Actor { * specified in the yaml, the target vnf-id is retrieved by * a named query to A&AI. */ - String vnfId; - if (onset.AAI.get("generic-vnf.vnf-id").equalsIgnoreCase(policy.getTarget().getResourceID())) { - vnfId = onset.AAI.get("generic-vnf.vnf-id"); + String sourceVnf = onset.AAI.get("generic-vnf.vnf-id"); + if (sourceVnf == null) { + /* + * Lets see if the vnf-name is provided + */ + sourceVnf = vnfResponse.vnfID; + if (sourceVnf == null) { + throw new AAIException("No vnf-id found"); + } } - else { - vnfId = AppcLcmActorServiceProvider.vnfNamedQuery( - policy.getTarget().getResourceID(), onset.AAI.get("generic-vnf.vnf-id")); - } - - if (vnfId == null) { - throw new AAIException("No vnf id found"); - } - + String targetVnf = AppcLcmActorServiceProvider.vnfNamedQuery( + policy.getTarget().getResourceID(), sourceVnf); + /* * For now Policy generates the PG Streams as a demo, in the * future the payload can be provided by CLAMP */ - request.Payload.put("generic-vnf.vnf-id", vnfId); + request.Payload.put("generic-vnf.vnf-id", targetVnf); PGRequest pgRequest = new PGRequest(); pgRequest.pgStreams = new PGStreams(); |