2 * ============LICENSE_START=======================================================
3 * controlloop event manager
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.policy.controlloop.eventmanager;
23 import java.io.Serializable;
24 import java.io.UnsupportedEncodingException;
25 import java.net.URLDecoder;
26 import java.util.ArrayList;
27 import java.util.Collection;
28 import java.util.LinkedList;
29 import java.util.UUID;
31 import org.onap.policy.aai.AaiGetVnfResponse;
32 import org.onap.policy.aai.AaiGetVserverResponse;
33 import org.onap.policy.aai.AaiManager;
34 import org.onap.policy.aai.util.AaiException;
35 import org.onap.policy.controlloop.ControlLoopEventStatus;
36 import org.onap.policy.controlloop.ControlLoopException;
37 import org.onap.policy.controlloop.ControlLoopNotificationType;
38 import org.onap.policy.controlloop.ControlLoopOperation;
39 import org.onap.policy.controlloop.VirtualControlLoopEvent;
40 import org.onap.policy.controlloop.VirtualControlLoopNotification;
41 import org.onap.policy.controlloop.policy.FinalResult;
42 import org.onap.policy.controlloop.policy.Policy;
43 import org.onap.policy.controlloop.processor.ControlLoopProcessor;
44 import org.onap.policy.drools.system.PolicyEngine;
45 import org.onap.policy.guard.GuardResult;
46 import org.onap.policy.guard.LockCallback;
47 import org.onap.policy.guard.PolicyGuard;
48 import org.onap.policy.guard.PolicyGuard.LockResult;
49 import org.onap.policy.guard.TargetLock;
50 import org.onap.policy.rest.RESTManager;
51 import org.slf4j.Logger;
52 import org.slf4j.LoggerFactory;
54 public class ControlLoopEventManager implements LockCallback, Serializable {
55 private static final String VM_NAME = "VM_NAME";
56 private static final String VNF_NAME = "VNF_NAME";
57 private static final String GENERIC_VNF_VNF_ID = "generic-vnf.vnf-id";
58 private static final String GENERIC_VNF_VNF_NAME = "generic-vnf.vnf-name";
59 private static final String VSERVER_VSERVER_NAME = "vserver.vserver-name";
60 private static final String GENERIC_VNF_IS_CLOSED_LOOP_DISABLED = "generic-vnf.is-closed-loop-disabled";
61 private static final String VSERVER_IS_CLOSED_LOOP_DISABLED = "vserver.is-closed-loop-disabled";
63 private static final Logger logger = LoggerFactory.getLogger(ControlLoopEventManager.class);
65 private static final long serialVersionUID = -1216568161322872641L;
66 public final String closedLoopControlName;
67 public final UUID requestID;
69 private String controlLoopResult;
70 private transient ControlLoopProcessor processor = null;
71 private VirtualControlLoopEvent onset;
72 private Integer numOnsets = 0;
73 private Integer numAbatements = 0;
74 private VirtualControlLoopEvent abatement;
75 private FinalResult controlLoopTimedOut = null;
77 private boolean isActivated = false;
78 private LinkedList<ControlLoopOperation> controlLoopHistory = new LinkedList<>();
79 private ControlLoopOperationManager currentOperation = null;
80 private transient TargetLock targetLock = null;
81 private AaiGetVnfResponse vnfResponse = null;
82 private AaiGetVserverResponse vserverResponse = null;
83 private static String aaiHostURL;
84 private static String aaiUser;
85 private static String aaiPassword;
87 private static Collection<String> requiredAAIKeys = new ArrayList<>();
90 requiredAAIKeys.add("AICVServerSelfLink");
91 requiredAAIKeys.add("AICIdentity");
92 requiredAAIKeys.add("is_closed_loop_disabled");
93 requiredAAIKeys.add(VM_NAME);
96 public ControlLoopEventManager(String closedLoopControlName, UUID requestID) {
97 this.closedLoopControlName = closedLoopControlName;
98 this.requestID = requestID;
101 public String getControlLoopResult() {
102 return controlLoopResult;
105 public void setControlLoopResult(String controlLoopResult) {
106 this.controlLoopResult = controlLoopResult;
109 public Integer getNumOnsets() {
113 public void setNumOnsets(Integer numOnsets) {
114 this.numOnsets = numOnsets;
117 public Integer getNumAbatements() {
118 return numAbatements;
121 public void setNumAbatements(Integer numAbatements) {
122 this.numAbatements = numAbatements;
125 public boolean isActivated() {
129 public void setActivated(boolean isActivated) {
130 this.isActivated = isActivated;
133 public VirtualControlLoopEvent getOnsetEvent() {
137 public VirtualControlLoopEvent getAbatementEvent() {
138 return this.abatement;
141 public ControlLoopProcessor getProcessor() {
142 return this.processor;
146 * Activate a control loop event.
148 * @param event the event
149 * @return the VirtualControlLoopNotification
151 public VirtualControlLoopNotification activate(VirtualControlLoopEvent event) {
152 VirtualControlLoopNotification notification = new VirtualControlLoopNotification(event);
155 // This method should ONLY be called ONCE
157 if (this.isActivated) {
158 throw new ControlLoopException("ControlLoopEventManager has already been activated.");
161 // Syntax check the event
163 checkEventSyntax(event);
166 // At this point we are good to go with this event
171 notification.setNotification(ControlLoopNotificationType.ACTIVE);
173 // Set ourselves as active
175 this.isActivated = true;
176 } catch (ControlLoopException e) {
177 logger.error("{}: activate by event threw: ", this, e);
178 notification.setNotification(ControlLoopNotificationType.REJECTED);
179 notification.setMessage(e.getMessage());
185 * Activate a control loop event.
187 * @param yamlSpecification the yaml specification
188 * @param event the event
189 * @return the VirtualControlLoopNotification
191 public VirtualControlLoopNotification activate(String yamlSpecification, VirtualControlLoopEvent event) {
192 VirtualControlLoopNotification notification = new VirtualControlLoopNotification(event);
195 // This method should ONLY be called ONCE
197 if (this.isActivated) {
198 throw new ControlLoopException("ControlLoopEventManager has already been activated.");
201 // Syntax check the event
203 checkEventSyntax(event);
208 if (yamlSpecification == null || yamlSpecification.length() < 1) {
209 throw new ControlLoopException("yaml specification is null or 0 length");
211 } catch (ControlLoopException e) {
212 logger.error("{}: activate by YAML specification and event threw: ", this, e);
213 notification.setNotification(ControlLoopNotificationType.REJECTED);
214 notification.setMessage(e.getMessage());
218 String decodedYaml = null;
220 decodedYaml = URLDecoder.decode(yamlSpecification, "UTF-8");
221 if (decodedYaml != null && decodedYaml.length() > 0) {
222 yamlSpecification = decodedYaml;
224 } catch (UnsupportedEncodingException e) {
225 logger.error("{}: YAML decode in activate by YAML specification and event threw: ", this, e);
226 notification.setNotification(ControlLoopNotificationType.REJECTED);
227 notification.setMessage(e.getMessage());
233 // Parse the YAML specification
235 this.processor = new ControlLoopProcessor(yamlSpecification);
238 // At this point we are good to go with this event
245 notification.setNotification(ControlLoopNotificationType.ACTIVE);
247 // Set ourselves as active
249 this.isActivated = true;
250 } catch (ControlLoopException e) {
251 logger.error("{}: activate by YAML specification and event threw: ", this, e);
252 notification.setNotification(ControlLoopNotificationType.REJECTED);
253 notification.setMessage(e.getMessage());
259 * Check if the control loop is final.
261 * @return a VirtualControlLoopNotification if the control loop is final, otherwise
262 * <code>null</code> is returned
263 * @throws ControlLoopException if an error occurs
265 public VirtualControlLoopNotification isControlLoopFinal() throws ControlLoopException {
267 // Check if they activated us
269 if (!this.isActivated) {
270 throw new ControlLoopException("ControlLoopEventManager MUST be activated first.");
273 // Make sure we are expecting this call.
275 if (this.onset == null) {
276 throw new ControlLoopException("No onset event for ControlLoopEventManager.");
279 // Ok, start creating the notification
281 VirtualControlLoopNotification notification = new VirtualControlLoopNotification(this.onset);
283 // Check if the overall control loop has timed out
285 if (this.isControlLoopTimedOut()) {
287 // Yes we have timed out
289 notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
290 notification.setMessage("Control Loop timed out");
291 notification.getHistory().addAll(this.controlLoopHistory);
295 // Check if the current policy is Final
297 FinalResult result = this.processor.checkIsCurrentPolicyFinal();
298 if (result == null) {
300 // we are not at a final result
306 case FINAL_FAILURE_EXCEPTION:
307 notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
308 notification.setMessage("Exception in processing closed loop");
311 case FINAL_FAILURE_RETRIES:
312 case FINAL_FAILURE_TIMEOUT:
313 case FINAL_FAILURE_GUARD:
314 notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
317 notification.setNotification(ControlLoopNotificationType.FINAL_OPENLOOP);
320 notification.setNotification(ControlLoopNotificationType.FINAL_SUCCESS);
326 // Be sure to add all the history
328 notification.getHistory().addAll(this.controlLoopHistory);
333 * Process the control loop.
335 * @return a ControlLoopOperationManager
336 * @throws ControlLoopException if an error occurs
337 * @throws AaiException if an error occurs retrieving information from A&AI
339 public ControlLoopOperationManager processControlLoop() throws ControlLoopException, AaiException {
341 // Check if they activated us
343 if (!this.isActivated) {
344 throw new ControlLoopException("ControlLoopEventManager MUST be activated first.");
347 // Make sure we are expecting this call.
349 if (this.onset == null) {
350 throw new ControlLoopException("No onset event for ControlLoopEventManager.");
353 // Is there a current operation?
355 if (this.currentOperation != null) {
357 // Throw an exception, or simply return the current operation?
359 throw new ControlLoopException("Already working an Operation, do not call this method.");
362 // Ensure we are not FINAL
364 VirtualControlLoopNotification notification = this.isControlLoopFinal();
365 if (notification != null) {
367 // This is weird, we require them to call the isControlLoopFinal() method first
369 // We should really abstract this and avoid throwing an exception, because it really
370 // isn't an exception.
372 throw new ControlLoopException("Control Loop is in FINAL state, do not call this method.");
375 // Not final so get the policy that needs to be worked on.
377 Policy policy = this.processor.getCurrentPolicy();
378 if (policy == null) {
379 throw new ControlLoopException("ControlLoopEventManager: processor came upon null Policy.");
382 // And setup an operation
384 this.currentOperation = new ControlLoopOperationManager(this.onset, policy, this);
388 return this.currentOperation;
392 * Finish an operation.
394 * @param operation the operation
396 public void finishOperation(ControlLoopOperationManager operation) throws ControlLoopException {
398 // Verify we have a current operation
400 if (this.currentOperation != null) {
402 // Validate they are finishing the current operation
403 // PLD - this is simply comparing the policy. Do we want to equals the whole object?
405 if (this.currentOperation.policy.equals(operation.policy)) {
406 logger.debug("Finishing {} result is {}", this.currentOperation.policy.getRecipe(),
407 this.currentOperation.getOperationResult());
411 this.controlLoopHistory.addAll(this.currentOperation.getHistory());
413 // Move to the next Policy
415 this.processor.nextPolicyForResult(this.currentOperation.getOperationResult());
417 // Just null this out
419 this.currentOperation = null;
421 // TODO: Release our lock
425 logger.debug("Cannot finish current operation {} does not match given operation {}",
426 this.currentOperation.policy, operation.policy);
429 throw new ControlLoopException("No operation to finish.");
433 * Obtain a lock for the current operation.
435 * @return the lock result
436 * @throws ControlLoopException if an error occurs
438 public synchronized LockResult<GuardResult, TargetLock> lockCurrentOperation() throws ControlLoopException {
442 if (this.currentOperation == null) {
443 throw new ControlLoopException("Do not have a current operation.");
446 // Have we acquired it already?
448 if (this.targetLock != null) {
450 // TODO: Make sure the current lock is for the same target.
451 // Currently, it should be. But in the future it may not.
453 return new LockResult<>(GuardResult.LOCK_ACQUIRED, this.targetLock);
458 LockResult<GuardResult, TargetLock> lockResult =
459 PolicyGuard.lockTarget(this.currentOperation.policy.getTarget().getType(),
460 this.currentOperation.getTargetEntity(), this.onset.getRequestID(), this);
464 if (lockResult.getA().equals(GuardResult.LOCK_ACQUIRED)) {
466 // Yes, let's save it
468 this.targetLock = lockResult.getB();
475 * Release the lock for the current operation.
477 * @return the target lock
479 public synchronized TargetLock unlockCurrentOperation() {
480 if (this.targetLock == null) {
483 if (PolicyGuard.unlockTarget(this.targetLock)) {
484 TargetLock returnLock = this.targetLock;
485 this.targetLock = null;
491 public enum NEW_EVENT_STATUS {
492 FIRST_ONSET, SUBSEQUENT_ONSET, FIRST_ABATEMENT, SUBSEQUENT_ABATEMENT, SYNTAX_ERROR;
496 * An event onset/abatement.
498 * @param event the event
500 * @throws AaiException if an error occurs retrieving information from A&AI
502 public NEW_EVENT_STATUS onNewEvent(VirtualControlLoopEvent event) throws AaiException {
504 this.checkEventSyntax(event);
505 if (event.getClosedLoopEventStatus() == ControlLoopEventStatus.ONSET) {
507 // Check if this is our original ONSET
509 if (event.equals(this.onset)) {
511 // Query A&AI if needed
518 return NEW_EVENT_STATUS.FIRST_ONSET;
521 // Log that we got an onset
524 return NEW_EVENT_STATUS.SUBSEQUENT_ONSET;
525 } else if (event.getClosedLoopEventStatus() == ControlLoopEventStatus.ABATED) {
527 // Have we already got an abatement?
529 if (this.abatement == null) {
533 this.abatement = event;
535 // Keep track that we received another
537 this.numAbatements++;
541 return NEW_EVENT_STATUS.FIRST_ABATEMENT;
544 // Keep track that we received another
546 this.numAbatements++;
550 return NEW_EVENT_STATUS.SUBSEQUENT_ABATEMENT;
553 } catch (ControlLoopException e) {
554 logger.error("{}: onNewEvent threw: ", this, e);
556 return NEW_EVENT_STATUS.SYNTAX_ERROR;
560 * Set the control loop time out.
562 * @return a VirtualControlLoopNotification
564 public VirtualControlLoopNotification setControlLoopTimedOut() {
565 this.controlLoopTimedOut = FinalResult.FINAL_FAILURE_TIMEOUT;
566 VirtualControlLoopNotification notification = new VirtualControlLoopNotification(this.onset);
567 notification.setNotification(ControlLoopNotificationType.FINAL_FAILURE);
568 notification.setMessage("Control Loop timed out");
569 notification.getHistory().addAll(this.controlLoopHistory);
573 public boolean isControlLoopTimedOut() {
574 return (this.controlLoopTimedOut == FinalResult.FINAL_FAILURE_TIMEOUT);
578 * Get the control loop timeout.
580 * @param defaultTimeout the default timeout
581 * @return the timeout
583 public int getControlLoopTimeout(Integer defaultTimeout) {
584 if (this.processor != null && this.processor.getControlLoop() != null) {
585 return this.processor.getControlLoop().getTimeout();
587 if (defaultTimeout != null) {
588 return defaultTimeout;
593 public AaiGetVnfResponse getVnfResponse() {
597 public AaiGetVserverResponse getVserverResponse() {
598 return vserverResponse;
602 * Check an event syntax.
604 * @param event the event syntax
605 * @throws ControlLoopException if an error occurs
607 public void checkEventSyntax(VirtualControlLoopEvent event) throws ControlLoopException {
608 if (event.getClosedLoopEventStatus() == null
609 || (event.getClosedLoopEventStatus() != ControlLoopEventStatus.ONSET
610 && event.getClosedLoopEventStatus() != ControlLoopEventStatus.ABATED)) {
611 throw new ControlLoopException("Invalid value in closedLoopEventStatus");
613 if (event.getClosedLoopControlName() == null || event.getClosedLoopControlName().length() < 1) {
614 throw new ControlLoopException("No control loop name");
616 if (event.getRequestID() == null) {
617 throw new ControlLoopException("No request ID");
619 if (event.getClosedLoopEventStatus() == ControlLoopEventStatus.ABATED) {
622 if (event.getTarget() == null || event.getTarget().length() < 1) {
623 throw new ControlLoopException("No target field");
624 } else if (!VM_NAME.equalsIgnoreCase(event.getTarget()) && !VNF_NAME.equalsIgnoreCase(event.getTarget())
625 && !VSERVER_VSERVER_NAME.equalsIgnoreCase(event.getTarget())
626 && !GENERIC_VNF_VNF_ID.equalsIgnoreCase(event.getTarget())
627 && !GENERIC_VNF_VNF_NAME.equalsIgnoreCase(event.getTarget())) {
628 throw new ControlLoopException("target field invalid - expecting VM_NAME or VNF_NAME");
630 if (event.getAAI() == null) {
631 throw new ControlLoopException("AAI is null");
633 if (event.getAAI().get(GENERIC_VNF_VNF_ID) == null && event.getAAI().get(VSERVER_VSERVER_NAME) == null
634 && event.getAAI().get(GENERIC_VNF_VNF_NAME) == null) {
635 throw new ControlLoopException(
636 "generic-vnf.vnf-id or generic-vnf.vnf-name or vserver.vserver-name information missing");
641 * Query A&AI for an event.
643 * @param event the event
644 * @throws AaiException if an error occurs retrieving information from A&AI
646 public void queryAai(VirtualControlLoopEvent event) throws AaiException {
647 if ((event.getAAI().get(VSERVER_IS_CLOSED_LOOP_DISABLED) != null
648 || event.getAAI().get(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED) != null) && isClosedLoopDisabled(event)) {
649 throw new AaiException("is-closed-loop-disabled is set to true on VServer or VNF");
653 if (event.getAAI().get(GENERIC_VNF_VNF_ID) != null || event.getAAI().get(GENERIC_VNF_VNF_NAME) != null) {
654 vnfResponse = getAAIVnfInfo(event);
655 processVNFResponse(vnfResponse, event.getAAI().get(GENERIC_VNF_VNF_ID) != null);
656 } else if (event.getAAI().get(VSERVER_VSERVER_NAME) != null) {
657 vserverResponse = getAAIVserverInfo(event);
658 processVServerResponse(vserverResponse);
660 } catch (Exception e) {
661 logger.error("Exception from queryAai: ", e);
662 throw new AaiException("Exception from queryAai: " + e.toString());
667 * Process a response from A&AI for a VNF.
669 * @param aaiResponse the response from A&AI
670 * @param queryByVnfId <code>true</code> if the query was based on vnf-id, <code>false</code> if
671 * the query was based on vnf-name
672 * @throws AaiException if an error occurs processing the response
674 private static void processVNFResponse(AaiGetVnfResponse aaiResponse, boolean queryByVNFID) throws AaiException {
675 String queryTypeString = (queryByVNFID ? "vnf-id" : "vnf-name");
677 if (aaiResponse == null) {
678 throw new AaiException("AAI Response is null (query by " + queryTypeString + ")");
680 if (aaiResponse.getRequestError() != null) {
681 throw new AaiException("AAI Responded with a request error (query by " + queryTypeString + ")");
684 if (aaiResponse.getIsClosedLoopDisabled() != null) {
685 String value = aaiResponse.getIsClosedLoopDisabled();
686 if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value)
687 || "Y".equalsIgnoreCase(value)) {
688 throw new AaiException("is-closed-loop-disabled is set to true (query by " + queryTypeString + ")");
693 private static void processVServerResponse(AaiGetVserverResponse aaiResponse) throws AaiException {
694 if (aaiResponse == null) {
695 throw new AaiException("AAI Response is null (query by vserver-name)");
697 if (aaiResponse.getRequestError() != null) {
698 throw new AaiException("AAI responded with a request error (query by vserver-name)");
701 if (aaiResponse.getIsClosedLoopDisabled() != null) {
702 String value = aaiResponse.getIsClosedLoopDisabled();
703 if ("true".equalsIgnoreCase(value) || "T".equalsIgnoreCase(value) || "yes".equalsIgnoreCase(value)
704 || "Y".equalsIgnoreCase(value)) {
705 throw new AaiException("is-closed-loop-disabled is set to true (query by vserver-name)");
711 * Is closed loop disabled for an event.
713 * @param event the event
714 * @return <code>true</code> if the contol loop is disabled, <code>false</code> otherwise
716 public static boolean isClosedLoopDisabled(VirtualControlLoopEvent event) {
717 if ("true".equalsIgnoreCase(event.getAAI().get(VSERVER_IS_CLOSED_LOOP_DISABLED))
718 || "T".equalsIgnoreCase(event.getAAI().get(VSERVER_IS_CLOSED_LOOP_DISABLED))
719 || "yes".equalsIgnoreCase(event.getAAI().get(VSERVER_IS_CLOSED_LOOP_DISABLED))
720 || "Y".equalsIgnoreCase(event.getAAI().get(VSERVER_IS_CLOSED_LOOP_DISABLED))) {
723 return ("true".equalsIgnoreCase(event.getAAI().get(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED))
724 || "T".equalsIgnoreCase(event.getAAI().get(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED))
725 || "yes".equalsIgnoreCase(event.getAAI().get(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED))
726 || "Y".equalsIgnoreCase(event.getAAI().get(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED)));
730 * Get the A&AI VService information for an event.
732 * @param event the event
733 * @return a AaiGetVserverResponse
734 * @throws ControlLoopException if an error occurs
736 public static AaiGetVserverResponse getAAIVserverInfo(VirtualControlLoopEvent event) throws ControlLoopException {
737 UUID requestId = event.getRequestID();
738 AaiGetVserverResponse response = null;
739 String vserverName = event.getAAI().get(VSERVER_VSERVER_NAME);
742 if (vserverName != null) {
743 aaiHostURL = PolicyEngine.manager.getEnvironmentProperty("aai.url");
744 aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.username");
745 aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password");
746 String aaiGetQueryByVserver = "/aai/v11/nodes/vservers?vserver-name=";
747 String url = aaiHostURL + aaiGetQueryByVserver;
748 logger.info("AAI Host URL by VServer: {}", url);
749 response = new AaiManager(new RESTManager()).getQueryByVserverName(url, aaiUser, aaiPassword, requestId,
752 } catch (Exception e) {
753 logger.error("getAAIVserverInfo exception: ", e);
754 throw new ControlLoopException("Exception in getAAIVserverInfo: ", e);
761 * Get A&AI VNF information for an event.
763 * @param event the event
764 * @return a AaiGetVnfResponse
765 * @throws ControlLoopException if an error occurs
767 public static AaiGetVnfResponse getAAIVnfInfo(VirtualControlLoopEvent event) throws ControlLoopException {
768 UUID requestId = event.getRequestID();
769 AaiGetVnfResponse response = null;
770 String vnfName = event.getAAI().get(GENERIC_VNF_VNF_NAME);
771 String vnfId = event.getAAI().get(GENERIC_VNF_VNF_ID);
773 aaiHostURL = PolicyEngine.manager.getEnvironmentProperty("aai.url");
774 aaiUser = PolicyEngine.manager.getEnvironmentProperty("aai.username");
775 aaiPassword = PolicyEngine.manager.getEnvironmentProperty("aai.password");
778 if (vnfName != null) {
779 String aaiGetQueryByVnfName = "/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=";
780 String url = aaiHostURL + aaiGetQueryByVnfName;
781 logger.info("AAI Host URL by VNF name: {}", url);
782 response = new AaiManager(new RESTManager()).getQueryByVnfName(url, aaiUser, aaiPassword, requestId,
784 } else if (vnfId != null) {
785 String aaiGetQueryByVnfId = "/aai/v11/network/generic-vnfs/generic-vnf/";
786 String url = aaiHostURL + aaiGetQueryByVnfId;
787 logger.info("AAI Host URL by VNF ID: {}", url);
789 new AaiManager(new RESTManager()).getQueryByVnfId(url, aaiUser, aaiPassword, requestId, vnfId);
791 } catch (Exception e) {
792 logger.error("getAAIVnfInfo exception: ", e);
793 throw new ControlLoopException("Exception in getAAIVnfInfo: ", e);
800 public boolean isActive() {
806 public boolean releaseLock() {
812 public String toString() {
813 return "ControlLoopEventManager [closedLoopControlName=" + closedLoopControlName + ", requestID=" + requestID
814 + ", processor=" + processor + ", onset=" + (onset != null ? onset.getRequestID() : "null")
815 + ", numOnsets=" + numOnsets + ", numAbatements=" + numAbatements + ", isActivated=" + isActivated
816 + ", currentOperation=" + currentOperation + ", targetLock=" + targetLock + "]";