diff options
3 files changed, 40 insertions, 2 deletions
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 * diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java index 7ae0e7eb2..90e6e8753 100644 --- a/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java +++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java @@ -3,6 +3,7 @@ * guard * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. 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. @@ -108,6 +109,12 @@ public class PolicyGuard { // Create the Lock object // return new VnfTargetLock(targetType, targetInstance, requestId, callback); + + case VFMODULE: + // + // Create the Lock object + // + return new VnfTargetLock(targetType, targetInstance, requestId, callback); default: logger.error("invalid target type {} for lock on {}", targetType, targetInstance); return null; diff --git a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml index f57a6d62b..c6125d082 100644 --- a/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml +++ b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml @@ -28,7 +28,12 @@ policies: actor: SO recipe: VF Module Create target: - type: VNF + type: VFMODULE + modelInvariantId: 90b793b5-b8ae-4c36-b10b-4b6372859d3a + modelVersionId: 2210154d-e61a-4d7f-8fb9-0face1aee3f8 + modelName: SproutScalingVf..scaling_sprout..module-1 + modelVersion: 1 + modelCustomizationId: 3e2d67ad-3495-4732-82f6-b0b872791fff payload: requestParameters: '{"usePreload":true,"userParams":[]}' configurationParameters: '[{"ip-addr":"$.vf-module-topology.vf-module-parameters.param[9]","oam-ip-addr":"$.vf-module-topology.vf-module-parameters.param[16]","enabled":"$.vf-module-topology.vf-module-parameters.param[23]"}]' |