/*-
 * ============LICENSE_START=======================================================
 * archetype-closed-loop-demo-rules
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * 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.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.policy.controlloop;

import java.util.List;
import java.util.LinkedList;
import java.util.Map;
import java.util.HashMap;
import java.util.UUID;

import org.openecomp.policy.controlloop.VirtualControlLoopEvent;
import org.openecomp.policy.controlloop.ControlLoopEventStatus;
import org.openecomp.policy.controlloop.VirtualControlLoopNotification;
import org.openecomp.policy.controlloop.ControlLoopNotificationType;
import org.openecomp.policy.controlloop.ControlLoopOperation;
import org.openecomp.policy.controlloop.ControlLoopOperationWrapper;
import org.openecomp.policy.template.demo.ControlLoopException;

import org.openecomp.policy.aai.AAINQF199.AAINQF199CloudRegion;
import org.openecomp.policy.aai.AAINQF199.AAINQF199ExtraProperties;
import org.openecomp.policy.aai.AAINQF199.AAINQF199ExtraProperty;
import org.openecomp.policy.aai.AAINQF199.AAINQF199GenericVNF;
import org.openecomp.policy.aai.AAINQF199.AAINQF199InstanceFilters;
import org.openecomp.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;
import org.openecomp.policy.aai.AAINQF199.AAINQF199InventoryResponseItems;
import org.openecomp.policy.aai.AAINQF199.AAINQF199Manager;
import org.openecomp.policy.aai.AAINQF199.AAINQF199NamedQuery;
import org.openecomp.policy.aai.AAINQF199.AAINQF199QueryParameters;
import org.openecomp.policy.aai.AAINQF199.AAINQF199Request;
import org.openecomp.policy.aai.AAINQF199.AAINQF199RequestWrapper;
import org.openecomp.policy.aai.AAINQF199.AAINQF199Response;
import org.openecomp.policy.aai.AAINQF199.AAINQF199ResponseWrapper;
import org.openecomp.policy.aai.AAINQF199.AAINQF199ServiceInstance;
import org.openecomp.policy.aai.AAINQF199.AAINQF199Tenant;
import org.openecomp.policy.aai.AAINQF199.AAINQF199VfModule;
import org.openecomp.policy.aai.AAINQF199.AAINQF199VServer;
import org.openecomp.policy.aai.util.Serialization;

import org.openecomp.policy.appc.CommonHeader;
import org.openecomp.policy.appc.Request;
import org.openecomp.policy.appc.Response;
import org.openecomp.policy.appc.ResponseCode;
import org.openecomp.policy.appc.ResponseStatus;
import org.openecomp.policy.appc.ResponseValue;

import org.openecomp.policy.template.demo.EventManager;
import org.openecomp.policy.vnf.trafficgenerator.PGRequest;
import org.openecomp.policy.vnf.trafficgenerator.PGStream;
import org.openecomp.policy.vnf.trafficgenerator.PGStreams;

import org.openecomp.policy.mso.MSOManager;
import org.openecomp.policy.mso.MSORequest;
import org.openecomp.policy.mso.MSORequestStatus;
import org.openecomp.policy.mso.MSORequestDetails;
import org.openecomp.policy.mso.MSOModelInfo;
import org.openecomp.policy.mso.MSOCloudConfiguration;
import org.openecomp.policy.mso.MSORequestInfo;
import org.openecomp.policy.mso.MSORequestParameters;
import org.openecomp.policy.mso.MSORelatedInstanceListElement;
import org.openecomp.policy.mso.MSORelatedInstance;
import org.openecomp.policy.mso.MSOResponse;

import org.openecomp.policy.drools.system.PolicyEngine;

//
// These parameters are required to build the runtime policy
//
declare Params
    closedLoopControlName : String
    actor : String
    aaiURL : String
    aaiUsername : String
    aaiPassword : String
    msoURL : String
    msoUsername : String
    msoPassword : String
    aaiNamedQueryUUID : String
    aaiPatternMatch : int 
    notificationTopic : String
    appcTopic : String
end

/*
*
* Called once and only once to insert the parameters into working memory for this Closed Loop policy.
* (Comment SETUP rule out for the first ECOMP opensource release since policy BRMS_GW already puts a Params fact in there)
*
*
*rule "${policyName}.SETUP"
*	when
*	then
*		System.out.println("rule SETUP is triggered.");
*		Params params = new Params();
*		params.setClosedLoopControlName("${closedLoopControlName}");
*		params.setActor("${actor}");
*		params.setAaiURL("${aaiURL}");
*		params.setAaiUsername("${aaiUsername}");
*		params.setAaiPassword("${aaiPassword}");
*		params.setMsoURL("${msoURL}");
*		params.setMsoUsername("${msoUsername}");
*		params.setMsoPassword("${msoPassword}");
*		params.setAaiNamedQueryUUID("${aaiNamedQueryUUID}");
*		params.setAaiPatternMatch(${aaiPatternMatch});
*		params.setNotificationTopic("${notificationTopic}");
*		params.setAppcTopic("${appcTopic}");
*		//
*		// This stays in memory as long as the rule is alive and running
*		//
*		insert(params);
*end
*/
/*
*
* This rule responds to DCAE Events
*
*/
rule "${policyName}.EVENT"
	when
        $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
        $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
        not ( EventManager( closedLoopControlName == $event.closedLoopControlName ))
	then
		System.out.println("rule EVENT is triggered.");
		try {
			// 
			// Check the requestID in the event to make sure it is not null before we create the EventManager. 
			// The EventManager will do extra syntax checking as well check if the closed loop is disabled/
			//
			if ($event.requestID == null) {
				VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
				notification.notification = ControlLoopNotificationType.REJECTED;
				notification.from = "policy";
				notification.message = "Missing requestID from DCAE event";
				notification.policyName = drools.getRule().getName();
				notification.policyScope = "${policyScope}";
				notification.policyVersion = "${policyVersion}";
				//
				// Let interested parties know
				//
				try {
					System.out.println(Serialization.gsonPretty.toJson(notification));
					PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
				} catch (Exception e) {
					e.printStackTrace();
					System.out.println("Can't deliver notification: " + notification);
				}
				//
				// Retract it from memory
				//
				retract($event);
				System.out.println("Event with requestID=null has been retracted.");
			} else {
				//
				// Create an EventManager
				//
				EventManager manager = new EventManager($params.getClosedLoopControlName(), $event.requestID, $event.target);
				//
				// Determine if EventManager can actively process the event (i.e. syntax)
				//
				VirtualControlLoopNotification notification = manager.activate($event);
				notification.from = "policy"; 
				notification.policyName = drools.getRule().getName();
				notification.policyScope = "${policyScope}";
				notification.policyVersion = "${policyVersion}";
				//
				// Are we actively pursuing this event?
				//
				if (notification.notification == ControlLoopNotificationType.ACTIVE) {
					//
					// Insert Event Manager into memory, this will now kick off processing.
					//
					insert(manager);
					//
					// Let interested parties know
					//
					try {
						System.out.println(Serialization.gsonPretty.toJson(notification));
						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
					} catch (Exception e) {
						e.printStackTrace();
						System.out.println("Can't deliver notification: " + notification);
					}		
				} else {
					//
					// Let interested parties know
					//
					try {
						System.out.println(Serialization.gsonPretty.toJson(notification));
						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
					} catch (Exception e) {
						e.printStackTrace();
						System.out.println("Can't deliver notification: " + notification);
					}
					//
					// Retract it from memory
					//
					retract($event);
				}
				//
				// Now that the manager is inserted into Drools working memory, we'll wait for
				// another rule to fire in order to continue processing. This way we can also
				// then screen for additional ONSET and ABATED events for this same RequestIDs 
				// and for different RequestIDs but with the same closedLoopControlName and target.
				//
			}
		//
		} catch (Exception e) {
			e.printStackTrace();
			VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
			notification.notification = ControlLoopNotificationType.REJECTED;
			notification.message = "Exception occurred " + e.getMessage();
			notification.policyName = drools.getRule().getName();
			notification.policyScope = "${policyScope}";
			notification.policyVersion = "${policyVersion}";
			//
			//
			//
			try {
				System.out.println(Serialization.gsonPretty.toJson(notification));
				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
			} catch (Exception e1) {
				System.out.println("Can't deliver notification: " + notification);
				e1.printStackTrace();
			}
			//
			// Retract the event
			//
			retract($event);
		}
end

/*
*
* This rule happens when we got a valid ONSET, closed loop is enabled and an Event Manager
* is created. We can start the operations for this closed loop.
*
*/
rule "${policyName}.EVENT.MANAGER"
	when
		$params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName, controlLoopResult == null)
	then
		System.out.println("rule EVENT.MANAGER is triggered.");
		//
		// Check which event this is.
		//
		EventManager.NEW_EVENT_STATUS eventStatus = $manager.onNewEvent($event);
		//
		// We only want the initial ONSET event in memory,
		// all the other events need to be retracted to support
		// cleanup and avoid the other rules being fired for this event.
		//
		if (eventStatus != EventManager.NEW_EVENT_STATUS.FIRST_ONSET) {
			System.out.println("Retracting "+eventStatus+" Event.");
			retract($event);
			return;
		}
		//
		// Now the event in memory is first onset event
		//
		try {
			//
			// Pull the known AAI field from the Event
			//
			// generic-vnf is needed for vFirewall case
			// vserver-name is needed for vLoadBalancer case
			//
			String genericVNF = $event.AAI.get("generic-vnf.vnf-id");
			String vserver = $event.AAI.get("vserver.vserver-name");
			//
			// Check if we are implementing a simple pattern match.
			//
			if ($params.getAaiPatternMatch() == 1) {
				//
				// Yes
				//
				//Basic naming characteristics:
				//VF Name (9 char)+VM name (13 char total)+VFC (19 char total)
				//Example: 
				//VF Name (9 characters):    cscf0001v
				//VM Name(13 characters): cscf0001vm001
				//VFC name(19 characters): cscf0001vm001cfg001
				//
				// zdfw1fwl01fwl02 or zdfw1fwl01fwl01  
				// replaced with
				// zdfw1fwl01pgn02 or zdfw1fwl01pgn01
				//
				int index = genericVNF.lastIndexOf("fwl");
				if (index == -1) {
					System.err.println("The generic-vnf.vnf-id from DCAE Event is not valid.");
				} else {
					genericVNF = genericVNF.substring(0, index) + "pgn" + genericVNF.substring(index+"fwl".length());
				}
				//
				// Construct an APPC request
				//
				ControlLoopOperation operation = new ControlLoopOperation();
				operation.actor = $params.getActor();
				operation.operation = "ModifyConfig";
				operation.target = $event.target;
				//
				// Create operationWrapper
				//
				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);
				//
				// insert operationWrapper into memory
				//
				insert(operationWrapper);
				//
				Request request = new Request();
				request.CommonHeader = new CommonHeader();
				request.CommonHeader.RequestID = $event.requestID;
				request.Action = operation.operation;
				request.Payload = new HashMap<String, Object>();
				//
				// Fill in the payload
				//
				request.Payload.put("generic-vnf.vnf-id", genericVNF);
				//
				PGRequest pgRequest = new PGRequest();
				pgRequest.pgStreams = new PGStreams();
				
				PGStream pgStream;
				for(int i = 0; i < 5; i++){
					pgStream = new PGStream();
					pgStream.streamId = "fw_udp"+(i+1);
					pgStream.isEnabled = "true";
					pgRequest.pgStreams.pgStream.add(pgStream);
				}
				request.Payload.put("pg-streams", pgRequest.pgStreams);
				
				if (request != null) {
					//
					// Insert request into memory
					//
					insert(request);
					//
					// Tell interested parties we are performing this Operation
					//
					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
					notification.notification = ControlLoopNotificationType.OPERATION;
					// message and history ??
					notification.from = "policy";
					notification.policyName = drools.getRule().getName();
					notification.policyScope = "${policyScope}";
					notification.policyVersion = "${policyVersion}";
					try {
						System.out.println(Serialization.gsonPretty.toJson(notification));
						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
					} catch (Exception e) {
						System.out.println("Can't deliver notification: " + notification);
						e.printStackTrace();
					}
					//
					// Now send the operation request
					//
					if (request instanceof Request) {
						try {
							System.out.println("APPC request sent:");
							System.out.println(Serialization.gsonPretty.toJson(request));
							PolicyEngine.manager.deliver($params.getAppcTopic(), request);
						} catch (Exception e) {
							e.printStackTrace();
							System.out.println("Can't deliver request: " + request);
						}
					}
				} else {
					//
					// what happens if it is null
					//
				}
				//
			} else {
				//
				// create AAI named-query request with UUID started with "F199"
				//
				AAINQF199Request aainqf199request = new AAINQF199Request();
				AAINQF199QueryParameters aainqf199queryparam = new AAINQF199QueryParameters();
				AAINQF199NamedQuery aainqf199namedquery = new AAINQF199NamedQuery();
				AAINQF199InstanceFilters aainqf199instancefilter = new AAINQF199InstanceFilters();
				//
				// queryParameters
				//
				aainqf199namedquery.namedQueryUUID = UUID.fromString($params.getAaiNamedQueryUUID()); 
				aainqf199queryparam.namedQuery = aainqf199namedquery;
				aainqf199request.queryParameters = aainqf199queryparam;
				//
				// instanceFilters
				//
				Map aainqf199instancefiltermap = new HashMap();
				Map aainqf199instancefiltermapitem = new HashMap();
				aainqf199instancefiltermapitem.put("vserver-name", vserver); 
				aainqf199instancefiltermap.put("vserver", aainqf199instancefiltermapitem);
				aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);
				aainqf199request.instanceFilters = aainqf199instancefilter;
				//
				// print aainqf199request for debug
				//
				System.out.println("AAI Request sent:");
				System.out.println(Serialization.gsonPretty.toJson(aainqf199request));
				//
				// Create AAINQF199RequestWrapper
				//
				AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper($event.requestID, aainqf199request);
				//
				// insert aainqf199request into memory
				//
				insert(aainqf199RequestWrapper);
			}
			//
		} catch (Exception e) {
		 e.printStackTrace();
		}
end

/*
*
* This rule happens when we got a valid ONSET, closed loop is enabled, an Event Manager
* is created, AAI Manager and AAI Request are ready in memory. We can start sending query to AAI and then wait for response.
*
*/
rule "${policyName}.EVENT.MANAGER.AAINQF199REQUEST"
	when
		$params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
		$aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)
	then
		System.out.println("rule EVENT.MANAGER.AAINQF199REQUEST is triggered.");
		//
		// send the request
		//
		AAINQF199Response aainqf199response = AAINQF199Manager.postQuery($params.getAaiURL(), $params.getAaiUsername(), $params.getAaiPassword(),
													   $aainqf199RequestWrapper.aainqf199request, $event.requestID);
		//
		// Check AAI response
		//
		if (aainqf199response == null) {
			System.err.println("Failed to get AAI response");
			//
			// Fail and retract everything
			//
			retract($event);
			retract($manager);
			retract($aainqf199RequestWrapper);
		} else {
			//
			// Create AAINQF199ResponseWrapper
			//
			AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper($event.requestID, aainqf199response);
			//
			// insert aainqf199ResponseWrapper to memeory
			//
			insert(aainqf199ResponseWrapper);
		}
end

/*
*
* This rule happens when we got a valid AAI response. We can start sending request to APPC or MSO now.
*
*/
rule "${policyName}.EVENT.MANAGER.AAINQF199RESPONSE"
	when 
		$params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
		$aainqf199RequestWrapper : AAINQF199RequestWrapper(requestID == $event.requestID)
		$aainqf199ResponseWrapper : AAINQF199ResponseWrapper(requestID == $event.requestID)
	then
		System.out.println("rule EVENT.MANAGER.AAINQF199RESPONSE is triggered.");
		//
		// Extract related fields out of AAINQF199RESPONSE
		//
		String vnfItemVnfId, vnfItemVnfType, vnfItemPersonaModelId, vnfItemPersonaModelVersion, vnfItemModelName, 
		       vnfItemModelVersion, vnfItemModelNameVersionId, serviceItemServiceInstanceId, serviceItemPersonaModelId,
		       serviceItemModelName, serviceItemModelType, serviceItemModelVersion, serviceItemModelNameVersionId,
		       vfModuleItemVfModuleName, vfModuleItemPersonaModelId, vfModuleItemPersonaModelVersion, vfModuleItemModelName, 
		       vfModuleItemModelNameVersionId, tenantItemTenantId, cloudRegionItemCloudRegionId;
		try {
			//
			// vnfItem
			//
			vnfItemVnfId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID;
			vnfItemVnfType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType;
			vnfItemVnfType = vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf("/")+1);
			vnfItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId;
			vnfItemPersonaModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion;
			vnfItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;
			vnfItemModelVersion = 		$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue;
			vnfItemModelNameVersionId = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;
			//
			// serviceItem
			//
			serviceItemServiceInstanceId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID;
			serviceItemPersonaModelId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId;
			serviceItemModelName = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue;
			serviceItemModelType = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue;
			serviceItemModelVersion = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion;
			serviceItemModelNameVersionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue;
			//
			// Find the index for base vf module and non-base vf module
			//
			int baseIndex = -1;
			int nonBaseIndex = -1;
			List<AAINQF199InventoryResponseItem> inventoryItems = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems;
			for (AAINQF199InventoryResponseItem m : inventoryItems) {
				if (m.vfModule != null && m.vfModule.isBaseVfModule == true) {
					baseIndex = inventoryItems.indexOf(m);
				} else if (m.vfModule != null && m.vfModule.isBaseVfModule == false && m.vfModule.orchestrationStatus == null) {
					nonBaseIndex = inventoryItems.indexOf(m);
				}
				//
				if (baseIndex != -1 && nonBaseIndex != -1) {
					break;
				}
			}
			//
			// Report the error if either base vf module or non-base vf module is not found
			//
			if (baseIndex == -1 || nonBaseIndex == -1) {
				System.err.println("Either base or non-base vf module is not found from AAI response.");
				retract($aainqf199RequestWrapper);
				retract($aainqf199ResponseWrapper);
				retract($manager);
				retract($event);
				return;
			}
			//
			// This comes from the base module
			//
			vfModuleItemVfModuleName = 			$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.vfModuleName;
			vfModuleItemVfModuleName = vfModuleItemVfModuleName.replace("Vfmodule", "vDNS");
			//
			// vfModuleItem - NOT the base module
			//
			vfModuleItemPersonaModelId = 		$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelId;
			vfModuleItemPersonaModelVersion = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelVersion;
			vfModuleItemModelName = 			$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(0).propertyValue;
			vfModuleItemModelNameVersionId = 	$aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(4).propertyValue;
			//
			// tenantItem
			//
			tenantItemTenantId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId;
			//
			// cloudRegionItem
			//
			cloudRegionItemCloudRegionId = $aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId;
			//
		} catch (Exception e) {
			e.printStackTrace();
			VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
			notification.notification = ControlLoopNotificationType.REJECTED;
			notification.message = "Exception occurred " + e.getMessage();
			notification.policyName = drools.getRule().getName();
			notification.policyScope = "${policyScope}";
			notification.policyVersion = "${policyVersion}";
			//
			try {
				System.out.println(Serialization.gsonPretty.toJson(notification));
				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
			} catch (Exception e1) {
				System.out.println("Can't deliver notification: " + notification);
				e1.printStackTrace();
			}
			//
			notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
			notification.message = "Invalid named-query response from AAI";
            //
            try {
            	System.out.println(Serialization.gsonPretty.toJson(notification));
                PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
            } catch (Exception e1) {
                System.out.println("Can't deliver notification: " + notification);
                e1.printStackTrace();
            }
			//
			// Retract everything
			//
			retract($aainqf199RequestWrapper);
			retract($aainqf199ResponseWrapper);
			retract($manager);
			retract($event);
			return;
		}	
		//
		// Extracted fields should not be null
		//
		if ((vnfItemVnfId == null) || (vnfItemVnfType == null) ||
		    (vnfItemPersonaModelId == null) || (vnfItemModelName == null) ||
		    (vnfItemModelVersion == null) || (vnfItemModelNameVersionId == null) ||
		    (serviceItemServiceInstanceId == null) || (serviceItemModelName == null) ||
		    (serviceItemModelType == null) || (serviceItemModelVersion == null) ||
		    (serviceItemModelNameVersionId == null) || (vfModuleItemVfModuleName == null) ||
		    (vfModuleItemPersonaModelId == null) || (vfModuleItemPersonaModelVersion == null) ||
		    (vfModuleItemModelName == null) || (vfModuleItemModelNameVersionId == null) ||
		    (tenantItemTenantId == null) || (cloudRegionItemCloudRegionId == null)) {
			//
			System.err.println("some fields are missing from AAI response.");
			//
			// Fail and retract everything
			//
			retract($aainqf199RequestWrapper);
			retract($aainqf199ResponseWrapper);
			retract($manager);
			retract($event);
			return;
		}
		//
		// We don't need them any more
		//
		retract($aainqf199ResponseWrapper);
		retract($aainqf199RequestWrapper);  
		//
		// check the actor of this closed loop
		//
		switch ($params.getActor()) {
			case "APPC":
			{
				//
				// Construct an APPC request
				//
				ControlLoopOperation operation = new ControlLoopOperation();
				operation.actor = $params.getActor();
				operation.operation = "ModifyConfig";
				operation.target = $event.target;
				//
				// Create operationWrapper
				//
				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);
				//
				// insert operationWrapper into memory
				//
				insert(operationWrapper);
				//
				Request request = new Request();
				request.CommonHeader = new CommonHeader();
				request.CommonHeader.RequestID = $event.requestID;
				request.Action = operation.operation;
				request.Payload = new HashMap<String, Object>();
				//
				// Fill in the payload
				// Hardcode genericVNF for now since AAI has not been ready for vFirewall demo case
				//
				String genericVNF = "zdfw1fwl01pgn02";
				request.Payload.put("generic-vnf.vnf-id", genericVNF);
				//
				PGRequest pgRequest = new PGRequest();
				pgRequest.pgStreams = new PGStreams();
				
				PGStream pgStream;
				for(int i = 0; i < 5; i++){
					pgStream = new PGStream();
					pgStream.streamId = "fw_udp"+(i+1);
					pgStream.isEnabled = "true";
					pgRequest.pgStreams.pgStream.add(pgStream);
				}
				request.Payload.put("pg-streams", pgRequest.pgStreams);
				
				if (request != null) {
					//
					// Insert request into memory
					//
					insert(request);
					//
					// Tell interested parties we are performing this Operation
					//
					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
					notification.notification = ControlLoopNotificationType.OPERATION;
					// message and history ??
					notification.from = "policy";
					notification.policyName = drools.getRule().getName();
					notification.policyScope = "${policyScope}";
					notification.policyVersion = "${policyVersion}";
					try {
						System.out.println(Serialization.gsonPretty.toJson(notification));
						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
					} catch (Exception e) {
						System.out.println("Can't deliver notification: " + notification);
						e.printStackTrace();
					}
					//
					// Now send the operation request
					//
					if (request instanceof Request) {
						try {
							System.out.println("APPC request sent:");
							System.out.println(Serialization.gsonPretty.toJson(request));
							PolicyEngine.manager.deliver($params.getAppcTopic(), request);
						} catch (Exception e) {
							e.printStackTrace();
							System.out.println("Can't deliver request: " + request);
						}
					}
				} else {
					//
					// what happens if it is null
					//
				}
			}
			break;
			case "MSO":
			{
				//
				// Construct an operation
				//
				ControlLoopOperation operation = new ControlLoopOperation();
				operation.actor = $params.getActor();
				operation.operation = "createModuleInstance";
				operation.target = $event.target;
				//
				// Create operationWrapper
				//
				ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);
				//
				// Construct an MSO request
				//
				MSORequest request = new MSORequest();
				request.requestDetails = new MSORequestDetails();
				request.requestDetails.modelInfo = new MSOModelInfo();
				request.requestDetails.cloudConfiguration = new MSOCloudConfiguration();
				request.requestDetails.requestInfo = new MSORequestInfo();
				request.requestDetails.requestParameters = new MSORequestParameters();
				request.requestDetails.requestParameters.userParams = null;
				//
				// cloudConfiguration
				//
				request.requestDetails.cloudConfiguration.lcpCloudRegionId = cloudRegionItemCloudRegionId;
				request.requestDetails.cloudConfiguration.tenantId = tenantItemTenantId;
				//
				// modelInfo
				//
				request.requestDetails.modelInfo.modelType = "vfModule";
				request.requestDetails.modelInfo.modelInvariantId = vfModuleItemPersonaModelId;
				request.requestDetails.modelInfo.modelNameVersionId = vfModuleItemModelNameVersionId;
				request.requestDetails.modelInfo.modelName = vfModuleItemModelName;
				request.requestDetails.modelInfo.modelVersion = vfModuleItemPersonaModelVersion;
				//
				// requestInfo
				//
				request.requestDetails.requestInfo.instanceName = vfModuleItemVfModuleName;
				request.requestDetails.requestInfo.source = "POLICY";
				request.requestDetails.requestInfo.suppressRollback = false;
				//
				// relatedInstanceList
				//
				MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();
				MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();
				relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();
				relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();
				//
				relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;
				relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();
				relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service";
				relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;
				relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;
				relatedInstanceListElement1.relatedInstance.modelInfo.modelName = serviceItemModelName;
				relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;
				//
				relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;
				relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();
				relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf";
				relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;
				relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;
				relatedInstanceListElement2.relatedInstance.modelInfo.modelName = vnfItemModelName;
				relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = vnfItemModelVersion;
				relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = vnfItemVnfType;
				//	
				request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);
				request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);
				//
				// print MSO request for debug
				//
				System.out.println("MSO request sent:");
				System.out.println(Serialization.gsonPretty.toJson(request));
				//
				//
				//
				if (request != null) {
					//
					// Tell interested parties we are performing this Operation
					//
					VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
					notification.notification = ControlLoopNotificationType.OPERATION;
					notification.from = "policy";
					notification.policyName = drools.getRule().getName();
					notification.policyScope = "${policyScope}";
					notification.policyVersion = "${policyVersion}";
					try {
						System.out.println(Serialization.gsonPretty.toJson(notification));
						PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
					} catch (Exception e) {
						System.out.println("Can't deliver notification: " + notification);
						e.printStackTrace();
					}
					//
					// Concatenate serviceItemServiceInstanceId and vnfItemVnfId to msoURL
					//
					String MSOUrl = $params.getMsoURL() + "/serviceInstances/v2/" + serviceItemServiceInstanceId + "/vnfs/" + vnfItemVnfId + "/vfModules";
					//
					// Call MSO
					//
					MSOResponse response = MSOManager.createModuleInstance(MSOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);
					//
					if (response != null) {
						//
						// Assign requestId
						//
						request.requestId = $event.requestID.toString();						
						response.request.requestId = $event.requestID.toString();
						//
						// Insert facts
						//
						insert(operationWrapper);
						insert(request);
						insert(response);
					} else {
						//
						// MSO request not even accepted
						//
						notification.message = operationWrapper.operation.toMessage();
						operationWrapper.operation.message = operationWrapper.operation.toMessage();
						operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
						$manager.setControlLoopResult("FAILURE_EXCEPTION");
						notification.history.add(operationWrapper.operation);
						notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
						//
						// Let interested parties know
						//
						try {
							System.out.println(Serialization.gsonPretty.toJson(notification));
							PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
						} catch (Exception e) {
							System.out.println("Can't deliver notification: " + notification);
							e.printStackTrace();
						}
	                    notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
                        try {
                        	System.out.println(Serialization.gsonPretty.toJson(notification));
                        	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
                        } catch (Exception e) {
                        	System.out.println("Can't deliver notification: " + notification);
                        	e.printStackTrace();
                        }
						//
						// Retract everything
						//
						retract($event);
						retract($manager);
					}
				} else {
					System.err.println("constructed MSO request is invalid.");
				}
			}
			break; 
		} 
end
		
/*
*
* This rule responds to APPC Response Events
*
*/
rule "${policyName}.APPC.RESPONSE"
	when
		$params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
		$operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )
		$request : Request( getCommonHeader().RequestID == $event.requestID )
		$response : Response( getCommonHeader().RequestID == $event.requestID )	
	then
		System.out.println("rule APPC.RESPONSE is triggered.");
		if ($response.Status == null) {
			$operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
			$manager.setControlLoopResult("FAILURE_EXCEPTION");
		} 
		//
		// Get the Response Code
		//
		ResponseCode code = ResponseCode.toResponseCode($response.Status.Code);
		if (code == null) {
			$operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
			$manager.setControlLoopResult("FAILURE_EXCEPTION");
		}
		//
		// Construct notification
		//
		VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
		notification.from = "policy";
		notification.policyName = drools.getRule().getName();
		notification.policyScope = "${policyScope}";
		notification.policyVersion = "${policyVersion}";
		notification.message = $operationWrapper.operation.toMessage();
		$operationWrapper.operation.message = $operationWrapper.operation.toMessage();
		//
		// Ok, let's figure out what APP-C's response is
		//
		switch (code) {
			case ACCEPT:
				$operationWrapper.operation.outcome = "PROCESSING";
				break;
			case ERROR:
			case REJECT:
				$operationWrapper.operation.outcome = "FAILURE_EXCEPTION";
				$manager.setControlLoopResult("FAILURE_EXCEPTION");
				break;
			case SUCCESS:
				$operationWrapper.operation.outcome = "SUCCESS";
				$manager.setControlLoopResult("SUCCESS");
				break;
			case FAILURE:
				$operationWrapper.operation.outcome = "FAILURE";
				$manager.setControlLoopResult("FAILURE");
				break;
		}
		if ($operationWrapper.operation.outcome.equals("SUCCESS")) {
			notification.history.add($operationWrapper.operation);
			notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;
			//
			// Let interested parties know
			//
			try {
				System.out.println(Serialization.gsonPretty.toJson(notification));
				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
			} catch (Exception e) {
				System.out.println("Can't deliver notification: " + notification);
				e.printStackTrace();
			}
            notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;
            try {
            	System.out.println(Serialization.gsonPretty.toJson(notification));
            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
            } catch (Exception e) {
            	System.out.println("Can't deliver notification: " + notification);
            	e.printStackTrace();
            }

			//
			// We are going to retract these objects from memory
			//
			System.out.println("Retracting everything");
			retract($operationWrapper);
			retract($request);
			retract($response);
			retract($event);
			retract($manager);
		} else if ($operationWrapper.operation.outcome.equals("PROCESSING")) {
			retract($response);
		} else {
			notification.history.add($operationWrapper.operation);
			notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
			//
			// Let interested parties know
			//
			try {
				System.out.println(Serialization.gsonPretty.toJson(notification));
				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
			} catch (Exception e) {
				System.out.println("Can't deliver notification: " + notification);
				e.printStackTrace();
			}
            notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
            //
            // Let interested parties know
            //
            try {
            	System.out.println(Serialization.gsonPretty.toJson(notification));
            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
            } catch (Exception e) {
            	System.out.println("Can't deliver notification: " + notification);
            	e.printStackTrace();
            }
			//
			// We are going to retract these objects from memory
			//
			System.out.println("Retracting everything");
			retract($operationWrapper);
			retract($request);
			retract($response);
			retract($event);
			retract($manager);
		}
		
end		

/*
*
* This rule is used to clean up APPC response
*
*/		
rule "${policyName}.APPC.RESPONSE.CLEANUP"
	when
		$params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
        $response : Response($id : getCommonHeader().RequestID )
		not ( VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), requestID == $id, closedLoopEventStatus == ControlLoopEventStatus.ONSET ) ) 
	then
		System.out.println("rule APPC.RESPONSE.CLEANUP is triggered.");
		retract($response);
end

/*
*
* This rule responds to MSO Response Events
*
*/
rule "${policyName}.MSO.RESPONSE"
	when
		$params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
		$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
		$manager : EventManager( closedLoopControlName == $event.closedLoopControlName )
		$operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )
		$request : MSORequest( requestId == $event.requestID.toString() )
		$response : MSOResponse( request.requestId == $event.requestID.toString() )	
	then
		System.out.println("rule MSO.RESPONSE is triggered.");
		//
		// Construct notification
		//
		VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
		notification.from = "policy";
		notification.policyName = drools.getRule().getName();
		notification.policyScope = "${policyScope}";
		notification.policyVersion = "${policyVersion}";
		notification.message = $operationWrapper.operation.toMessage();
		$operationWrapper.operation.message = $operationWrapper.operation.toMessage();
		//
		// The operation can either be succeeded or failed
		// 
		if($response.request.requestStatus.requestState.equals("Completed")) {
			$operationWrapper.operation.outcome = "SUCCESS";
			$manager.setControlLoopResult("SUCCESS");
			notification.history.add($operationWrapper.operation);
			notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;
			//
			// Let interested parties know
			//
			try {
				System.out.println(Serialization.gsonPretty.toJson(notification));
				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
			} catch (Exception e) {
				System.out.println("Can't deliver notification: " + notification);
				e.printStackTrace();
			}
			notification.notification = ControlLoopNotificationType.FINAL_SUCCESS;
            //
            // Let interested parties know
            //
            try {
            	System.out.println(Serialization.gsonPretty.toJson(notification));
            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
            } catch (Exception e) {
            	System.out.println("Can't deliver notification: " + notification);
            	e.printStackTrace();
            }
            //
			// We are going to retract these objects from memory
			//
			System.out.println("Retracting everything");
			retract($operationWrapper);
			retract($request);
			retract($response);
			retract($event);
			retract($manager);
		} else {
			$operationWrapper.operation.outcome = "FAILURE";
			$manager.setControlLoopResult("FAILURE");
			notification.history.add($operationWrapper.operation);
			notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
			//
			// Let interested parties know
			//
			try {
				System.out.println(Serialization.gsonPretty.toJson(notification));
				PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
			} catch (Exception e) {
				System.out.println("Can't deliver notification: " + notification);
				e.printStackTrace();
			}
			notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
            //
            // Let interested parties know
            //
            try {
            	System.out.println(Serialization.gsonPretty.toJson(notification));
            	PolicyEngine.manager.deliver($params.getNotificationTopic(), notification);
            } catch (Exception e) {
            	System.out.println("Can't deliver notification: " + notification);
            	e.printStackTrace();
            }
            //
			// We are going to retract these objects from memory
			//
			System.out.println("Retracting everything");
			retract($operationWrapper);
			retract($request);
			retract($response);
			retract($event);
			retract($manager);
		}
		
end				
