+ public String getTarget(Policy policy) throws ControlLoopException, AAIException {
+ if (policy.getTarget() != null) {
+ if (policy.getTarget().getType() != null) {
+ switch(policy.getTarget().getType()) {
+ case PNF:
+ break;
+ case VM:
+ case VNF:
+ VirtualControlLoopEvent virtualOnset = (VirtualControlLoopEvent) this.onset;
+ if (this.onset.target.equalsIgnoreCase("vserver.vserver-name")) {
+ return virtualOnset.AAI.get("vserver.vserver-name");
+ }
+ else if (this.onset.target.equalsIgnoreCase("generic-vnf.vnf-id")) {
+ return virtualOnset.AAI.get("generic-vnf.vnf-id");
+ }
+ else if (this.onset.target.equalsIgnoreCase("generic-vnf.vnf-name")) {
+ /*
+ * 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().vnfID;
+ if (vnfId == null) {
+ throw new AAIException("No vnf-id found");
+ }
+ return vnfId;
+ }
+ break;
+ default:
+ throw new ControlLoopException("The target type is not supported");
+ }
+ }
+ else {
+ throw new ControlLoopException("The target type is null");
+ }
+ }
+ else {
+ throw new ControlLoopException("The target is null");
+ }
+ throw new ControlLoopException("Target does not match target type");
+ }
+
+ public ControlLoopOperationManager(ControlLoopEvent onset, Policy policy, ControlLoopEventManager em) throws ControlLoopException, AAIException {