summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--controlloop/common/actors/actor.mso/pom.xml30
-rw-r--r--controlloop/common/actors/actor.mso/src/main/java/org/onap/policy/controlloop/actor/mso/MSOActorServiceProvider.java659
-rw-r--r--controlloop/common/eventmanager/pom.xml14
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager.java47
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/PolicyGuard.java8
-rw-r--r--controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java84
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Manager.java12
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Response.java5
-rw-r--r--controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java7
-rw-r--r--controlloop/common/model-impl/mso/pom.xml6
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestDetails.java57
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOAsyncRequestStatus.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOAsyncRequestStatus.java)126
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOCloudConfiguration.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOCloudConfiguration.java)88
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOInstanceReferences.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOInstanceReferences.java)88
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOManager.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOManager.java)72
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOModelInfo.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOModelInfo.java)7
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOPolicyException.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOPolicyException.java)86
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstance.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORelatedInstance.java)98
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstanceListElement.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORelatedInstanceListElement.java)84
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequest.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequest.java)120
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java124
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestError.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestError.java)118
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestInfo.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestInfo.java)132
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestParameters.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestParameters.java)94
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestReferences.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestReferences.java)76
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestStatus.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestStatus.java)102
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOResponse.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOResponse.java)13
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOServiceException.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOServiceException.java)96
-rw-r--r--controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOSubscriberInfo.java (renamed from controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOSubscriberInfo.java)94
-rw-r--r--controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java91
-rw-r--r--controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/TargetType.java3
-rw-r--r--controlloop/templates/template.demo.v1.0.0/template.demo/src/main/resources/archetype-resources/src/main/resources/ControlLoopDemo__closedLoopControlName__.drl84
-rw-r--r--controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java2
-rw-r--r--controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java (renamed from controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestMSO.java)50
-rw-r--r--controlloop/templates/template.demo/pom.xml12
-rw-r--r--controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl114
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/AaiSimulator.java4
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/MsoSimulatorTest.java4
-rw-r--r--controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java405
-rw-r--r--controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml26
40 files changed, 2424 insertions, 918 deletions
diff --git a/controlloop/common/actors/actor.mso/pom.xml b/controlloop/common/actors/actor.mso/pom.xml
index f0bbf48cb..5b0f908fe 100644
--- a/controlloop/common/actors/actor.mso/pom.xml
+++ b/controlloop/common/actors/actor.mso/pom.xml
@@ -16,5 +16,35 @@
<version>1.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>aai</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>events</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>mso</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-core</artifactId>
+ <version>6.5.0.Final</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
+ </dependency>
</dependencies>
</project>
diff --git a/controlloop/common/actors/actor.mso/src/main/java/org/onap/policy/controlloop/actor/mso/MSOActorServiceProvider.java b/controlloop/common/actors/actor.mso/src/main/java/org/onap/policy/controlloop/actor/mso/MSOActorServiceProvider.java
index d57e62634..f3c563f2a 100644
--- a/controlloop/common/actors/actor.mso/src/main/java/org/onap/policy/controlloop/actor/mso/MSOActorServiceProvider.java
+++ b/controlloop/common/actors/actor.mso/src/main/java/org/onap/policy/controlloop/actor/mso/MSOActorServiceProvider.java
@@ -21,13 +21,86 @@
package org.onap.policy.controlloop.actor.mso;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.drools.core.WorkingMemory;
+import org.onap.policy.aai.AAINQF199.AAINQF199InstanceFilters;
+import org.onap.policy.aai.AAINQF199.AAINQF199InventoryResponseItem;
+import org.onap.policy.aai.AAINQF199.AAINQF199Manager;
+import org.onap.policy.aai.AAINQF199.AAINQF199NamedQuery;
+import org.onap.policy.aai.AAINQF199.AAINQF199QueryParameters;
+import org.onap.policy.aai.AAINQF199.AAINQF199Request;
+import org.onap.policy.aai.AAINQF199.AAINQF199RequestWrapper;
+import org.onap.policy.aai.AAINQF199.AAINQF199Response;
+import org.onap.policy.aai.AAINQF199.AAINQF199ResponseWrapper;
+import org.onap.policy.controlloop.ControlLoopNotificationType;
+import org.onap.policy.controlloop.ControlLoopOperation;
+import org.onap.policy.controlloop.VirtualControlLoopEvent;
+import org.onap.policy.controlloop.VirtualControlLoopNotification;
import org.onap.policy.controlloop.actorServiceProvider.spi.Actor;
+import org.onap.policy.controlloop.policy.Policy;
+import org.onap.policy.mso.SOCloudConfiguration;
+import org.onap.policy.mso.SOManager;
+import org.onap.policy.mso.SOModelInfo;
+import org.onap.policy.mso.SORelatedInstance;
+import org.onap.policy.mso.SORelatedInstanceListElement;
+import org.onap.policy.mso.SORequest;
+import org.onap.policy.mso.SORequestDetails;
+import org.onap.policy.mso.SORequestInfo;
+import org.onap.policy.mso.SORequestParameters;
+import org.onap.policy.mso.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
public class MSOActorServiceProvider implements Actor {
+
+ private static final Logger logger = LoggerFactory.getLogger(MSOActorServiceProvider.class);
+
+ private static String vnfItemVnfId;
+
+ private String vnfItemVnfType;
+
+ private String vnfItemModelInvariantId;
+
+ private String vnfItemModelVersionId;
+
+ private String vnfItemModelName;
+
+ private String vnfItemModelVersion;
+
+ private String vnfItemModelNameVersionId;
+
+ private static String serviceItemServiceInstanceId;
+
+ private String serviceItemPersonaModelId;
+
+ private String serviceItemModelName;
+
+ private String serviceItemModelType;
+
+ private String serviceItemModelVersion;
+
+ private String serviceItemModelNameVersionId;
+
+ private String vfModuleItemVfModuleName;
+
+ private String vfModuleItemPersonaModelId;
+
+ private String vfModuleItemPersonaModelVersion;
+
+ private String vfModuleItemModelName;
+
+ private String vfModuleItemModelNameVersionId;
+
+ private String tenantItemTenantId;
+
+ private String cloudRegionItemCloudRegionId;
private static final ImmutableList<String> recipes = ImmutableList.of(
"VF Module Create");
@@ -37,7 +110,7 @@ public class MSOActorServiceProvider implements Actor {
@Override
public String actor() {
- return "MSO";
+ return "SO";
}
@Override
@@ -54,5 +127,589 @@ public class MSOActorServiceProvider implements Actor {
public List<String> recipePayloads(String recipe) {
return Collections.emptyList();
}
+
+ /**
+ * MSOActorServiceProvider Constructor
+ *
+ */
+ public MSOActorServiceProvider() {
+
+ }
+
+ /**
+ * Constructs and sends an AAI vserver Named Query
+ *
+ * @param eventRequestID
+ * @returns the response to the AAI Named Query
+ */
+ private AAINQF199ResponseWrapper AaiNamedQueryRequest(VirtualControlLoopEvent onset) {
+
+ // 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("4ff56a54-9e3f-46b7-a337-07a1d3c6b469"); // UUID.fromString($params.getAaiNamedQueryUUID()) TO DO: AaiNamedQueryUUID
+ aainqf199queryparam.namedQuery = aainqf199namedquery;
+ aainqf199request.queryParameters = aainqf199queryparam;
+ //
+ // instanceFilters
+ //
+ Map aainqf199instancefiltermap = new HashMap();
+ Map aainqf199instancefiltermapitem = new HashMap();
+ aainqf199instancefiltermapitem.put("vserver-name", onset.AAI.get("vserver.vserver-name")); // TO DO: get vserver.vname from dcae onset.AAI.get("vserver.vserver-name")
+ aainqf199instancefiltermap.put("vserver", aainqf199instancefiltermapitem);
+ aainqf199instancefilter.instanceFilter.add(aainqf199instancefiltermap);
+ aainqf199request.instanceFilters = aainqf199instancefilter;
+ //
+ // print aainqf199request for debug
+ //
+ logger.debug("AAI Request sent:");
+ logger.debug(Serialization.gsonPretty.toJson(aainqf199request));
+ //
+ // Create AAINQF199RequestWrapper
+ //
+ AAINQF199RequestWrapper aainqf199RequestWrapper = new AAINQF199RequestWrapper(onset.requestID, aainqf199request);
+ //
+ // insert aainqf199request into memory
+ //
+// insert(aainqf199RequestWrapper);
+
+ String url = "http://localhost:6666";
+ String username = "testUser";
+ String password = "testPass";
+
+ //***** send the request *****\\
+ AAINQF199Response aainqf199response = AAINQF199Manager.postQuery(url, username, password, // TO DO: get AAI URL, username, and password
+ aainqf199RequestWrapper.aainqf199request, onset.requestID);
+
+ // Check AAI response
+ if (aainqf199response == null) {
+ System.err.println("Failed to get AAI response");
+
+ // Fail and retract everything
+ return null;
+ } else {
+ // Create AAINQF199ResponseWrapper
+ AAINQF199ResponseWrapper aainqf199ResponseWrapper = new AAINQF199ResponseWrapper(onset.requestID, aainqf199response);
+
+ // insert aainqf199ResponseWrapper to memory -- Is this needed?
+// insert(aainqf199ResponseWrapper);
+
+ //
+ extractSOFieldsFromNamedQuery(aainqf199ResponseWrapper, onset);
+ return aainqf199ResponseWrapper;
+ }
+ }
+
+ /**
+ * Extract the required fields from the named query response
+ * @param namedQueryResponseWrapper
+ * @param onset
+ */
+ private void extractSOFieldsFromNamedQuery(AAINQF199ResponseWrapper namedQueryResponseWrapper, VirtualControlLoopEvent onset) {
+
+ try {
+ // vnfItem
+ setVnfItemVnfId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfID);
+ setVnfItemVnfType(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.vnfType);
+ setVnfItemVnfType(vnfItemVnfType.substring(vnfItemVnfType.lastIndexOf("/")+1));
+ setVnfItemModelInvariantId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelId);
+ setVnfItemModelVersionId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).genericVNF.personaModelVersion);
+ setVnfItemModelName(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue);
+ setVnfItemModelVersion(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(2).propertyValue);
+ setVnfItemModelNameVersionId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(4).propertyValue);
+
+ // serviceItem
+ setServiceItemServiceInstanceId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.serviceInstanceID);
+ setServiceItemPersonaModelId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelId);
+ setServiceItemModelName(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(0).propertyValue);
+ setServiceItemModelType(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).extraProperties.extraProperty.get(1).propertyValue);
+ setServiceItemModelVersion(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).serviceInstance.personaModelVersion);
+ setServiceItemModelNameVersionId(namedQueryResponseWrapper.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 = namedQueryResponseWrapper.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) {
+ logger.error("Either base or non-base vf module is not found from AAI response.");
+ return;
+ }
+
+ // This comes from the base module
+ setVfModuleItemVfModuleName(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(baseIndex).vfModule.vfModuleName);
+ setVfModuleItemVfModuleName(vfModuleItemVfModuleName.replace("Vfmodule", "vDNS"));
+
+ // vfModuleItem - NOT the base module
+ setVfModuleItemPersonaModelId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelId);
+ setVfModuleItemPersonaModelVersion(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).vfModule.personaModelVersion);
+ setVfModuleItemModelName(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(0).propertyValue);
+ setVfModuleItemModelNameVersionId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(0).items.inventoryResponseItems.get(nonBaseIndex).extraProperties.extraProperty.get(4).propertyValue);
+
+ // tenantItem
+ setTenantItemTenantId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).tenant.tenantId);
+
+ // cloudRegionItem
+ setCloudRegionItemCloudRegionId(namedQueryResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId);
+
+ } catch (Exception e) {
+ logger.error(e.getMessage());
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification(onset);
+ notification.notification = ControlLoopNotificationType.REJECTED;
+ notification.message = "Exception occurred " + e.getMessage();
+ notification.policyName = onset.policyName;
+ notification.policyScope = onset.policyScope;
+ notification.policyVersion = onset.policyVersion;
+ //
+ try {
+ logger.debug(Serialization.gsonPretty.toJson(notification));
+ } catch (Exception e1) {
+ logger.error("Can't deliver notification: " + notification);
+ logger.error(e1.getMessage());
+ }
+ //
+ notification.notification = ControlLoopNotificationType.FINAL_FAILURE;
+ notification.message = "Invalid named-query response from AAI";
+ //
+ try {
+ logger.debug(Serialization.gsonPretty.toJson(notification));
+ } catch (Exception e1) {
+ logger.error("Can't deliver notification: " + notification);
+ logger.error(e1.getMessage());
+ }
+ // Retract everything
+ return;
+ }
+
+ // Extracted fields should not be null
+ if (checkExtractedFields() == false) {
+ System.err.println("some fields are missing from AAI response.");
+ return;
+ }
+ }
+
+ /**
+ * Checks whether extracted fields from AAI Named Query are null or not
+ * @return false if some extracted fields are missing, true otherwise
+ */
+ private boolean checkExtractedFields() {
+
+ if ((getVnfItemVnfId() == null) || (getVnfItemVnfType() == null) ||
+ (getVnfItemModelInvariantId() == null) || (getVnfItemModelName() == null) ||
+ (getVnfItemModelVersion() == null) || (getVnfItemModelNameVersionId() == null) ||
+ (getServiceItemServiceInstanceId() == null) || (getServiceItemModelName() == null) ||
+ (getServiceItemModelType() == null) || (getServiceItemModelVersion() == null) ||
+ (getServiceItemModelNameVersionId() == null) || (getVfModuleItemVfModuleName() == null) ||
+ (getVfModuleItemPersonaModelId() == null) || (getVfModuleItemPersonaModelVersion() == null) ||
+ (getVfModuleItemModelName() == null) || (getVfModuleItemModelNameVersionId() == null) ||
+ (getTenantItemTenantId() == null) || (getCloudRegionItemCloudRegionId() == null)) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Construct SO Request
+ *
+ * @param onset
+ * @param operation
+ * @param policy
+ * @return MSORequest
+ */
+ public SORequest constructRequest(VirtualControlLoopEvent onset, ControlLoopOperation operation, Policy policy) {
+
+ if (policy.getActor().equals("SO") && policy.getRecipe().equals("VF Module Create")) {
+ // perform named query request and handle response
+ AaiNamedQueryRequest(onset);
+ } else {
+ // for future extension
+ return null;
+ };
+
+ // check if the fields extracted from named query response are
+ // not null so we can proceed with SO request
+ if (checkExtractedFields() == false) {
+
+ System.err.println("AAI response is missing some required fields. Cannot proceed with SO Request construction.");
+ return null;
+
+ } else {
+
+ // Construct SO Request
+ SORequest request = new SORequest();
+ request.requestDetails = new SORequestDetails();
+ request.requestDetails.modelInfo = new SOModelInfo();
+ request.requestDetails.cloudConfiguration = new SOCloudConfiguration();
+ request.requestDetails.requestInfo = new SORequestInfo();
+ request.requestDetails.requestParameters = new SORequestParameters();
+ request.requestDetails.requestParameters.userParams = null;
+ //
+ // cloudConfiguration
+ //
+ request.requestDetails.cloudConfiguration.lcpCloudRegionId = getCloudRegionItemCloudRegionId();
+ request.requestDetails.cloudConfiguration.tenantId = getTenantItemTenantId();
+ //
+ // modelInfo
+ //
+ request.requestDetails.modelInfo.modelType = "vfModule";
+ request.requestDetails.modelInfo.modelInvariantId = getVfModuleItemPersonaModelId();
+ request.requestDetails.modelInfo.modelNameVersionId = getVfModuleItemModelNameVersionId();
+ request.requestDetails.modelInfo.modelName = getVfModuleItemModelName();
+ request.requestDetails.modelInfo.modelVersion = getVfModuleItemPersonaModelVersion();
+ //
+ // requestInfo
+ //
+ request.requestDetails.requestInfo.instanceName = getVfModuleItemVfModuleName();
+ request.requestDetails.requestInfo.source = "POLICY";
+ request.requestDetails.requestInfo.suppressRollback = false;
+ //
+ // relatedInstanceList
+ //
+ SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement();
+ SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement();
+ relatedInstanceListElement1.relatedInstance = new SORelatedInstance();
+ relatedInstanceListElement2.relatedInstance = new SORelatedInstance();
+ //
+ relatedInstanceListElement1.relatedInstance.instanceId = getServiceItemServiceInstanceId();
+ relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo();
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service";
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = getServiceItemPersonaModelId();
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = getServiceItemModelNameVersionId();
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelName = getServiceItemModelName();
+ relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = getServiceItemModelVersion();
+ //
+ relatedInstanceListElement2.relatedInstance.instanceId = getVnfItemVnfId();
+ relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo();
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf";
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = getVnfItemModelInvariantId();
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = getVnfItemModelNameVersionId();
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelName = getVnfItemModelName();
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = getVnfItemModelVersion();
+ relatedInstanceListElement2.relatedInstance.modelInfo.modelCustomizationName = getVnfItemVnfType();
+ //
+ request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);
+ request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);
+ //
+ // print MSO request for debug
+ //
+ logger.debug("MSO request sent:");
+ logger.debug(Serialization.gsonPretty.toJson(request));
+
+ return request;
+ }
+ }
+
+ /**
+ * This method is needed to get the serviceInstanceId and vnfInstanceId which is used
+ * in the asyncMSORestCall
+ *
+ * @param wm
+ * @param request
+ */
+ public static void sendRequest(WorkingMemory wm, Object request) {
+ SOManager Mm = new SOManager();
+ Mm.asyncMSORestCall(wm, getServiceItemServiceInstanceId(), getVnfItemVnfId(), (SORequest)request);
+ }
+
+ /**
+ * @return the vnfItemVnfId
+ */
+ public static String getVnfItemVnfId() {
+ return vnfItemVnfId;
+ }
+
+ /**
+ * @param vnfItemVnfId the vnfItemVnfId to set
+ */
+ private void setVnfItemVnfId(String vnfItemVnfId) {
+ this.vnfItemVnfId = vnfItemVnfId;
+ }
+
+ /**
+ * @return the vnfItemVnfType
+ */
+ public String getVnfItemVnfType() {
+ return this.vnfItemVnfType;
+ }
+
+ /**
+ * @param vnfItemVnfType the vnfItemVnfType to set
+ */
+ private void setVnfItemVnfType(String vnfItemVnfType) {
+ this.vnfItemVnfType = vnfItemVnfType;
+ }
+
+ /**
+ * @return the vnfItemPersonaModelId
+ */
+ public String getVnfItemModelInvariantId() {
+ return this.vnfItemModelInvariantId;
+ }
+
+ /**
+ * @param vnfItemPersonaModelId the vnfItemPersonaModelId to set
+ */
+ private void setVnfItemModelInvariantId(String vnfItemModelInvariantId) {
+ this.vnfItemModelInvariantId = vnfItemModelInvariantId;
+ }
+
+ /**
+ * @return the vnfItemModelVersionId
+ */
+ public String getVnfItemModelVersionId() {
+ return this.vnfItemModelVersionId;
+ }
+
+ /**
+ * @param vnfItemModelVersionId the vnfItemModelVersionId to set
+ */
+ private void setVnfItemModelVersionId(String vnfItemModelVersionId) {
+ this.vnfItemModelVersionId = vnfItemModelVersionId;
+ }
+
+ /**
+ * @return the vnfItemModelName
+ */
+ public String getVnfItemModelName() {
+ return this.vnfItemModelName;
+ }
+
+ /**
+ * @param vnfItemModelName the vnfItemModelName to set
+ */
+ private void setVnfItemModelName(String vnfItemModelName) {
+ this.vnfItemModelName = vnfItemModelName;
+ }
+
+ /**
+ * @return the vnfItemModelVersion
+ */
+ public String getVnfItemModelVersion() {
+ return this.vnfItemModelVersion;
+ }
+
+ /**
+ * @param vnfItemModelVersion the vnfItemModelVersion to set
+ */
+ private void setVnfItemModelVersion(String vnfItemModelVersion) {
+ this.vnfItemModelVersion = vnfItemModelVersion;
+ }
+
+ /**
+ * @return the vnfItemModelNameVersionId
+ */
+ public String getVnfItemModelNameVersionId() {
+ return this.vnfItemModelNameVersionId;
+ }
+
+ /**
+ * @param vnfItemModelNameVersionId the vnfItemModelNameVersionId to set
+ */
+ private void setVnfItemModelNameVersionId(String vnfItemModelNameVersionId) {
+ this.vnfItemModelNameVersionId = vnfItemModelNameVersionId;
+ }
+
+ /**
+ * @return the serviceItemServiceInstanceId
+ */
+ public static String getServiceItemServiceInstanceId() {
+ return serviceItemServiceInstanceId;
+ }
+
+ /**
+ * @param serviceItemServiceInstanceId the serviceItemServiceInstanceId to set
+ */
+ private void setServiceItemServiceInstanceId(
+ String serviceItemServiceInstanceId) {
+ this.serviceItemServiceInstanceId = serviceItemServiceInstanceId;
+ }
+
+ /**
+ * @return the serviceItemPersonaModelId
+ */
+ public String getServiceItemPersonaModelId() {
+ return this.serviceItemPersonaModelId;
+ }
+
+ /**
+ * @param serviceItemPersonaModelId the serviceItemPersonaModelId to set
+ */
+ private void setServiceItemPersonaModelId(String serviceItemPersonaModelId) {
+ this.serviceItemPersonaModelId = serviceItemPersonaModelId;
+ }
+
+ /**
+ * @return the serviceItemModelName
+ */
+ public String getServiceItemModelName() {
+ return this.serviceItemModelName;
+ }
+
+ /**
+ * @param serviceItemModelName the serviceItemModelName to set
+ */
+ private void setServiceItemModelName(String serviceItemModelName) {
+ this.serviceItemModelName = serviceItemModelName;
+ }
+
+ /**
+ * @return the serviceItemModelType
+ */
+ public String getServiceItemModelType() {
+ return this.serviceItemModelType;
+ }
+
+ /**
+ * @param serviceItemModelType the serviceItemModelType to set
+ */
+ private void setServiceItemModelType(String serviceItemModelType) {
+ this.serviceItemModelType = serviceItemModelType;
+ }
+
+ /**
+ * @return the serviceItemModelVersion
+ */
+ public String getServiceItemModelVersion() {
+ return this.serviceItemModelVersion;
+ }
+
+ /**
+ * @param serviceItemModelVersion the serviceItemModelVersion to set
+ */
+ private void setServiceItemModelVersion(String serviceItemModelVersion) {
+ this.serviceItemModelVersion = serviceItemModelVersion;
+ }
+
+ /**
+ * @return the serviceItemModelNameVersionId
+ */
+ public String getServiceItemModelNameVersionId() {
+ return this.serviceItemModelNameVersionId;
+ }
+
+ /**
+ * @param serviceItemModelNameVersionId the serviceItemModelNameVersionId to set
+ */
+ private void setServiceItemModelNameVersionId(
+ String serviceItemModelNameVersionId) {
+ this.serviceItemModelNameVersionId = serviceItemModelNameVersionId;
+ }
+
+ /**
+ * @return the vfModuleItemVfModuleName
+ */
+ public String getVfModuleItemVfModuleName() {
+ return this.vfModuleItemVfModuleName;
+ }
+
+ /**
+ * @param vfModuleItemVfModuleName the vfModuleItemVfModuleName to set
+ */
+ private void setVfModuleItemVfModuleName(String vfModuleItemVfModuleName) {
+ this.vfModuleItemVfModuleName = vfModuleItemVfModuleName;
+ }
+
+ /**
+ * @return the vfModuleItemPersonaModelId
+ */
+ public String getVfModuleItemPersonaModelId() {
+ return this.vfModuleItemPersonaModelId;
+ }
+
+ /**
+ * @param vfModuleItemPersonaModelId the vfModuleItemPersonaModelId to set
+ */
+ private void setVfModuleItemPersonaModelId(String vfModuleItemPersonaModelId) {
+ this.vfModuleItemPersonaModelId = vfModuleItemPersonaModelId;
+ }
+
+ /**
+ * @return the vfModuleItemPersonaModelVersion
+ */
+ public String getVfModuleItemPersonaModelVersion() {
+ return this.vfModuleItemPersonaModelVersion;
+ }
+
+ /**
+ * @param vfModuleItemPersonaModelVersion the vfModuleItemPersonaModelVersion to set
+ */
+ private void setVfModuleItemPersonaModelVersion(
+ String vfModuleItemPersonaModelVersion) {
+ this.vfModuleItemPersonaModelVersion = vfModuleItemPersonaModelVersion;
+ }
+
+ /**
+ * @return the vfModuleItemModelName
+ */
+ public String getVfModuleItemModelName() {
+ return this.vfModuleItemModelName;
+ }
+
+ /**
+ * @param vfModuleItemModelName the vfModuleItemModelName to set
+ */
+ private void setVfModuleItemModelName(String vfModuleItemModelName) {
+ this.vfModuleItemModelName = vfModuleItemModelName;
+ }
+
+ /**
+ * @return the vfModuleItemModelNameVersionId
+ */
+ public String getVfModuleItemModelNameVersionId() {
+ return this.vfModuleItemModelNameVersionId;
+ }
+
+ /**
+ * @param vfModuleItemModelNameVersionId the vfModuleItemModelNameVersionId to set
+ */
+ private void setVfModuleItemModelNameVersionId(
+ String vfModuleItemModelNameVersionId) {
+ this.vfModuleItemModelNameVersionId = vfModuleItemModelNameVersionId;
+ }
+
+ /**
+ * @return the tenantItemTenantId
+ */
+ public String getTenantItemTenantId() {
+ return this.tenantItemTenantId;
+ }
+
+ /**
+ * @param tenantItemTenantId the tenantItemTenantId to set
+ */
+ private void setTenantItemTenantId(String tenantItemTenantId) {
+ this.tenantItemTenantId = tenantItemTenantId;
+ }
+
+ /**
+ * @return the cloudRegionItemCloudRegionId
+ */
+ public String getCloudRegionItemCloudRegionId() {
+ return this.cloudRegionItemCloudRegionId;
+ }
+
+ /**
+ * @param cloudRegionItemCloudRegionId the cloudRegionItemCloudRegionId to set
+ */
+ private void setCloudRegionItemCloudRegionId(
+ String cloudRegionItemCloudRegionId) {
+ this.cloudRegionItemCloudRegionId = cloudRegionItemCloudRegionId;
+ }
}
diff --git a/controlloop/common/eventmanager/pom.xml b/controlloop/common/eventmanager/pom.xml
index 44086a68d..3efecdc8a 100644
--- a/controlloop/common/eventmanager/pom.xml
+++ b/controlloop/common/eventmanager/pom.xml
@@ -52,6 +52,12 @@
<version>1.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>actor.mso</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
<artifactId>actor.vfc</artifactId>
@@ -124,6 +130,12 @@
<version>1.1.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
-
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>mso</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+
</dependencies>
</project>
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 3c264ab24..a1ae9f0d5 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
@@ -40,6 +40,8 @@ import org.onap.policy.controlloop.actor.appc.APPCActorServiceProvider;
import org.onap.policy.controlloop.actor.vfc.VFCActorServiceProvider;
import org.onap.policy.controlloop.policy.Policy;
import org.onap.policy.controlloop.policy.PolicyResult;
+import org.onap.policy.controlloop.actor.mso.MSOActorServiceProvider;
+import org.onap.policy.mso.SOResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.onap.policy.controlloop.actor.appclcm.AppcLcmActorServiceProvider;
@@ -129,11 +131,7 @@ public class ControlLoopOperationManager implements Serializable {
switch (policy.getActor()) {
case "APPC":
break;
- case "AOTS":
- break;
- case "MSO":
- break;
- case "SDNO":
+ case "SO":
break;
case "VFC":
break;
@@ -215,12 +213,14 @@ public class ControlLoopOperationManager implements Serializable {
//
this.currentOperation = operation;
return operationRequest;
- case "MSO":
- //
- // We are not supporting MSO interface at the moment
- //
- logger.debug("We are not supporting MSO actor in the latest release.");
- return null;
+ case "SO":
+ MSOActorServiceProvider SOAsp = new MSOActorServiceProvider();
+ this.operationRequest = SOAsp.constructRequest((VirtualControlLoopEvent)onset, operation.operation, this.policy);
+
+ // Save the operation
+ this.currentOperation = operation;
+
+ return operationRequest;
case "VFC":
this.operationRequest = VFCActorServiceProvider.constructRequest((VirtualControlLoopEvent) onset, operation.operation, this.policy);
this.currentOperation = operation;
@@ -341,7 +341,32 @@ public class ControlLoopOperationManager implements Serializable {
return result.getKey();
}
return null;
+ } else if (response instanceof SOResponse) {
+ SOResponse msoResponse = (SOResponse) response;
+ switch (msoResponse.httpResponseCode) {
+ case 200:
+ case 202:
+ //
+ // Consider it as success
+ //
+ this.completeOperation(new Integer(1), msoResponse.httpResponseCode + " Success", PolicyResult.SUCCESS);
+ if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) {
+ return null;
+ }
+ return PolicyResult.SUCCESS;
+ default:
+ //
+ // Consider it as failure
+ //
+ this.completeOperation(new Integer(1), msoResponse.httpResponseCode + " Failed", PolicyResult.FAILURE);
+ if (this.policyResult != null && this.policyResult.equals(PolicyResult.FAILURE_TIMEOUT)) {
+ return null;
+ }
+ return PolicyResult.FAILURE;
+ }
+
}
+
return null;
}
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 fabc48511..b35ec5a9f 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
@@ -26,6 +26,7 @@ import java.util.UUID;
import org.onap.policy.controlloop.policy.TargetType;
import org.onap.policy.guard.impl.PNFTargetLock;
import org.onap.policy.guard.impl.VMTargetLock;
+import org.onap.policy.guard.impl.VNFTargetLock;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,6 +79,13 @@ public class PolicyGuard {
//
lock = new VMTargetLock(targetType, targetInstance, requestID, callback);
break;
+ case VNF:
+ //
+ // Create the Lock object
+ //
+ lock = new VNFTargetLock(targetType, targetInstance, requestID, callback);
+ break;
+
default:
return LockResult.createLockResult(GuardResult.LOCK_EXCEPTION, null);
}
diff --git a/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java
new file mode 100644
index 000000000..1350d5c54
--- /dev/null
+++ b/controlloop/common/guard/src/main/java/org/onap/policy/guard/impl/VNFTargetLock.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * guard
+ * ================================================================================
+ * 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.onap.policy.guard.impl;
+
+import java.io.Serializable;
+import java.util.UUID;
+
+import org.onap.policy.controlloop.policy.TargetType;
+import org.onap.policy.guard.LockCallback;
+import org.onap.policy.guard.TargetLock;
+
+public class VNFTargetLock implements TargetLock, Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 2335897394577202732L;
+
+ private final UUID lockID;
+ private final TargetType targetType;
+ private final String target;
+ private final UUID requestID;
+ private final LockCallback callback;
+
+ public VNFTargetLock (TargetType type, String target, UUID requestID, LockCallback callback) {
+ this.lockID = UUID.randomUUID();
+ this.targetType = type;
+ this.target = target;
+ this.requestID = requestID;
+ this.callback = callback;
+ }
+
+ @Override
+ public UUID getLockID() {
+ return this.lockID;
+ }
+
+
+ @Override
+ public TargetType getTargetType() {
+ return targetType;
+ }
+
+ @Override
+ public String getTargetInstance() {
+ return target;
+ }
+
+ @Override
+ public UUID getRequestID() {
+ return this.requestID;
+ }
+
+ public LockCallback getCallback() {
+ return this.callback;
+ }
+
+ @Override
+ public String toString() {
+ return "VNFTargetLock [lockID=" + lockID + ", targetType=" + targetType + ", target=" + target + ", requestID="
+ + requestID + "]";
+ }
+
+
+
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Manager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Manager.java
index fd999fb5f..9cb0a220a 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Manager.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Manager.java
@@ -38,7 +38,7 @@ public final class AAINQF199Manager {
public static AAINQF199Response postQuery(String url, String username, String password, AAINQF199Request request, UUID requestID) {
- Map<String, String> headers = new HashMap<String, String>();
+ Map<String, String> headers = new HashMap<>();
headers.put("X-FromAppId", "POLICY");
headers.put("X-TransactionId", requestID.toString());
headers.put("Accept", "application/json");
@@ -47,8 +47,10 @@ public final class AAINQF199Manager {
Pair<Integer, String> httpDetails = RESTManager.post(url, username, password, headers, "application/json", Serialization.gsonPretty.toJson(request));
+ logger.debug("Performing AAI POST to " + url + "\nSending: \n" + Serialization.gsonPretty.toJson(request) + "END");
+
if (httpDetails == null) {
- logger.debug("AAI POST Null Response to {}", url);
+ logger.debug("AAI POST - Null Response from {}", url);
return null;
}
@@ -69,7 +71,7 @@ public final class AAINQF199Manager {
public static AAIGETResponse getQuery(String urlGet, String username, String password, UUID requestID, String vnfId) {
- Map<String, String> headers = new HashMap<String, String>();
+ Map<String, String> headers = new HashMap<>();
headers.put("X-FromAppId", "POLICY");
headers.put("X-TransactionId", requestID.toString());
headers.put("Accept", "application/json");
@@ -101,7 +103,9 @@ public final class AAINQF199Manager {
}
try {
Thread.sleep(1000);
- } catch (InterruptedException e) {}
+ } catch (InterruptedException e) {
+ logger.error(e.getMessage());
+ }
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Response.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Response.java
index 68a011b98..bcecc04b9 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Response.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQF199/AAINQF199Response.java
@@ -34,9 +34,10 @@ public class AAINQF199Response implements Serializable {
private static final long serialVersionUID = 8411407444051746101L;
@SerializedName("inventory-response-item")
- public List<AAINQF199InventoryResponseItem> inventoryResponseItems = new LinkedList<AAINQF199InventoryResponseItem>();
+ public List<AAINQF199InventoryResponseItem> inventoryResponseItems = new LinkedList<>();
public AAINQF199Response() {
+
}
-
+
}
diff --git a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java
index c8bd1a80c..f0e4627a3 100644
--- a/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java
+++ b/controlloop/common/model-impl/events/src/main/java/org/onap/policy/controlloop/ControlLoopTargetType.java
@@ -24,7 +24,7 @@ public enum ControlLoopTargetType {
VM("VM"),
VF("VF"),
VFC("VFC"),
- ENODEB("eNodeB")
+ VNF("VNF")
;
private String type;
@@ -47,9 +47,10 @@ public enum ControlLoopTargetType {
if (VFC.toString().equals(type)) {
return VFC;
}
- if (ENODEB.toString().equals(type)) {
- return ENODEB;
+ if (VNF.toString().equals(type)) {
+ return VNF;
}
+
return null;
}
}
diff --git a/controlloop/common/model-impl/mso/pom.xml b/controlloop/common/model-impl/mso/pom.xml
index 8e584a8ea..5d386688d 100644
--- a/controlloop/common/model-impl/mso/pom.xml
+++ b/controlloop/common/model-impl/mso/pom.xml
@@ -43,6 +43,12 @@
<scope>provided</scope>
</dependency>
<dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-core</artifactId>
+ <version>6.5.0.Final</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
<groupId>org.onap.policy.drools-applications</groupId>
<artifactId>rest</artifactId>
<version>${project.version}</version>
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestDetails.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestDetails.java
deleted file mode 100644
index 180285765..000000000
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestDetails.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSORequestDetails implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("modelInfo")
- public MSOModelInfo modelInfo;
-
- @SerializedName("cloudConfiguration")
- public MSOCloudConfiguration cloudConfiguration;
-
- @SerializedName("requestInfo")
- public MSORequestInfo requestInfo;
-
- @SerializedName("subscriberInfo")
- public MSOSubscriberInfo subscriberInfo;
-
- @SerializedName("relatedInstanceList")
- public List<MSORelatedInstanceListElement> relatedInstanceList= new LinkedList<MSORelatedInstanceListElement>();
-
- @SerializedName("requestParameters")
- public MSORequestParameters requestParameters;
-
- public MSORequestDetails() {
- }
-
-}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOAsyncRequestStatus.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOAsyncRequestStatus.java
index 7e7451a60..600816304 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOAsyncRequestStatus.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOAsyncRequestStatus.java
@@ -1,63 +1,63 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSOAsyncRequestStatus implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("correlator")
- public String correlator;
-
- @SerializedName("requestId")
- public String requestId;
-
- @SerializedName("instanceReferences")
- public MSOInstanceReferences instanceReferences;
-
- @SerializedName("startTime")
- public LocalDateTime startTime;
-
- @SerializedName("finishTime")
- public LocalDateTime finishTime;
-
- @SerializedName("requestScope")
- public String requestScope;
-
- @SerializedName("requestType")
- public String requestType;
-
- @SerializedName("requestStatus")
- public MSORequestStatus requestStatus;
-
-
- public MSOAsyncRequestStatus() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import com.google.gson.annotations.SerializedName;
+
+public class SOAsyncRequestStatus implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("correlator")
+ public String correlator;
+
+ @SerializedName("requestId")
+ public String requestId;
+
+ @SerializedName("instanceReferences")
+ public SOInstanceReferences instanceReferences;
+
+ @SerializedName("startTime")
+ public LocalDateTime startTime;
+
+ @SerializedName("finishTime")
+ public LocalDateTime finishTime;
+
+ @SerializedName("requestScope")
+ public String requestScope;
+
+ @SerializedName("requestType")
+ public String requestType;
+
+ @SerializedName("requestStatus")
+ public SORequestStatus requestStatus;
+
+
+ public SOAsyncRequestStatus() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOCloudConfiguration.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOCloudConfiguration.java
index 965ada24d..7e4951166 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOCloudConfiguration.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOCloudConfiguration.java
@@ -1,44 +1,44 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSOCloudConfiguration implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("lcpCloudRegionId")
- public String lcpCloudRegionId;
-
- @SerializedName("tenantId")
- public String tenantId;
-
- public MSOCloudConfiguration() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+
+
+import com.google.gson.annotations.SerializedName;
+
+public class SOCloudConfiguration implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("lcpCloudRegionId")
+ public String lcpCloudRegionId;
+
+ @SerializedName("tenantId")
+ public String tenantId;
+
+ public SOCloudConfiguration() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOInstanceReferences.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOInstanceReferences.java
index f751c3a43..894b17ade 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOInstanceReferences.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOInstanceReferences.java
@@ -1,44 +1,44 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSOInstanceReferences implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("requestId")
- public String requestId;
-
- @SerializedName("instanceId")
- public String instanceId;
-
- public MSOInstanceReferences() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+
+
+import com.google.gson.annotations.SerializedName;
+
+public class SOInstanceReferences implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("requestId")
+ public String requestId;
+
+ @SerializedName("instanceId")
+ public String instanceId;
+
+ public SOInstanceReferences() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOManager.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOManager.java
index c23935586..ea9146d24 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOManager.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOManager.java
@@ -20,22 +20,29 @@
package org.onap.policy.mso;
+import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import org.onap.policy.mso.util.Serialization;
import org.onap.policy.rest.RESTManager;
import org.onap.policy.rest.RESTManager.Pair;
+import org.drools.core.WorkingMemory;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
-public final class MSOManager {
+public final class SOManager {
- private static final Logger logger = LoggerFactory.getLogger(MSOManager.class);
-
- public static MSOResponse createModuleInstance(String url, String urlBase, String username, String password, MSORequest request) {
+ private static final Logger logger = LoggerFactory.getLogger(SOManager.class);
+ private static ExecutorService executors = Executors.newCachedThreadPool();
+
+ public static SOResponse createModuleInstance(String url, String urlBase, String username, String password, SORequest request) {
//
// Call REST
@@ -57,7 +64,7 @@ public final class MSOManager {
if (httpDetails.a == 202) {
try {
- MSOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, MSOResponse.class);
+ SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class);
String body = Serialization.gsonPretty.toJson(response);
logger.debug("***** Response to post:");
@@ -68,12 +75,12 @@ public final class MSOManager {
//String getUrl = "/orchestrationRequests/v2/"+requestId;
String urlGet = urlBase + "/orchestrationRequests/v2/"+requestId;
- MSOResponse responseGet = null;
+ SOResponse responseGet = null;
while(attemptsLeft-- > 0){
Pair<Integer, String> httpDetailsGet = RESTManager.get(urlGet, username, password, headers);
- responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, MSOResponse.class);
+ responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, SOResponse.class);
body = Serialization.gsonPretty.toJson(responseGet);
logger.debug("***** Response to get:");
logger.debug(body);
@@ -97,7 +104,7 @@ public final class MSOManager {
return responseGet;
} catch (JsonSyntaxException e) {
- logger.error("Failed to deserialize into MSOResponse: ", e);
+ logger.error("Failed to deserialize into SOResponse: ", e);
} catch (InterruptedException e) {
logger.error("Interrupted exception: ", e);
}
@@ -109,4 +116,53 @@ public final class MSOManager {
return null;
}
+ /**
+ *
+ * @param wm
+ * @param url
+ * @param urlBase
+ * @param username
+ * @param password
+ * @param request
+ *
+ * This method makes an asynchronous Rest call to MSO and inserts the response into the Drools working memory
+ */
+ public void asyncMSORestCall(WorkingMemory wm, String serviceInstanceId, String vnfInstanceId, SORequest request) {
+ executors.submit(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ String serverRoot = ""; // TODO
+ String username = ""; // TODO
+ String password = ""; // TODO
+ String url = serverRoot + "/serviceInstances/v5/" + serviceInstanceId + "/vnfs/" + vnfInstanceId + "/vfModules";
+
+ String auth = username + ":" + password;
+
+ Map<String, String> headers = new HashMap<String, String>();
+ byte[] encodedBytes = Base64.getEncoder().encode(auth.getBytes());
+ headers.put("Accept", "application/json");
+ headers.put("Authorization", "Basic " + new String(encodedBytes));
+
+ Gson gsonPretty = new GsonBuilder().disableHtmlEscaping()
+ .setPrettyPrinting()
+ .create();
+
+ String msoJson = gsonPretty.toJson(request);
+
+ SOResponse mso = new SOResponse();
+ Pair<Integer, String> httpResponse = RESTManager.post(url, "policy", "policy", headers, "application/json", msoJson);
+ if (httpResponse != null) {
+ Gson gson = new Gson();
+ mso = gson.fromJson(httpResponse.b, SOResponse.class);
+ mso.httpResponseCode = httpResponse.a;
+ }
+
+// logger.info("MSOResponse inserted " + mso.toString());
+ wm.insert(mso);
+ }
+ });
+ }
+
}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOModelInfo.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOModelInfo.java
index 9efea94b1..cba763daf 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOModelInfo.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOModelInfo.java
@@ -25,7 +25,7 @@ import java.io.Serializable;
import com.google.gson.annotations.SerializedName;
-public class MSOModelInfo implements Serializable {
+public class SOModelInfo implements Serializable {
/**
*
@@ -50,7 +50,10 @@ public class MSOModelInfo implements Serializable {
@SerializedName("modelCustomizationName")
public String modelCustomizationName;
- public MSOModelInfo() {
+ @SerializedName("modelCustomizationId")
+ public String modelCustomizationId;
+
+ public SOModelInfo() {
}
}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOPolicyException.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOPolicyException.java
index 97e85132a..a2c9f81aa 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOPolicyException.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOPolicyException.java
@@ -1,43 +1,43 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSOPolicyException implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("messageId")
- public String messageId;
-
- @SerializedName("text")
- public String text;
-
- public MSOPolicyException() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+public class SOPolicyException implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("messageId")
+ public String messageId;
+
+ @SerializedName("text")
+ public String text;
+
+ public SOPolicyException() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORelatedInstance.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstance.java
index 0eec72f70..d9d634a57 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORelatedInstance.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstance.java
@@ -1,49 +1,49 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-
-
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSORelatedInstance implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("instanceId")
- public String instanceId;
-
- @SerializedName("instanceName")
- public String instanceName;
-
- @SerializedName("modelInfo")
- public MSOModelInfo modelInfo;
-
-
- public MSORelatedInstance() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+
+
+
+import com.google.gson.annotations.SerializedName;
+
+public class SORelatedInstance implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("instanceId")
+ public String instanceId;
+
+ @SerializedName("instanceName")
+ public String instanceName;
+
+ @SerializedName("modelInfo")
+ public SOModelInfo modelInfo;
+
+
+ public SORelatedInstance() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORelatedInstanceListElement.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstanceListElement.java
index dfeed32f2..f32f7ccb1 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORelatedInstanceListElement.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORelatedInstanceListElement.java
@@ -1,42 +1,42 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSORelatedInstanceListElement implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("relatedInstance")
- public MSORelatedInstance relatedInstance;
-
-
- public MSORelatedInstanceListElement() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+
+
+import com.google.gson.annotations.SerializedName;
+
+public class SORelatedInstanceListElement implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("relatedInstance")
+ public SORelatedInstance relatedInstance;
+
+
+ public SORelatedInstanceListElement() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequest.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequest.java
index fa4e7892b..83a761377 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequest.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequest.java
@@ -1,60 +1,60 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSORequest implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("requestId")
- public String requestId;
-
- @SerializedName("startTime")
- //public LocalDateTime startTime;
- public String startTime;
-
- @SerializedName("finishTime")
- public LocalDateTime finishTime;
-
- @SerializedName("requestScope")
- public String requestScope;
-
- @SerializedName("requestType")
- public String requestType;
-
- @SerializedName("requestDetails")
- public MSORequestDetails requestDetails;
-
- @SerializedName("requestStatus")
- public MSORequestStatus requestStatus;
-
- public MSORequest() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+import com.google.gson.annotations.SerializedName;
+
+public class SORequest implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("requestId")
+ public String requestId;
+
+ @SerializedName("startTime")
+ //public LocalDateTime startTime;
+ public String startTime;
+
+ @SerializedName("finishTime")
+ public LocalDateTime finishTime;
+
+ @SerializedName("requestScope")
+ public String requestScope;
+
+ @SerializedName("requestType")
+ public String requestType;
+
+ @SerializedName("requestDetails")
+ public SORequestDetails requestDetails;
+
+ @SerializedName("requestStatus")
+ public SORequestStatus requestStatus;
+
+ public SORequest() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java
new file mode 100644
index 000000000..4b4b8217e
--- /dev/null
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestDetails.java
@@ -0,0 +1,124 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+public class SORequestDetails implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("modelInfo")
+ public SOModelInfo modelInfo;
+
+ @SerializedName("cloudConfiguration")
+ public SOCloudConfiguration cloudConfiguration;
+
+ @SerializedName("requestInfo")
+ public SORequestInfo requestInfo;
+
+ @SerializedName("subscriberInfo")
+ public SOSubscriberInfo subscriberInfo;
+
+ @SerializedName("relatedInstanceList")
+ public List<SORelatedInstanceListElement> relatedInstanceList= new LinkedList<SORelatedInstanceListElement>();
+
+ @SerializedName("requestParameters")
+ public SORequestParameters requestParameters;
+
+ public SORequestDetails() {
+
+ }
+
+ public SORequestDetails(SORequestDetails soRequestDetails) {
+ this.modelInfo = soRequestDetails.modelInfo;
+ this.cloudConfiguration = soRequestDetails.cloudConfiguration;
+ this.requestInfo = soRequestDetails.requestInfo;
+ this.relatedInstanceList = soRequestDetails.relatedInstanceList;
+ this.requestParameters = soRequestDetails.requestParameters;
+ }
+
+ @Override
+ public String toString() {
+ return "SORequestDetails [modelInfo=" + modelInfo
+ + ", cloudConfiguration=" + cloudConfiguration
+ + ", requestInfo=" + requestInfo + ", relatedInstanceList="
+ + relatedInstanceList + ", requestParameters="
+ + requestParameters + "]";
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((cloudConfiguration == null) ? 0 : cloudConfiguration.hashCode());
+ result = prime * result + ((modelInfo == null) ? 0 : modelInfo.hashCode());
+ result = prime * result + ((relatedInstanceList == null) ? 0 : relatedInstanceList.hashCode());
+ result = prime * result + ((requestInfo == null) ? 0 : requestInfo.hashCode());
+ result = prime * result + ((requestParameters == null) ? 0 : requestParameters.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SORequestDetails other = (SORequestDetails) obj;
+ if (cloudConfiguration == null) {
+ if (other.cloudConfiguration != null)
+ return false;
+ } else if (!cloudConfiguration.equals(other.cloudConfiguration))
+ return false;
+ if (modelInfo == null) {
+ if (other.modelInfo != null)
+ return false;
+ } else if (!modelInfo.equals(other.modelInfo))
+ return false;
+ if (relatedInstanceList == null) {
+ if (other.relatedInstanceList != null)
+ return false;
+ } else if (!relatedInstanceList.equals(other.relatedInstanceList))
+ return false;
+ if (requestInfo == null) {
+ if (other.requestInfo != null)
+ return false;
+ } else if (!requestInfo.equals(other.requestInfo))
+ return false;
+ if (requestParameters == null) {
+ if (other.requestParameters != null)
+ return false;
+ } else if (!requestParameters.equals(other.requestParameters))
+ return false;
+ return true;
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestError.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestError.java
index 849103e6d..76b62bfa0 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestError.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestError.java
@@ -1,59 +1,59 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSORequestError implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
-
- @SerializedName("policyException")
- public MSOPolicyException policyException;
-
-
- @SerializedName("serviceException")
- public MSOServiceException serviceException;
-
- /*
- @SerializedName("messageId")
- public String messageId;
-
- @SerializedName("text")
- public String text;
-
- @SerializedName("url")
- public String url;
-
- @SerializedName("variables")
- public String variables;
- */
-
- public MSORequestError() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+public class SORequestError implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+
+ @SerializedName("policyException")
+ public SOPolicyException policyException;
+
+
+ @SerializedName("serviceException")
+ public SOServiceException serviceException;
+
+ /*
+ @SerializedName("messageId")
+ public String messageId;
+
+ @SerializedName("text")
+ public String text;
+
+ @SerializedName("url")
+ public String url;
+
+ @SerializedName("variables")
+ public String variables;
+ */
+
+ public SORequestError() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestInfo.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestInfo.java
index 5c771b6e3..9e5b93ccb 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestInfo.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestInfo.java
@@ -1,66 +1,66 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSORequestInfo implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("instanceName")
- public String instanceName;
-
- @SerializedName("source")
- public String source;
-
- @SerializedName("productFamilyId")
- public String productFamilyId;
-
- @SerializedName("suppressRollback")
- public boolean suppressRollback;
-
- @SerializedName("billingAccountNumber")
- public String billingAccountNumber;
-
- @SerializedName("callbackUrl")
- public String callbackUrl;
-
- @SerializedName("correlator")
- public String correlator;
-
- @SerializedName("orderNumber")
- public String orderNumber;
-
- @SerializedName("orderVersion")
- public Integer orderVersion;
-
-
- public MSORequestInfo() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+
+
+import com.google.gson.annotations.SerializedName;
+
+public class SORequestInfo implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("instanceName")
+ public String instanceName;
+
+ @SerializedName("source")
+ public String source;
+
+ @SerializedName("productFamilyId")
+ public String productFamilyId;
+
+ @SerializedName("suppressRollback")
+ public boolean suppressRollback;
+
+ @SerializedName("billingAccountNumber")
+ public String billingAccountNumber;
+
+ @SerializedName("callbackUrl")
+ public String callbackUrl;
+
+ @SerializedName("correlator")
+ public String correlator;
+
+ @SerializedName("orderNumber")
+ public String orderNumber;
+
+ @SerializedName("orderVersion")
+ public Integer orderVersion;
+
+
+ public SORequestInfo() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestParameters.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestParameters.java
index 043a8e848..6e45afe83 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestParameters.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestParameters.java
@@ -1,47 +1,47 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSORequestParameters implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("subscriptionServiceType")
- public String subscriptionServiceType;
-
- @SerializedName("userParams")
- public List<Map<String, String>> userParams = new LinkedList<Map<String, String>>();
-
- public MSORequestParameters() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+
+import com.google.gson.annotations.SerializedName;
+
+public class SORequestParameters implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("subscriptionServiceType")
+ public String subscriptionServiceType;
+
+ @SerializedName("userParams")
+ public List<Map<String, String>> userParams = new LinkedList<Map<String, String>>();
+
+ public SORequestParameters() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestReferences.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestReferences.java
index c641db4bb..ea8ebc64a 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestReferences.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestReferences.java
@@ -1,38 +1,38 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSORequestReferences implements Serializable {
-
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("instanceId")
- public String instanceId;
-
- @SerializedName("requestId")
- public String requestId;
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+
+
+import com.google.gson.annotations.SerializedName;
+
+public class SORequestReferences implements Serializable {
+
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("instanceId")
+ public String instanceId;
+
+ @SerializedName("requestId")
+ public String requestId;
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestStatus.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestStatus.java
index 598e9cbdc..d5174328e 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSORequestStatus.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SORequestStatus.java
@@ -1,51 +1,51 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSORequestStatus implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("percentProgress")
- public int percentProgress;
-
- @SerializedName("requestState")
- public String requestState;
-
- @SerializedName("timestamp")
- //public LocalDateTime timestamp;
- public String timestamp;
-
- @SerializedName("wasRolledBack")
- public boolean wasRolledBack;
-
-
- public MSORequestStatus() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+public class SORequestStatus implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("percentProgress")
+ public int percentProgress;
+
+ @SerializedName("requestState")
+ public String requestState;
+
+ @SerializedName("timestamp")
+ //public LocalDateTime timestamp;
+ public String timestamp;
+
+ @SerializedName("wasRolledBack")
+ public boolean wasRolledBack;
+
+
+ public SORequestStatus() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOResponse.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOResponse.java
index 2106959fb..ddf937593 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOResponse.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOResponse.java
@@ -24,7 +24,7 @@ import java.io.Serializable;
import com.google.gson.annotations.SerializedName;
-public class MSOResponse implements Serializable {
+public class SOResponse implements Serializable {
/**
*
@@ -32,17 +32,18 @@ public class MSOResponse implements Serializable {
private static final long serialVersionUID = -3283942659786236032L;
@SerializedName("requestReferences")
- public MSORequestReferences requestReferences;
+ public SORequestReferences requestReferences;
@SerializedName("requestError")
- public MSORequestError requestError;
+ public SORequestError requestError;
@SerializedName("request")
- public MSORequest request;
-
+ public SORequest request;
+
+ public int httpResponseCode;
- public MSOResponse() {
+ public SOResponse() {
}
}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOServiceException.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOServiceException.java
index 3322bf8f3..4a806ced4 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOServiceException.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOServiceException.java
@@ -1,48 +1,48 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-import java.util.LinkedList;
-import java.util.List;
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSOServiceException implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("messageId")
- public String messageId;
-
- @SerializedName("text")
- public String text;
-
- @SerializedName("variables")
- public List<String> variables = new LinkedList<String>();
-
- public MSOServiceException() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+import java.util.LinkedList;
+import java.util.List;
+
+import com.google.gson.annotations.SerializedName;
+
+public class SOServiceException implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("messageId")
+ public String messageId;
+
+ @SerializedName("text")
+ public String text;
+
+ @SerializedName("variables")
+ public List<String> variables = new LinkedList<String>();
+
+ public SOServiceException() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOSubscriberInfo.java b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOSubscriberInfo.java
index 957c4c70c..97d620f5c 100644
--- a/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/MSOSubscriberInfo.java
+++ b/controlloop/common/model-impl/mso/src/main/java/org/onap/policy/mso/SOSubscriberInfo.java
@@ -1,47 +1,47 @@
-/*-
- * ============LICENSE_START=======================================================
- * mso
- * ================================================================================
- * 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.onap.policy.mso;
-
-import java.io.Serializable;
-
-
-import com.google.gson.annotations.SerializedName;
-
-public class MSOSubscriberInfo implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -3283942659786236032L;
-
- @SerializedName("globalSubscriberId")
- public String globalSubscriberId;
-
- @SerializedName("subscriberCommonSiteId")
- public String subscriberCommonSiteId;
-
- @SerializedName("subscriberName")
- public String subscriberName;
-
- public MSOSubscriberInfo() {
- }
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * mso
+ * ================================================================================
+ * 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.onap.policy.mso;
+
+import java.io.Serializable;
+
+
+import com.google.gson.annotations.SerializedName;
+
+public class SOSubscriberInfo implements Serializable {
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3283942659786236032L;
+
+ @SerializedName("globalSubscriberId")
+ public String globalSubscriberId;
+
+ @SerializedName("subscriberCommonSiteId")
+ public String subscriberCommonSiteId;
+
+ @SerializedName("subscriberName")
+ public String subscriberName;
+
+ public SOSubscriberInfo() {
+ }
+
+}
diff --git a/controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java b/controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java
index 2c8253f0b..bfbbf0b57 100644
--- a/controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java
+++ b/controlloop/common/model-impl/mso/src/test/java/org/onap/policy/mso/TestDemo.java
@@ -24,14 +24,14 @@ import java.util.HashMap;
import java.util.Map;
import org.junit.Test;
-import org.onap.policy.mso.MSOCloudConfiguration;
-import org.onap.policy.mso.MSOModelInfo;
-import org.onap.policy.mso.MSORelatedInstance;
-import org.onap.policy.mso.MSORelatedInstanceListElement;
-import org.onap.policy.mso.MSORequest;
-import org.onap.policy.mso.MSORequestDetails;
-import org.onap.policy.mso.MSORequestInfo;
-import org.onap.policy.mso.MSORequestParameters;
+import org.onap.policy.mso.SOCloudConfiguration;
+import org.onap.policy.mso.SOModelInfo;
+import org.onap.policy.mso.SORelatedInstance;
+import org.onap.policy.mso.SORelatedInstanceListElement;
+import org.onap.policy.mso.SORequest;
+import org.onap.policy.mso.SORequestDetails;
+import org.onap.policy.mso.SORequestInfo;
+import org.onap.policy.mso.SORequestParameters;
import org.onap.policy.mso.util.Serialization;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -41,12 +41,12 @@ public class TestDemo {
@Test
public void test() {
- 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();
+ SORequest request = new SORequest();
+ request.requestDetails = new SORequestDetails();
+ request.requestDetails.modelInfo = new SOModelInfo();
+ request.requestDetails.cloudConfiguration = new SOCloudConfiguration();
+ request.requestDetails.requestInfo = new SORequestInfo();
+ request.requestDetails.requestParameters = new SORequestParameters();
request.requestDetails.modelInfo.modelType = "vfModule";
request.requestDetails.modelInfo.modelInvariantId = "ff5256d2-5a33-55df-13ab-12abad84e7ff";
@@ -57,24 +57,24 @@ public class TestDemo {
request.requestDetails.cloudConfiguration.lcpCloudRegionId = "mdt1";
request.requestDetails.cloudConfiguration.tenantId = "88a6ca3ee0394ade9403f075db23167e";
- request.requestDetails.requestInfo.instanceName = "MSOTEST103a-vSAMP12_base_module-0";
+ request.requestDetails.requestInfo.instanceName = "SOTEST103a-vSAMP12_base_module-0";
request.requestDetails.requestInfo.source = "VID";
request.requestDetails.requestInfo.suppressRollback = true;
- MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();
- MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();
- MSORelatedInstanceListElement relatedInstanceListElement3 = new MSORelatedInstanceListElement();
- relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();
- relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();
- relatedInstanceListElement3.relatedInstance = new MSORelatedInstance();
+ SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement();
+ SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement();
+ SORelatedInstanceListElement relatedInstanceListElement3 = new SORelatedInstanceListElement();
+ relatedInstanceListElement1.relatedInstance = new SORelatedInstance();
+ relatedInstanceListElement2.relatedInstance = new SORelatedInstance();
+ relatedInstanceListElement3.relatedInstance = new SORelatedInstance();
relatedInstanceListElement1.relatedInstance.instanceId = "17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c";
- relatedInstanceListElement1.relatedInstance.instanceName = "MSOTESTVOL103a-vSAMP12_base_module-0_vol";
- relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();
+ relatedInstanceListElement1.relatedInstance.instanceName = "SOTESTVOL103a-vSAMP12_base_module-0_vol";
+ relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo();
relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "volumeGroup";
relatedInstanceListElement2.relatedInstance.instanceId = "serviceInstanceId";
- relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();
+ relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo();
relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "service";
relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = "ff3514e3-5a33-55df-13ab-12abad84e7ff";
relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = "fe6985cd-ea33-3346-ac12-ab121484a3fe";
@@ -82,7 +82,7 @@ public class TestDemo {
relatedInstanceListElement2.relatedInstance.modelInfo.modelVersion = "1.0";
relatedInstanceListElement3.relatedInstance.instanceId = "vnfInstanceId";
- relatedInstanceListElement3.relatedInstance.modelInfo = new MSOModelInfo();
+ relatedInstanceListElement3.relatedInstance.modelInfo = new SOModelInfo();
relatedInstanceListElement3.relatedInstance.modelInfo.modelType = "vnf";
relatedInstanceListElement3.relatedInstance.modelInfo.modelInvariantId = "ff5256d1-5a33-55df-13ab-12abad84e7ff";
relatedInstanceListElement3.relatedInstance.modelInfo.modelNameVersionId = "fe6478e4-ea33-3346-ac12-ab121484a3fe";
@@ -94,23 +94,17 @@ public class TestDemo {
request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);
request.requestDetails.relatedInstanceList.add(relatedInstanceListElement3);
- Map<String, String> userParam1 = new HashMap<String, String>();
+ Map<String, String> userParam1 = new HashMap<>();
userParam1.put("name1", "value1");
- Map<String, String> userParam2 = new HashMap<String, String>();
+ Map<String, String> userParam2 = new HashMap<>();
userParam2.put("name2", "value2");
request.requestDetails.requestParameters.userParams.add(userParam1);
request.requestDetails.requestParameters.userParams.add(userParam2);
- String body = Serialization.gsonPretty.toJson(request);
- logger.debug(body);
-
- //MSOResponse response = MSOManager.createModuleInstance("http://localhost:7780/", "my_username", "my_passwd", request);
-
- //body = Serialization.gsonPretty.toJson(response);
- //logger.debug(body);
-
+ logger.debug(Serialization.gsonPretty.toJson(request));
+
}
@Test
@@ -118,13 +112,13 @@ public class TestDemo {
logger.debug("** HACK **");
- MSORequest request = new MSORequest();
+ SORequest request = new SORequest();
//
- 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 = new SORequestDetails();
+ request.requestDetails.modelInfo = new SOModelInfo();
+ request.requestDetails.cloudConfiguration = new SOCloudConfiguration();
+ request.requestDetails.requestInfo = new SORequestInfo();
+ request.requestDetails.requestParameters = new SORequestParameters();
request.requestDetails.requestParameters.userParams = null;
request.requestDetails.modelInfo.modelType = "vfModule";
@@ -140,14 +134,14 @@ public class TestDemo {
request.requestDetails.requestInfo.source = "POLICY";
request.requestDetails.requestInfo.suppressRollback = false;
- MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();
- MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();
- relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();
- relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();
+ SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement();
+ SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement();
+ relatedInstanceListElement1.relatedInstance = new SORelatedInstance();
+ relatedInstanceListElement2.relatedInstance = new SORelatedInstance();
String serviceInstanceId = "98af39ce-6408-466b-921f-c2c7a8f59ed6";
relatedInstanceListElement1.relatedInstance.instanceId = serviceInstanceId;
- relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();
+ relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo();
relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service";
relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = "24329a0c-1d57-4210-b1af-a65df64e9d59";
relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = "ac642881-8e7e-4217-bd64-16ad41c42e30";
@@ -156,7 +150,7 @@ public class TestDemo {
String vnfInstanceId = "8eb411b8-a936-412f-b01f-9a9a435c0e93";
relatedInstanceListElement2.relatedInstance.instanceId = vnfInstanceId;
- relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();
+ relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo();
relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf";
relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = "09fd971e-db5f-475d-997c-cf6704b6b8fe";
relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = "152ed917-6dcc-46ee-bf8a-a775c5aa5a74";
@@ -167,8 +161,7 @@ public class TestDemo {
request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);
request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);
- String body = Serialization.gsonPretty.toJson(request);
- logger.debug(body);
+ logger.debug(Serialization.gsonPretty.toJson(request));
}
}
diff --git a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/TargetType.java b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/TargetType.java
index abf851a75..7c8ca89cf 100644
--- a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/TargetType.java
+++ b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/TargetType.java
@@ -23,7 +23,8 @@ package org.onap.policy.controlloop.policy;
public enum TargetType {
VM("VM"),
PNF("PNF"),
- VFC("VFC")
+ VFC("VFC"),
+ VNF("VNF")
;
private String target;
diff --git a/controlloop/templates/template.demo.v1.0.0/template.demo/src/main/resources/archetype-resources/src/main/resources/ControlLoopDemo__closedLoopControlName__.drl b/controlloop/templates/template.demo.v1.0.0/template.demo/src/main/resources/archetype-resources/src/main/resources/ControlLoopDemo__closedLoopControlName__.drl
index 2f1155e56..493c8581c 100644
--- a/controlloop/templates/template.demo.v1.0.0/template.demo/src/main/resources/archetype-resources/src/main/resources/ControlLoopDemo__closedLoopControlName__.drl
+++ b/controlloop/templates/template.demo.v1.0.0/template.demo/src/main/resources/archetype-resources/src/main/resources/ControlLoopDemo__closedLoopControlName__.drl
@@ -66,17 +66,17 @@ import org.onap.policy.vnf.trafficgenerator.PGRequest;
import org.onap.policy.vnf.trafficgenerator.PGStream;
import org.onap.policy.vnf.trafficgenerator.PGStreams;
-import org.onap.policy.mso.MSOManager;
-import org.onap.policy.mso.MSORequest;
-import org.onap.policy.mso.MSORequestStatus;
-import org.onap.policy.mso.MSORequestDetails;
-import org.onap.policy.mso.MSOModelInfo;
-import org.onap.policy.mso.MSOCloudConfiguration;
-import org.onap.policy.mso.MSORequestInfo;
-import org.onap.policy.mso.MSORequestParameters;
-import org.onap.policy.mso.MSORelatedInstanceListElement;
-import org.onap.policy.mso.MSORelatedInstance;
-import org.onap.policy.mso.MSOResponse;
+import org.onap.policy.mso.SOManager;
+import org.onap.policy.mso.SORequest;
+import org.onap.policy.mso.SORequestStatus;
+import org.onap.policy.mso.SORequestDetails;
+import org.onap.policy.mso.SOModelInfo;
+import org.onap.policy.mso.SOCloudConfiguration;
+import org.onap.policy.mso.SORequestInfo;
+import org.onap.policy.mso.SORequestParameters;
+import org.onap.policy.mso.SORelatedInstanceListElement;
+import org.onap.policy.mso.SORelatedInstance;
+import org.onap.policy.mso.SOResponse;
//
@@ -638,7 +638,7 @@ end
/*
*
-* This rule happens when we got a valid AAI response. We can start sending request to APPC or MSO now.
+* This rule happens when we got a valid AAI response. We can start sending request to APPC or SO now.
*
*/
rule "${policyName}.EVENT.MANAGER.AAINQF199RESPONSE"
@@ -880,7 +880,7 @@ rule "${policyName}.EVENT.MANAGER.AAINQF199RESPONSE"
}
}
break;
- case "MSO":
+ case "SO":
{
//
// Construct an operation
@@ -894,14 +894,14 @@ rule "${policyName}.EVENT.MANAGER.AAINQF199RESPONSE"
//
ControlLoopOperationWrapper operationWrapper = new ControlLoopOperationWrapper($event.requestID, operation);
//
- // Construct an MSO request
+ // Construct an SO 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();
+ SORequest request = new SORequest();
+ request.requestDetails = new SORequestDetails();
+ request.requestDetails.modelInfo = new SOModelInfo();
+ request.requestDetails.cloudConfiguration = new SOCloudConfiguration();
+ request.requestDetails.requestInfo = new SORequestInfo();
+ request.requestDetails.requestParameters = new SORequestParameters();
request.requestDetails.requestParameters.userParams = null;
//
// cloudConfiguration
@@ -925,13 +925,13 @@ rule "${policyName}.EVENT.MANAGER.AAINQF199RESPONSE"
//
// relatedInstanceList
//
- MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();
- MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();
- relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();
- relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();
+ SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement();
+ SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement();
+ relatedInstanceListElement1.relatedInstance = new SORelatedInstance();
+ relatedInstanceListElement2.relatedInstance = new SORelatedInstance();
//
relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;
- relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();
+ relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo();
relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service";
relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;
relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;
@@ -939,7 +939,7 @@ rule "${policyName}.EVENT.MANAGER.AAINQF199RESPONSE"
relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;
//
relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;
- relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();
+ relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo();
relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf";
relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;
relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;
@@ -950,9 +950,9 @@ rule "${policyName}.EVENT.MANAGER.AAINQF199RESPONSE"
request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);
request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);
//
- // print MSO request for debug
+ // print SO request for debug
//
- System.out.println("MSO request sent:");
+ System.out.println("SO request sent:");
System.out.println(Serialization.gsonPretty.toJson(request));
//
//
@@ -977,22 +977,22 @@ rule "${policyName}.EVENT.MANAGER.AAINQF199RESPONSE"
//
// Concatenate serviceItemServiceInstanceId and vnfItemVnfId to msoURL
//
- String MSOUrl = $params.getMsoURL() + "/serviceInstances/v2/" + serviceItemServiceInstanceId + "/vnfs/" + vnfItemVnfId + "/vfModules";
+ String SOUrl = $params.getMsoURL() + "/serviceInstances/v2/" + serviceItemServiceInstanceId + "/vnfs/" + vnfItemVnfId + "/vfModules";
//
- // Call MSO
+ // Call SO
//
- MSOResponse response = MSOManager.createModuleInstance(MSOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);
+ SOResponse response = SOManager.createModuleInstance(SOUrl, $params.getMsoURL(), $params.getMsoUsername(), $params.getMsoPassword(), request);
//////////////////////////////////////////////////////////
- // Simulate a valid MSOResponse for junit test
+ // Simulate a valid SOResponse for junit test
// Remove this for real deployment
//
- response = new MSOResponse();
- response.request = new MSORequest();
- response.request.requestStatus = new MSORequestStatus();
+ response = new SOResponse();
+ response.request = new SORequest();
+ response.request.requestStatus = new SORequestStatus();
response.request.requestStatus.requestState = "COMPLETE";
//////////////////////////////////////////////////////////
@@ -1014,7 +1014,7 @@ rule "${policyName}.EVENT.MANAGER.AAINQF199RESPONSE"
insert(response);
} else {
//
- // MSO request not even accepted
+ // SO request not even accepted
//
notification.message = operationWrapper.operation.toMessage();
operationWrapper.operation.message = operationWrapper.operation.toMessage();
@@ -1047,7 +1047,7 @@ rule "${policyName}.EVENT.MANAGER.AAINQF199RESPONSE"
retract($manager);
}
} else {
- System.err.println("constructed MSO request is invalid.");
+ System.err.println("constructed SO request is invalid.");
}
}
break;
@@ -1199,19 +1199,19 @@ end
/*
*
-* This rule responds to MSO Response Events
+* This rule responds to SO Response Events
*
*/
-rule "${policyName}.MSO.RESPONSE"
+rule "${policyName}.SO.RESPONSE"
when
$params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
$event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
$manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName )
$operationWrapper : ControlLoopOperationWrapper( requestID == $event.requestID )
- $request : MSORequest( requestId == $event.requestID.toString() )
- $response : MSOResponse( request.requestId == $event.requestID.toString() )
+ $request : SORequest( requestId == $event.requestID.toString() )
+ $response : SOResponse( request.requestId == $event.requestID.toString() )
then
- System.out.println("rule MSO.RESPONSE is triggered.");
+ System.out.println("rule SO.RESPONSE is triggered.");
//
// Construct notification
//
diff --git a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java
index 2cfead157..825c69b50 100644
--- a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java
+++ b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestFirewallDemo.java
@@ -68,7 +68,7 @@ public class TestFirewallDemo {
"type=operational",
"myFirewallDemoPolicy",
"v1.0",
- "MSO",
+ "SO",
"http://localhost:8080/TestREST/Test",
"POLICY",
"POLICY",
diff --git a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestMSO.java b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
index fab0961c5..6f79c6a74 100644
--- a/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestMSO.java
+++ b/controlloop/templates/template.demo.v1.0.0/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
@@ -25,14 +25,14 @@ import java.io.FileReader;
import java.util.UUID;
import org.junit.Test;
-import org.onap.policy.mso.MSOCloudConfiguration;
-import org.onap.policy.mso.MSOModelInfo;
-import org.onap.policy.mso.MSORelatedInstance;
-import org.onap.policy.mso.MSORelatedInstanceListElement;
-import org.onap.policy.mso.MSORequest;
-import org.onap.policy.mso.MSORequestDetails;
-import org.onap.policy.mso.MSORequestInfo;
-import org.onap.policy.mso.MSORequestParameters;
+import org.onap.policy.mso.SOCloudConfiguration;
+import org.onap.policy.mso.SOModelInfo;
+import org.onap.policy.mso.SORelatedInstance;
+import org.onap.policy.mso.SORelatedInstanceListElement;
+import org.onap.policy.mso.SORequest;
+import org.onap.policy.mso.SORequestDetails;
+import org.onap.policy.mso.SORequestInfo;
+import org.onap.policy.mso.SORequestParameters;
import org.onap.policy.aai.AAINQF199.AAINQF199Response;
import org.onap.policy.aai.AAINQF199.AAINQF199ResponseWrapper;
import org.onap.policy.mso.util.Serialization;
@@ -42,9 +42,9 @@ import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import com.google.gson.stream.JsonReader;
-public class TestMSO {
+public class TestSO {
- private static final Logger logger = LoggerFactory.getLogger(TestMSO.class);
+ private static final Logger logger = LoggerFactory.getLogger(TestSO.class);
@Test
public void test() throws FileNotFoundException {
@@ -98,14 +98,14 @@ public class TestMSO {
String cloudRegionItemCloudRegionId = aainqf199ResponseWrapper.aainqf199response.inventoryResponseItems.get(0).items.inventoryResponseItems.get(1).items.inventoryResponseItems.get(0).cloudRegion.cloudRegionId;
//
- // Construct an MSO request
+ // Construct an SO 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();
+ SORequest request = new SORequest();
+ request.requestDetails = new SORequestDetails();
+ request.requestDetails.modelInfo = new SOModelInfo();
+ request.requestDetails.cloudConfiguration = new SOCloudConfiguration();
+ request.requestDetails.requestInfo = new SORequestInfo();
+ request.requestDetails.requestParameters = new SORequestParameters();
request.requestDetails.requestParameters.userParams = null;
//
// cloudConfiguration
@@ -129,13 +129,13 @@ public class TestMSO {
//
// relatedInstanceList
//
- MSORelatedInstanceListElement relatedInstanceListElement1 = new MSORelatedInstanceListElement();
- MSORelatedInstanceListElement relatedInstanceListElement2 = new MSORelatedInstanceListElement();
- relatedInstanceListElement1.relatedInstance = new MSORelatedInstance();
- relatedInstanceListElement2.relatedInstance = new MSORelatedInstance();
+ SORelatedInstanceListElement relatedInstanceListElement1 = new SORelatedInstanceListElement();
+ SORelatedInstanceListElement relatedInstanceListElement2 = new SORelatedInstanceListElement();
+ relatedInstanceListElement1.relatedInstance = new SORelatedInstance();
+ relatedInstanceListElement2.relatedInstance = new SORelatedInstance();
//
relatedInstanceListElement1.relatedInstance.instanceId = serviceItemServiceInstanceId;
- relatedInstanceListElement1.relatedInstance.modelInfo = new MSOModelInfo();
+ relatedInstanceListElement1.relatedInstance.modelInfo = new SOModelInfo();
relatedInstanceListElement1.relatedInstance.modelInfo.modelType = "service";
relatedInstanceListElement1.relatedInstance.modelInfo.modelInvariantId = serviceItemPersonaModelId;
relatedInstanceListElement1.relatedInstance.modelInfo.modelNameVersionId = serviceItemModelNameVersionId;
@@ -143,7 +143,7 @@ public class TestMSO {
relatedInstanceListElement1.relatedInstance.modelInfo.modelVersion = serviceItemModelVersion;
//
relatedInstanceListElement2.relatedInstance.instanceId = vnfItemVnfId;
- relatedInstanceListElement2.relatedInstance.modelInfo = new MSOModelInfo();
+ relatedInstanceListElement2.relatedInstance.modelInfo = new SOModelInfo();
relatedInstanceListElement2.relatedInstance.modelInfo.modelType = "vnf";
relatedInstanceListElement2.relatedInstance.modelInfo.modelInvariantId = vnfItemPersonaModelId;
relatedInstanceListElement2.relatedInstance.modelInfo.modelNameVersionId = vnfItemModelNameVersionId;
@@ -154,9 +154,9 @@ public class TestMSO {
request.requestDetails.relatedInstanceList.add(relatedInstanceListElement1);
request.requestDetails.relatedInstanceList.add(relatedInstanceListElement2);
//
- // print MSO request for debug
+ // print SO request for debug
//
- logger.debug("MSO request sent:");
+ logger.debug("SO request sent:");
logger.debug(Serialization.gsonPretty.toJson(request));
}
diff --git a/controlloop/templates/template.demo/pom.xml b/controlloop/templates/template.demo/pom.xml
index eb85f7fdc..0bceea848 100644
--- a/controlloop/templates/template.demo/pom.xml
+++ b/controlloop/templates/template.demo/pom.xml
@@ -73,6 +73,12 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>mso</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
<artifactId>trafficgenerator</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
@@ -169,6 +175,12 @@
</dependency>
<dependency>
<groupId>org.onap.policy.drools-applications</groupId>
+ <artifactId>actor.mso</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.policy.drools-applications</groupId>
<artifactId>actor.vfc</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
diff --git a/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl b/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
index aa1f1e977..f832ea5e2 100644
--- a/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
+++ b/controlloop/templates/template.demo/src/main/resources/ControlLoop_Template_xacml_guard.drl
@@ -39,6 +39,18 @@ import org.onap.policy.appclcm.LCMResponse;
import org.onap.policy.appclcm.LCMCommonHeader;
import org.onap.policy.vfc.VFCRequest;
import org.onap.policy.vfc.VFCManager;
+import org.onap.policy.mso.SOManager;
+import org.onap.policy.mso.SORequest;
+import org.onap.policy.mso.SORequestStatus;
+import org.onap.policy.mso.SORequestDetails;
+import org.onap.policy.mso.SOModelInfo;
+import org.onap.policy.mso.SOCloudConfiguration;
+import org.onap.policy.mso.SORequestInfo;
+import org.onap.policy.mso.SORequestParameters;
+import org.onap.policy.mso.SORelatedInstanceListElement;
+import org.onap.policy.mso.SORelatedInstance;
+import org.onap.policy.mso.SOResponse;
+import org.onap.policy.controlloop.actor.mso.MSOActorServiceProvider;
import org.onap.policy.guard.PolicyGuard;
import org.onap.policy.guard.PolicyGuard.LockResult;
import org.onap.policy.guard.TargetLock;
@@ -499,6 +511,15 @@ rule "${policyName}.EVENT.MANAGER.OPERATION.LOCKED.GUARD_PERMITTED"
Engine.deliver("UEB", "APPC-CL", request);
}
break;
+ case "SO":
+ // at this point the AAI named query request should have already been made, the response recieved and used
+ // in the construction of the SO Request which is stored in operationRequest
+
+ if(request instanceof SORequest) {
+ // Call SO. The response will be inserted into memory once it's received
+ MSOActorServiceProvider.sendRequest(drools.getWorkingMemory(), request);
+ }
+ break;
case "VFC":
if (request instanceof VFCRequest) {
// Start VFC thread
@@ -894,6 +915,99 @@ end
/*
*
+* This rule responds to SO Response Events
+*
+*/
+rule "${policyName}.SO.RESPONSE"
+ when
+ $params : Params( getClosedLoopControlName() == "${closedLoopControlName}" )
+ $event : VirtualControlLoopEvent( closedLoopControlName == $params.getClosedLoopControlName(), closedLoopEventStatus == ControlLoopEventStatus.ONSET )
+ $manager : ControlLoopEventManager( closedLoopControlName == $event.closedLoopControlName )
+ $operation : ControlLoopOperationManager( onset.closedLoopControlName == $event.closedLoopControlName, onset.requestID == $event.requestID )
+ $opTimer : OperationTimer( closedLoopControlName == $event.closedLoopControlName, requestID == $event.requestID.toString() )
+ $lock : TargetLock (requestID == $event.requestID)
+ $request : SORequest( requestId == $event.requestID.toString() )
+ $response : SOResponse( request.requestId == $event.requestID.toString() )
+ then
+
+ //
+ // Logging
+ Logger.info("------------------------------------------------------------------------------------------------");
+ Logger.metrics(Instant.now() + " " + drools.getRule().getName() + " " + drools.getRule().getPackage());
+ Logger.metrics($params);
+ Logger.metrics($event);
+ Logger.metrics($manager);
+ Logger.metrics($operation);
+ Logger.metrics($opTimer);
+ Logger.metrics($lock);
+ Logger.metrics($response);
+
+ // Get the result of the operation
+ //
+ PolicyResult policyResult = $operation.onResponse($response);
+ if (policyResult != null) {
+ //
+ // This Operation has completed, construct a notification showing our results
+ //
+ VirtualControlLoopNotification notification = new VirtualControlLoopNotification($event);
+ notification.from = "policy";
+ notification.policyName = drools.getRule().getName();
+ notification.policyScope = "${policyScope}";
+ notification.policyVersion = "${policyVersion}";
+ notification.message = $operation.getOperationHistory();
+ notification.history = $operation.getHistory();
+ if (policyResult.equals(PolicyResult.SUCCESS)) {
+ notification.notification = ControlLoopNotificationType.OPERATION_SUCCESS;
+ //
+ // Let interested parties know
+ //
+ Engine.deliver("UEB", "POLICY-CL-MGT", notification);
+ } else {
+ notification.notification = ControlLoopNotificationType.OPERATION_FAILURE;
+ //
+ // Let interested parties know
+ //
+ Engine.deliver("UEB", "POLICY-CL-MGT", notification);
+ }
+ //
+ // Ensure the operation is complete
+ //
+ if ($operation.isOperationComplete() == true) {
+ //
+ // It is complete, remove it from memory
+ //
+ retract($operation);
+ //
+ // We must also retract the timer object
+ // NOTE: We could write a Rule to do this
+ //
+ retract($opTimer);
+ //
+ // Complete the operation
+ //
+ modify($manager) {finishOperation($operation)};
+ } else {
+ //
+ // Just doing this will kick off the LOCKED rule again
+ //
+ modify($operation) {};
+ }
+ } else {
+ //
+ // Its not finished yet (i.e. expecting more Response objects)
+ //
+ // Or possibly it is a leftover response that we timed the request out previously
+ //
+ }
+ //
+ // We are going to retract these objects from memory
+ //
+ retract($response);
+
+end
+
+/*
+*
* This is the timer that manages the timeout for an individual operation.
*
*/
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/AaiSimulator.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/AaiSimulator.java
index f4ed267b4..74b8bde0e 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/AaiSimulator.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/AaiSimulator.java
@@ -39,7 +39,7 @@ public class AaiSimulator {
@Path("/search/named-query")
public String aaiPostQuery()
{
- return "{\"inventory-response-item\":[{\"vserver\":{\"vserver-id\": \"vserver-id-Manisha-01\",\"vserver-name\": \"vserver-name-16102016-aai3255-data-11-1\",\"vserver-name2\": \"example-vserver-name2-val-68608\",\"prov-status\": \"example-prov-status-val-59118\",\"vserver-selflink\": \"example-vserver-selflink-val-10902\",\"in-maint\": true,\"is-closed-loop-disabled\": false,\"resource-version\": \"1477946963\"},\"model-name\": \"service-instance\",\"generic-vnf\": {\"vnf-id\": \"de7cc3ab-0212-47df-9e64-da1c79234deb\",\"vnf-name\": \"ZRDM2MMEX39\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1503082370097\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\"},\"extra-properties\": {},\"inventory-response-items\":{\"inventory-response-item\":[{\"generic-vnf\":{\"vnf-id\": \"generic-vnf-id-Manisha-01\",\"vnf-name\": \"bpsx0001v-16102016-aai3255-data-11\",\"vnf-name2\": \"example-vnf-name2-val-8204\",\"vnf-type\": \"my-vnf-type\",\"service-id\": \"c7611ebe-c324-48f1-8085-94aef0c6ef3d\",\"regional-resource-zone\": \"example-regional-resource-zone-val-8204\",\"prov-status\": \"ACTIVE\",\"operational-state\": \"example-operational-state-val-3289\",\"license-key\": \"example-license-key-val-3289\",\"equipment-role\": \"example-equipment-role-val-3289\",\"orchestration-status\": \"example-orchestration-status-val-3289\",\"heat-stack-id\": \"example-heat-stack-id-val-3289\",\"mso-catalog-key\": \"example-mso-catalog-key-val-3289\",\"management-option\": \"example-management-option-val-8204\",\"ipv4-oam-address\": \"example-ipv4-oam-address-val-8204\",\"ipv4-loopback0-address\": \"example-ipv4-loopback0-address-val-8204\",\"nm-lan-v6-address\": \"example-nm-lan-v6-address-val-8204\",\"management-v6-address\": \"example-management-v6-address-val-8204\",\"vcpu\": 7957,\"vcpu-units\": \"example-vcpu-units-val-8204\",\"vmemory\": 168,\"vmemory-units\": \"example-vmemory-units-val-8204\",\"vdisk\": 3227,\"vdisk-units\": \"example-vdisk-units-val-8204\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1477946966\"},\"model-name\": \"service-instance\",\"service-instance\": {\"service-instance-id\": \"37b8cdb7-94eb-468f-a0c2-4e3c3546578e\",\"service-instance-name\": \"Changed Service Instance NAME\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\",\"resource-version\": \"1503082993532\",\"orchestration-status\": \"Active\"},\"extra-properties\": {},\"inventory-response-items\":{\"inventory-response-item\":[{\"service-instance\":{\"service-instance-id\": \"service-instance-id-Manisha-01\",\"service-instance-name\": \"example-service-instance-name-val-5008-1\",\"widget-model-id\": \"example-widget-model-id-val-52958\",\"widget-model-version\": \"example-widget-model-version-val-42840\",\"bandwidth-total\": \"example-bandwidth-total-val-99587\",\"bandwidth-up-wan1\": \"example-bandwidth-up-wan1-val-73709\",\"bandwidth-down-wan1\": \"example-bandwidth-down-wan1-val-20007\",\"bandwidth-up-wan2\": \"example-bandwidth-up-wan2-val-16857\",\"bandwidth-down-wan2\": \"example-bandwidth-down-wan2-val-95839\",\"vhn-portal-url\": \"example-vhn-portal-url-val-21541\",\"operational-status\": \"example-operational-status-val-48090\",\"service-instance-location-id\": \"example-service-instance-location-id-val-9684\",\"resource-version\": \"1477946961\"},\"extra-properties\": {}},{\"model-name\": \"pnf\",\"generic-vnf\": {\"vnf-id\": \"jimmy-test\",\"vnf-name\": \"jimmy-test-vnf\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1504013830207\",\"model-invariant-id\": \"862b25a1-262a-4961-bdaa-cdc55d69785a\",\"model-version-id\": \"e9f1fa7d-c839-418a-9601-03dc0d2ad687\"},\"extra-properties\": {}},{\"model-name\": \"service-instance\",\"generic-vnf\": {\"vnf-id\": \"jimmy-test-vnf2\",\"vnf-name\": \"jimmy-test-vnf2-named\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1504014833841\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\"},\"extra-properties\": {}}]}}]}}]}";
+// return "{\"inventory-response-item\":[{\"vserver\":{\"vserver-id\": \"vserver-id-Manisha-01\",\"vserver-name\": \"vserver-name-16102016-aai3255-data-11-1\",\"vserver-name2\": \"example-vserver-name2-val-68608\",\"prov-status\": \"example-prov-status-val-59118\",\"vserver-selflink\": \"example-vserver-selflink-val-10902\",\"in-maint\": true,\"is-closed-loop-disabled\": false,\"resource-version\": \"1477946963\"},\"model-name\": \"service-instance\",\"generic-vnf\": {\"vnf-id\": \"de7cc3ab-0212-47df-9e64-da1c79234deb\",\"vnf-name\": \"ZRDM2MMEX39\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1503082370097\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\"},\"extra-properties\": {},\"inventory-response-items\":{\"inventory-response-item\":[{\"generic-vnf\":{\"vnf-id\": \"generic-vnf-id-Manisha-01\",\"vnf-name\": \"bpsx0001v-16102016-aai3255-data-11\",\"vnf-name2\": \"example-vnf-name2-val-8204\",\"vnf-type\": \"my-vnf-type\",\"service-id\": \"c7611ebe-c324-48f1-8085-94aef0c6ef3d\",\"regional-resource-zone\": \"example-regional-resource-zone-val-8204\",\"prov-status\": \"ACTIVE\",\"operational-state\": \"example-operational-state-val-3289\",\"license-key\": \"example-license-key-val-3289\",\"equipment-role\": \"example-equipment-role-val-3289\",\"orchestration-status\": \"example-orchestration-status-val-3289\",\"heat-stack-id\": \"example-heat-stack-id-val-3289\",\"mso-catalog-key\": \"example-mso-catalog-key-val-3289\",\"management-option\": \"example-management-option-val-8204\",\"ipv4-oam-address\": \"example-ipv4-oam-address-val-8204\",\"ipv4-loopback0-address\": \"example-ipv4-loopback0-address-val-8204\",\"nm-lan-v6-address\": \"example-nm-lan-v6-address-val-8204\",\"management-v6-address\": \"example-management-v6-address-val-8204\",\"vcpu\": 7957,\"vcpu-units\": \"example-vcpu-units-val-8204\",\"vmemory\": 168,\"vmemory-units\": \"example-vmemory-units-val-8204\",\"vdisk\": 3227,\"vdisk-units\": \"example-vdisk-units-val-8204\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1477946966\"},\"model-name\": \"service-instance\",\"service-instance\": {\"service-instance-id\": \"37b8cdb7-94eb-468f-a0c2-4e3c3546578e\",\"service-instance-name\": \"Changed Service Instance NAME\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\",\"resource-version\": \"1503082993532\",\"orchestration-status\": \"Active\"},\"extra-properties\": {},\"inventory-response-items\":{\"inventory-response-item\":[{\"service-instance\":{\"service-instance-id\": \"service-instance-id-Manisha-01\",\"service-instance-name\": \"example-service-instance-name-val-5008-1\",\"widget-model-id\": \"example-widget-model-id-val-52958\",\"widget-model-version\": \"example-widget-model-version-val-42840\",\"bandwidth-total\": \"example-bandwidth-total-val-99587\",\"bandwidth-up-wan1\": \"example-bandwidth-up-wan1-val-73709\",\"bandwidth-down-wan1\": \"example-bandwidth-down-wan1-val-20007\",\"bandwidth-up-wan2\": \"example-bandwidth-up-wan2-val-16857\",\"bandwidth-down-wan2\": \"example-bandwidth-down-wan2-val-95839\",\"vhn-portal-url\": \"example-vhn-portal-url-val-21541\",\"operational-status\": \"example-operational-status-val-48090\",\"service-instance-location-id\": \"example-service-instance-location-id-val-9684\",\"resource-version\": \"1477946961\"},\"extra-properties\": {}},{\"model-name\": \"pnf\",\"generic-vnf\": {\"vnf-id\": \"jimmy-test\",\"vnf-name\": \"jimmy-test-vnf\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1504013830207\",\"model-invariant-id\": \"862b25a1-262a-4961-bdaa-cdc55d69785a\",\"model-version-id\": \"e9f1fa7d-c839-418a-9601-03dc0d2ad687\"},\"extra-properties\": {}},{\"model-name\": \"service-instance\",\"generic-vnf\": {\"vnf-id\": \"jimmy-test-vnf2\",\"vnf-name\": \"jimmy-test-vnf2-named\",\"vnf-type\": \"vMME Svc Jul 14/vMME VF Jul 14 1\",\"service-id\": \"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb\",\"orchestration-status\": \"active\",\"in-maint\": false,\"is-closed-loop-disabled\": false,\"resource-version\": \"1504014833841\",\"model-invariant-id\": \"82194af1-3c2c-485a-8f44-420e22a9eaa4\",\"model-version-id\": \"46b92144-923a-4d20-b85a-3cbd847668a9\"},\"extra-properties\": {}}]}}]}}]}";
+ return "{\n\t\"inventory-response-item\": [{\n\t\t\t\"extra-properties\": {},\n\t\t\t\"inventory-response-items\": {\n\t\t\t\t\"inventory-response-item\": [{\n\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"c15ce9e1-e914-4c8f-b8bb\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"033a32ed-aa65-4764-a736-36f2942f1aa0\"\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\"property-value\": \"d4d072dc-4e21-4a03-9524-628985819a8e\"\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"generic-vnf\": {\n\t\t\t\t\t\t\t\"in-maint\": false,\n\t\t\t\t\t\t\t\"is-closed-loop-disabled\": false,\n\t\t\t\t\t\t\t\"orchestration-status\": \"Created\",\n\t\t\t\t\t\t\t\"persona-model-id\": \"033a32ed-aa65-4764-a736-36f2942f1aa0\",\n\t\t\t\t\t\t\t\"persona-model-version\": \"1.0\",\n\t\t\t\t\t\t\t\"resource-version\": \"1485542422\",\n\t\t\t\t\t\t\t\"service-id\": \"b3f70641-bdb9-4030-825e-6abb73a1f929\",\n\t\t\t\t\t\t\t\"vnf-id\": \"594e2fe0-48b8-41ff-82e2-3d4bab69b192\",\n\t\t\t\t\t\t\t\"vnf-name\": \"Vnf_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\",\n\t\t\t\t\t\t\t\"vnf-type\": \"8330e932-2a23-4943-8606/c15ce9e1-e914-4c8f-b8bb 1\"\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"inventory-response-items\": {\n\t\t\t\t\t\t\t\"inventory-response-item\": [{\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"8330e932-2a23-4943-8606\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"service\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"5c996219-b2e2-4c76-9b43-7e8672a33c1d\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"service-instance\": {\n\t\t\t\t\t\t\t\t\t\t\"persona-model-id\": \"4fcbc1c0-7793-46d8-8aa1-fa1c2ed9ec7b\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-version\": \"1.0\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485542400\",\n\t\t\t\t\t\t\t\t\t\t\"service-instance-id\": \"cf8426a6-0b53-4e3d-bfa6-4b2f4d5913a5\",\n\t\t\t\t\t\t\t\t\t\t\"service-instance-name\": \"Service_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"C15ce9e1E9144c8fB8bb..base_vlb..module-0\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"79ee24cd-fc9a-4f14-afae-5e1dd2ab2941\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"5484cabb-1a0d-4f29-a616-094a3f643d73\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"model-name\": \"C15ce9e1E9144c8fB8bb..base_vlb..module-0\",\n\t\t\t\t\t\t\t\t\t\"vf-module\": {\n\t\t\t\t\t\t\t\t\t\t\"heat-stack-id\": \"Vfmodule_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8/5845f37b-6cda-4e91-8ca3-f5572d226488\",\n\t\t\t\t\t\t\t\t\t\t\"is-base-vf-module\": true,\n\t\t\t\t\t\t\t\t\t\t\"orchestration-status\": \"active\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-id\": \"79ee24cd-fc9a-4f14-afae-5e1dd2ab2941\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-version\": \"1\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485542667\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-id\": \"b0eff878-e2e1-4947-9597-39afdd0f51dd\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-name\": \"Vfmodule_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"C15ce9e1E9144c8fB8bb..dnsscaling..module-1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"f32568ec-2f1c-458a-864b-0593d53d141a\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"69615025-879d-4f0d-afe3-b7d1a7eeed1f\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"vf-module\": {\n\t\t\t\t\t\t\t\t\t\t\"is-base-vf-module\": false,\n\t\t\t\t\t\t\t\t\t\t\"persona-model-id\": \"f32568ec-2f1c-458a-864b-0593d53d141a\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-version\": \"1.0\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485561752\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-id\": \"dummy\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-name\": \"dummy\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {\n\t\t\t\t\t\t\t\t\t\t\"extra-property\": [{\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"C15ce9e1E9144c8fB8bb..dnsscaling..module-1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-type\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"resource\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-version\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"1\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"f32568ec-2f1c-458a-864b-0593d53d141a\"\n\t\t\t\t\t\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-name\": \"model.model-name-version-id\",\n\t\t\t\t\t\t\t\t\t\t\t\t\"property-value\": \"69615025-879d-4f0d-afe3-b7d1a7eeed1f\"\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t]\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"vf-module\": {\n\t\t\t\t\t\t\t\t\t\t\"heat-stack-id\": \"vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8/f447ce51-14dd-4dcd-9957-68a047c79673\",\n\t\t\t\t\t\t\t\t\t\t\"is-base-vf-module\": false,\n\t\t\t\t\t\t\t\t\t\t\"orchestration-status\": \"active\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-id\": \"f32568ec-2f1c-458a-864b-0593d53d141a\",\n\t\t\t\t\t\t\t\t\t\t\"persona-model-version\": \"1.0\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485562712\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-id\": \"8cd79e44-1fae-48c1-a160-609f90b46749\",\n\t\t\t\t\t\t\t\t\t\t\"vf-module-name\": \"vDNS_Ete_Named90e1ab3-dcd5-4877-9edb-eadfc84e32c8\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t}\n\t\t\t\t\t}, {\n\t\t\t\t\t\t\"extra-properties\": {},\n\t\t\t\t\t\t\"inventory-response-items\": {\n\t\t\t\t\t\t\t\"inventory-response-item\": [{\n\t\t\t\t\t\t\t\t\t\"cloud-region\": {\n\t\t\t\t\t\t\t\t\t\t\"cloud-owner\": \"Rackspace\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-region-id\": \"DFW\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-region-version\": \"v1\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-type\": \"SharedNode\",\n\t\t\t\t\t\t\t\t\t\t\"cloud-zone\": \"CloudZone\",\n\t\t\t\t\t\t\t\t\t\t\"owner-defined-type\": \"OwnerType\",\n\t\t\t\t\t\t\t\t\t\t\"resource-version\": \"1485465545\"\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\"extra-properties\": {}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"tenant\": {\n\t\t\t\t\t\t\t\"resource-version\": \"1485465545\",\n\t\t\t\t\t\t\t\"tenant-id\": \"1015548\",\n\t\t\t\t\t\t\t\"tenant-name\": \"1015548\"\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t]\n\t\t\t},\n\t\t\t\"vserver\": {\n\t\t\t\t\"in-maint\": false,\n\t\t\t\t\"is-closed-loop-disabled\": false,\n\t\t\t\t\"prov-status\": \"ACTIVE\",\n\t\t\t\t\"resource-version\": \"1485546436\",\n\t\t\t\t\"vserver-id\": \"70f081eb-2a87-4c81-9296-4b93d7d145c6\",\n\t\t\t\t\"vserver-name\": \"vlb-lb-32c8\",\n\t\t\t\t\"vserver-name2\": \"vlb-lb-32c8\",\n\t\t\t\t\"vserver-selflink\": \"https://dfw.servers.api.rackspacecloud.com/v2/1015548/servers/70f081eb-2a87-4c81-9296-4b93d7d145c6\"\n\t\t\t}\n\t\t}\n\t]\n}";
}
-
}
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/MsoSimulatorTest.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/MsoSimulatorTest.java
index e2b1114be..7696cbe73 100644
--- a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/MsoSimulatorTest.java
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/MsoSimulatorTest.java
@@ -28,7 +28,7 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import org.onap.policy.drools.http.server.HttpServletServer;
-import org.onap.policy.mso.MSOResponse;
+import org.onap.policy.mso.SOResponse;
import org.onap.policy.mso.util.Serialization;
import org.onap.policy.rest.RESTManager;
import org.onap.policy.rest.RESTManager.Pair;
@@ -53,7 +53,7 @@ public class MsoSimulatorTest {
public void testResponse(){
Pair<Integer, String> httpDetails = RESTManager.post("http://localhost:6667/serviceInstances/v2/12345/vnfs/12345/vfModulesHTTPS/1.1", "username", "password", new HashMap<String, String>(), "application/json", "Some Request Here");
assertNotNull(httpDetails);
- MSOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, MSOResponse.class);
+ SOResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, SOResponse.class);
assertNotNull(response);
}
}
diff --git a/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
new file mode 100644
index 000000000..0738aadcf
--- /dev/null
+++ b/controlloop/templates/template.demo/src/test/java/org/onap/policy/template/demo/TestSO.java
@@ -0,0 +1,405 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * demo
+ * ================================================================================
+ * 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.onap.policy.template.demo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.time.Instant;
+import java.util.HashMap;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.kie.api.KieServices;
+import org.kie.api.builder.KieBuilder;
+import org.kie.api.builder.KieFileSystem;
+import org.kie.api.builder.Message;
+import org.kie.api.builder.ReleaseId;
+import org.kie.api.builder.Results;
+import org.kie.api.builder.model.KieModuleModel;
+import org.kie.api.runtime.KieContainer;
+import org.kie.api.runtime.KieSession;
+import org.kie.api.runtime.rule.FactHandle;
+import org.onap.policy.controlloop.ControlLoopEventStatus;
+import org.onap.policy.controlloop.ControlLoopLogger;
+import org.onap.policy.controlloop.ControlLoopTargetType;
+import org.onap.policy.controlloop.VirtualControlLoopEvent;
+import org.onap.policy.controlloop.impl.ControlLoopLoggerStdOutImpl;
+import org.onap.policy.controlloop.policy.ControlLoopPolicy;
+import org.onap.policy.drools.impl.PolicyEngineJUnitImpl;
+import org.onap.policy.mso.util.Serialization;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class TestSO {
+
+ private static final Logger log = LoggerFactory.getLogger(TestSO.class);
+
+ @Ignore
+ @Test
+ public void testvDNS() throws IOException {
+
+ final String yaml = "src/test/resources/yaml/policy_ControlLoop_SO-test.yaml";
+
+ //
+ // Pull info from the yaml
+ //
+ final Util.Pair<ControlLoopPolicy, String> pair = Util.loadYaml(yaml);
+ assertNotNull(pair);
+ assertNotNull(pair.a);
+ assertNotNull(pair.a.getControlLoop());
+ assertNotNull(pair.a.getControlLoop().getControlLoopName());
+ assertTrue(pair.a.getControlLoop().getControlLoopName().length() > 0);
+
+ //
+ // Build a container
+ //
+ final String closedLoopControlName = pair.a.getControlLoop().getControlLoopName();
+ final KieSession kieSession = buildContainer("src/main/resources/ControlLoop_Template_xacml_guard.drl",
+ closedLoopControlName,
+ "type=operational",
+ "myVDNSDemoPolicy",
+ "v1.0",
+ "SO",
+ "POLICY-CL-MGT",
+ "APPC-CL",
+ URLEncoder.encode(pair.b, "UTF-8")
+ );
+
+ log.debug("============ PRINTING YAML ============");
+ log.debug(URLEncoder.encode(pair.b, "UTF-8"));
+ log.debug("================ DONE =================");
+
+ //
+ // Insert our globals
+ //
+ final ControlLoopLogger logger = new ControlLoopLoggerStdOutImpl();
+ kieSession.setGlobal("Logger", logger);
+ final PolicyEngineJUnitImpl engine = new PolicyEngineJUnitImpl();
+ kieSession.setGlobal("Engine", engine);
+
+ //
+ // Initial fire of rules
+ //
+ kieSession.fireAllRules();
+ //
+ // Kick a thread that starts testing
+ //
+ new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+
+ log.debug("\n***** Starting AAI Simulator ***** ");
+ AaiSimulatorTest.setUpSimulator();
+ log.debug("\n***** AAI Simulator started ***** ");
+
+ log.debug("\n************ Starting vDNS Test *************\n");
+
+ //
+ // Generate an invalid DCAE Event with requestID=null
+ //
+ VirtualControlLoopEvent invalidEvent = new VirtualControlLoopEvent();
+ invalidEvent.closedLoopControlName = closedLoopControlName;
+ invalidEvent.requestID = null;
+ invalidEvent.closedLoopEventClient = "tca.instance00001";
+ invalidEvent.target_type = ControlLoopTargetType.VNF;
+ invalidEvent.target = "generic-vnf.vnf-id";
+ invalidEvent.from = "DCAE";
+ invalidEvent.closedLoopAlarmStart = Instant.now();
+ invalidEvent.AAI = new HashMap<String, String>();
+ invalidEvent.AAI.put("vserver.vserver-name", "vserver-name-16102016-aai3255-data-11-1");
+ invalidEvent.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
+
+ log.debug("-------- Sending Invalid ONSET --------");
+ log.debug(Serialization.gsonPretty.toJson(invalidEvent));
+
+ //
+ // Insert invalid DCAE Event into memory
+ //
+ kieSession.insert(invalidEvent);
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ }
+ //
+ // Generate first DCAE ONSET Event
+ //
+ VirtualControlLoopEvent onsetEvent = new VirtualControlLoopEvent();
+ onsetEvent.closedLoopControlName = closedLoopControlName;
+ onsetEvent.requestID = UUID.randomUUID();
+ onsetEvent.closedLoopEventClient = "tca.instance00001";
+ onsetEvent.target_type = ControlLoopTargetType.VNF;
+ onsetEvent.target = "VNF_NAME";
+ onsetEvent.from = "DCAE";
+ onsetEvent.closedLoopAlarmStart = Instant.now();
+ onsetEvent.AAI = new HashMap<String, String>();
+ onsetEvent.AAI.put("vserver.vserver-name", "vserver-name-16102016-aai3255-data-11-1");
+ onsetEvent.AAI.put("vserver.is-closed-loop-disabled", "false");
+ onsetEvent.closedLoopEventStatus = ControlLoopEventStatus.ONSET;
+
+ log.debug("-------- Sending Valid ONSET --------");
+ log.debug(Serialization.gsonPretty.toJson(onsetEvent));
+
+ //
+ // Insert first DCAE ONSET Event into memory
+ //
+ kieSession.insert(onsetEvent);
+ //
+ // We have test for subsequent ONSET Events in testvFirewall()
+ // So no need to test it again here
+ //
+ try {
+ Thread.sleep(3000);
+ } catch (InterruptedException e) {
+ }
+ //
+ // Test is finished, so stop the kieSession
+ //
+ kieSession.halt();
+ }
+ //
+ }).start();
+ //
+ // Start firing rules
+ //
+ kieSession.fireUntilHalt();
+ //
+ // Dump working memory
+ //
+ dumpFacts(kieSession);
+
+ log.debug("\n***** Stopping AAI Simulator ***** ");
+ AaiSimulatorTest.tearDownSimulator();
+ log.debug("\n***** AAI Simulator stopped ***** ");
+
+ //
+ // See if there is anything left in memory, there SHOULD only be
+ // a params fact.
+ //
+ assertEquals("There should only be 1 Fact left in memory.", 1, kieSession.getFactCount());
+ for (FactHandle handle : kieSession.getFactHandles()) {
+ Object fact = kieSession.getObject(handle);
+ assertEquals("Non-Param Fact left in working memory", "org.onap.policy.controlloop.Params", fact.getClass().getName());
+ }
+
+ }
+
+ public static void dumpFacts(KieSession kieSession) {
+ log.debug("Fact Count: " + kieSession.getFactCount());
+ for (FactHandle handle : kieSession.getFactHandles()) {
+ log.debug("FACT: " + handle);
+ }
+ }
+
+ public static KieSession buildContainer(String droolsTemplate,
+ String closedLoopControlName,
+ String policyScope,
+ String policyName,
+ String policyVersion,
+ String actor,
+ String notificationTopic,
+ String appcTopic,
+ String yamlSpecification) throws IOException {
+ //
+ // Get our Drools Kie factory
+ //
+ KieServices ks = KieServices.Factory.get();
+
+ KieModuleModel kModule = ks.newKieModuleModel();
+
+ log.debug("KMODULE:" + System.lineSeparator() + kModule.toXML());
+
+ //
+ // Generate our drools rule from our template
+ //
+ KieFileSystem kfs = ks.newKieFileSystem();
+
+ kfs.writeKModuleXML(kModule.toXML());
+ {
+ Path rule = Paths.get(droolsTemplate);
+ String ruleTemplate = new String(Files.readAllBytes(rule));
+ String drlContents = generatePolicy(ruleTemplate,
+ closedLoopControlName,
+ policyScope,
+ policyName,
+ policyVersion,
+ actor,
+ notificationTopic,
+ appcTopic,
+ yamlSpecification
+ );
+
+ kfs.write("src/main/resources/" + policyName + ".drl", ks.getResources().newByteArrayResource(drlContents.getBytes()));
+ }
+ //
+ // Compile the rule
+ //
+ KieBuilder builder = ks.newKieBuilder(kfs).buildAll();
+ Results results = builder.getResults();
+ if (results.hasMessages(Message.Level.ERROR)) {
+ for (Message msg : results.getMessages()) {
+ System.err.println(msg.toString());
+ }
+ throw new RuntimeException("Drools Rule has Errors");
+ }
+ for (Message msg : results.getMessages()) {
+ log.debug(msg.toString());
+ }
+ //
+ // Create our kie Session and container
+ //
+ ReleaseId releaseId = ks.getRepository().getDefaultReleaseId();
+ log.debug("ReleaseId: " + releaseId);
+ KieContainer kContainer = ks.newKieContainer(releaseId);
+
+ return kContainer.newKieSession();
+ }
+ public static String generatePolicy(String ruleContents,
+ String closedLoopControlName,
+ String policyScope,
+ String policyName,
+ String policyVersion,
+ String actor,
+ String notificationTopic,
+ String appcTopic,
+ String controlLoopYaml) {
+
+ Pattern p = Pattern.compile("\\$\\{closedLoopControlName\\}");
+ Matcher m = p.matcher(ruleContents);
+ ruleContents = m.replaceAll(closedLoopControlName);
+
+ p = Pattern.compile("\\$\\{policyScope\\}");
+ m = p.matcher(ruleContents);
+ ruleContents = m.replaceAll(policyScope);
+
+ p = Pattern.compile("\\$\\{policyName\\}");
+ m = p.matcher(ruleContents);
+ ruleContents = m.replaceAll(policyName);
+
+ p = Pattern.compile("\\$\\{policyVersion\\}");
+ m = p.matcher(ruleContents);
+ ruleContents = m.replaceAll(policyVersion);
+
+ p = Pattern.compile("\\$\\{actor\\}");
+ m = p.matcher(ruleContents);
+ ruleContents = m.replaceAll(actor);
+
+// p = Pattern.compile("\\$\\{aaiURL\\}");
+// m = p.matcher(ruleContents);
+// if (aaiURL == null) {
+// ruleContents = m.replaceAll("null");
+// } else {
+// ruleContents = m.replaceAll(aaiURL);
+// }
+//
+// p = Pattern.compile("\\$\\{aaiUsername\\}");
+// m = p.matcher(ruleContents);
+// if (aaiUsername == null) {
+// ruleContents = m.replaceAll("null");
+// } else {
+// ruleContents = m.replaceAll(aaiUsername);
+// }
+//
+// p = Pattern.compile("\\$\\{aaiPassword\\}");
+// m = p.matcher(ruleContents);
+// if (aaiPassword == null) {
+// ruleContents = m.replaceAll("null");
+// } else {
+// ruleContents = m.replaceAll(aaiPassword);
+// }
+//
+// p = Pattern.compile("\\$\\{msoURL\\}");
+// m = p.matcher(ruleContents);
+// if (msoURL == null) {
+// ruleContents = m.replaceAll("null");
+// } else {
+// ruleContents = m.replaceAll(msoURL);
+// }
+//
+// p = Pattern.compile("\\$\\{msoUsername\\}");
+// m = p.matcher(ruleContents);
+// if (msoUsername == null) {
+// ruleContents = m.replaceAll("null");
+// } else {
+// ruleContents = m.replaceAll(msoUsername);
+// }
+//
+// p = Pattern.compile("\\$\\{msoPassword\\}");
+// m = p.matcher(ruleContents);
+// if (msoPassword == null) {
+// ruleContents = m.replaceAll("null");
+// } else {
+// ruleContents = m.replaceAll(msoPassword);
+// }
+//
+// p = Pattern.compile("\\$\\{aaiNamedQueryUUID\\}");
+// m = p.matcher(ruleContents);
+// if (aaiNamedQueryUUID == null) {
+// ruleContents = m.replaceAll("null");
+// } else {
+// ruleContents = m.replaceAll(aaiNamedQueryUUID);
+// }
+//
+// p = Pattern.compile("\\$\\{aaiPatternMatch\\}");
+// m = p.matcher(ruleContents);
+// if (aaiPatternMatch == 1) {
+// ruleContents = m.replaceAll("1");
+// } else {
+// ruleContents = m.replaceAll("0");
+// }
+
+ p = Pattern.compile("\\$\\{notificationTopic\\}");
+ m = p.matcher(ruleContents);
+ if (notificationTopic == null) {
+ ruleContents = m.replaceAll("null");
+ } else {
+ ruleContents = m.replaceAll(notificationTopic);
+ }
+
+ p = Pattern.compile("\\$\\{appcTopic\\}");
+ m = p.matcher(ruleContents);
+ if (appcTopic == null) {
+ ruleContents = m.replaceAll("null");
+ } else {
+ ruleContents = m.replaceAll(appcTopic);
+ }
+
+ p = Pattern.compile("\\$\\{controlLoopYaml\\}");
+ m = p.matcher(ruleContents);
+ ruleContents = m.replaceAll(controlLoopYaml);
+
+ log.debug(ruleContents);
+
+ return ruleContents;
+ }
+
+}
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
new file mode 100644
index 000000000..d3ae91650
--- /dev/null
+++ b/controlloop/templates/template.demo/src/test/resources/yaml/policy_ControlLoop_SO-test.yaml
@@ -0,0 +1,26 @@
+controlLoop:
+ version: 2.0.0
+ controlLoopName: ControlLoop-vDNS-6f37f56d-a87d-4b85-b6a9-cc953cf779b3
+ services:
+ - serviceName: d4738992-6497-4dca-9db9
+ serviceInvariantUUID: dc112d6e-7e73-4777-9c6f-1a7fb5fd1b6f
+ serviceUUID: 2eea06c6-e1d3-4c3a-b9c4-478c506eeedf
+ trigger_policy: unique-policy-id-1-scale-up
+ timeout: 1200
+
+policies:
+ - id: unique-policy-id-1-scale-up
+ name: Create a new VF Module
+ description:
+ actor: SO
+ recipe: VF Module Create
+ target:
+ type: VNF
+ retry: 0
+ timeout: 1200
+ success: final_success
+ failure: final_failure
+ failure_timeout: final_failure_timeout
+ failure_retries: final_failure_retries
+ failure_exception: final_failure_exception
+ failure_guard: final_failure_guard \ No newline at end of file