* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
public static final String GENERIC_VNF_PROV_STATUS = "generic-vnf.prov-status";
public static final String VSERVER_PROV_STATUS = "vserver.prov-status";
+ private static final String QUERY_AAI_ERROR_MSG = "Exception from queryAai: ";
+
/**
* Additional time, in seconds, to add to a "lock" request. This ensures that the lock
* won't expire right before an operation completes.
/**
* Activate a control loop event.
- *
+ *
* @param event the event
* @return the VirtualControlLoopNotification
*/
/**
* Activate a control loop event.
- *
+ *
* @param yamlSpecification the yaml specification
* @param event the event
* @return the VirtualControlLoopNotification
/**
* Check if the control loop is final.
- *
+ *
* @return a VirtualControlLoopNotification if the control loop is final, otherwise
* <code>null</code> is returned
* @throws ControlLoopException if an error occurs
/**
* Process the control loop.
- *
+ *
* @return a ControlLoopOperationManager
* @throws ControlLoopException if an error occurs
* @throws AaiException if an error occurs retrieving information from A&AI
/**
* Finish an operation.
- *
+ *
* @param operation the operation
*/
public void finishOperation(ControlLoopOperationManager operation) throws ControlLoopException {
/**
* Obtain a lock for the current operation.
- *
+ *
* @return the lock result
* @throws ControlLoopException if an error occurs
*/
/**
* Release the lock for the current operation.
- *
+ *
* @return the target lock
*/
public synchronized TargetLock unlockCurrentOperation() {
if (this.targetLock == null) {
return null;
}
-
+
TargetLock returnLock = this.targetLock;
this.targetLock = null;
-
+
PolicyGuard.unlockTarget(returnLock);
-
+
// always return the old target lock so rules can retract it
return returnLock;
}
/**
* An event onset/abatement.
- *
+ *
* @param event the event
* @return the status
* @throws AaiException if an error occurs retrieving information from A&AI
/**
* Set the control loop time out.
- *
+ *
* @return a VirtualControlLoopNotification
*/
public VirtualControlLoopNotification setControlLoopTimedOut() {
/**
* Get the control loop timeout.
- *
+ *
* @param defaultTimeout the default timeout
* @return the timeout
*/
/**
* Check an event syntax.
- *
+ *
* @param event the event syntax
* @throws ControlLoopException if an error occurs
*/
/**
* Query A&AI for an event.
- *
+ *
* @param event the event
* @throws AaiException if an error occurs retrieving information from A&AI
*/
public void queryAai(VirtualControlLoopEvent event) throws AaiException {
- if (isClosedLoopDisabled(event)) {
- throw new AaiException("is-closed-loop-disabled is set to true on VServer or VNF");
- }
+ Map<String, String> aai = event.getAai();
- if (isProvStatusInactive(event)) {
- throw new AaiException("prov-status is not ACTIVE on VServer or VNF");
- }
+ if (aai.containsKey(VSERVER_IS_CLOSED_LOOP_DISABLED) || aai.containsKey(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED)) {
- Map<String, String> aai = event.getAai();
+ if (isClosedLoopDisabled(event)) {
+ throw new AaiException("is-closed-loop-disabled is set to true on VServer or VNF");
+ }
- if ((aai.containsKey(VSERVER_IS_CLOSED_LOOP_DISABLED) || aai.containsKey(GENERIC_VNF_IS_CLOSED_LOOP_DISABLED))
- && (aai.containsKey(VSERVER_PROV_STATUS) || aai.containsKey(GENERIC_VNF_PROV_STATUS))) {
+ if (isProvStatusInactive(event)) {
+ throw new AaiException("prov-status is not ACTIVE on VServer or VNF");
+ }
// no need to query, as we already have the data
return;
processVServerResponse(vserverResponse);
}
} catch (AaiException e) {
- logger.error("Exception from queryAai: ", e);
+ logger.error(QUERY_AAI_ERROR_MSG, e);
throw e;
} catch (Exception e) {
- logger.error("Exception from queryAai: ", e);
- throw new AaiException("Exception from queryAai: " + e.toString());
+ logger.error(QUERY_AAI_ERROR_MSG, e);
+ throw new AaiException(QUERY_AAI_ERROR_MSG + e.toString());
}
}
/**
* Process a response from A&AI for a VNF.
- *
+ *
* @param aaiResponse the response from A&AI
* @param queryByVnfId <code>true</code> if the query was based on vnf-id,
* <code>false</code> if the query was based on vnf-name
/**
* Process a response from A&AI for a VServer.
- *
+ *
* @param aaiResponse the response from A&AI
* @throws AaiException if an error occurs processing the response
*/
/**
* Is closed loop disabled for an event.
- *
+ *
* @param event the event
* @return <code>true</code> if the control loop is disabled, <code>false</code>
* otherwise
/**
* Does provisioning status, for an event, have a value other than ACTIVE?
- *
+ *
* @param event the event
* @return {@code true} if the provisioning status is neither ACTIVE nor {@code null},
* {@code false} otherwise
/**
* Determines the boolean value represented by the given AAI field value.
- *
+ *
* @param aaiValue value to be examined
* @return the boolean value represented by the field value, or {@code false} if the
* value is {@code null}
/**
* Get the A&AI VService information for an event.
- *
+ *
* @param event the event
* @return a AaiGetVserverResponse
* @throws ControlLoopException if an error occurs
/**
* Get A&AI VNF information for an event.
- *
+ *
* @param event the event
* @return a AaiGetVnfResponse
* @throws ControlLoopException if an error occurs