From 6ad41e3ccd398a2721f41ad61c80b7bb03f7d127 Mon Sep 17 00:00:00 2001 From: Ittay Stern Date: Mon, 31 Dec 2018 17:21:27 +0200 Subject: Merge from ECOMP's repository Main Features -------------- - Async-Instantiation jobs mechanism major update; still WIP (package `org.onap.vid.job`) - New features in View/Edit: Activate fabric configuration; show related networks; soft delete - Support AAI service-tree traversal (`AAIServiceTree`) - In-memory cache for SDC models and certain A&AI queries (`CacheProviderWithLoadingCache`) - Upgrade TOSCA Parser and add parsing options; fix malformed TOSCA models - Resolve Cloud-Owner values for MSO - Pass X-ONAP headers to MSO Infrastructure -------------- - Remove codehaus' jackson mapper; use soley fasterxml 2.9.7 - Surefire invokes both TestNG and JUnit tests - Support Kotlin source files - AaiController2 which handles errors in a "Spring manner" - Inline generated-sources and remove jsonschema2pojo Quality -------- - Cumulative bug fixes (A&AI API, UI timeouts, and many more) - Many Sonar issues cleaned-up - Some unused classes removed - Minor changes in vid-automation project, allowing some API verification to run Hard Merges ------------ - HTTP Clients (MSO, A&AI, WebConfig, OutgoingRequestHeadersTest) - Moved `package org.onap.vid.controllers` to `controller`, without plural -- just to keep semantic sync with ECOMP. Reference commit in ECOMP: 3d1141625 Issue-ID: VID-378 Change-Id: I9c8d1e74caa41815891d441fc0760bb5f29c5788 Signed-off-by: Ittay Stern --- .../BaseResourceInstantiationRequestDetails.java | 142 ++++++++ .../org/onap/vid/mso/model/CloudConfiguration.java | 173 ++++++++++ .../InstanceGroupInstantiationRequestDetails.java | 48 +++ .../java/org/onap/vid/mso/model/ModelInfo.java | 279 +++++++++++++++ .../model/NetworkInstantiationRequestDetails.java | 86 +++++ .../model/OperationalEnvironmentActivateInfo.java | 3 +- .../java/org/onap/vid/mso/model/RequestInfo.java | 376 +++++++++++++++++++++ .../org/onap/vid/mso/model/RequestParameters.java | 123 +++++++ .../org/onap/vid/mso/model/RequestReferences.java | 121 +++++++ .../vid/mso/model/ServiceDeletionRequestDetails.kt | 15 + .../model/ServiceInstantiationRequestDetails.java | 84 +++-- .../java/org/onap/vid/mso/model/UserParam.java | 98 ++++++ .../org/onap/vid/mso/model/UserParamTypes.java | 4 + .../model/VfModuleInstantiationRequestDetails.java | 111 ++++++ .../java/org/onap/vid/mso/model/VfModuleMacro.java | 71 ++++ .../mso/model/VnfInstantiationRequestDetails.java | 87 +++++ .../vid/mso/model/VolumeGroupRequestDetails.java | 18 + 17 files changed, 1810 insertions(+), 29 deletions(-) create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/BaseResourceInstantiationRequestDetails.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/CloudConfiguration.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/InstanceGroupInstantiationRequestDetails.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/ModelInfo.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/NetworkInstantiationRequestDetails.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/RequestInfo.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/RequestParameters.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/RequestReferences.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceDeletionRequestDetails.kt create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/UserParam.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/UserParamTypes.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleMacro.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/VnfInstantiationRequestDetails.java create mode 100644 vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java (limited to 'vid-app-common/src/main/java/org/onap/vid/mso/model') diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/BaseResourceInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/BaseResourceInstantiationRequestDetails.java new file mode 100644 index 000000000..9ade2abc4 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/BaseResourceInstantiationRequestDetails.java @@ -0,0 +1,142 @@ +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +import java.util.List; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +@JsonInclude(NON_NULL) +public class BaseResourceInstantiationRequestDetails { + + @JsonProperty("modelInfo") + protected ModelInfo modelInfo; + + @JsonProperty("cloudConfiguration") + protected CloudConfiguration cloudConfiguration; + + @JsonProperty("requestInfo") + protected RequestInfo requestInfo; + + @JsonProperty("platform") + protected Platform platform; + + @JsonProperty("lineOfBusiness") + protected LineOfBusiness lineOfBusiness; + + @JsonProperty("relatedInstanceList") + protected List relatedInstanceList; + + @JsonProperty("requestParameters") + protected RequestParameters requestParameters; + + public BaseResourceInstantiationRequestDetails(@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, + @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration, + @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo, + @JsonProperty(value = "platform", required = true) Platform platform, + @JsonProperty(value = "lineOfBusiness", required = true) LineOfBusiness lineOfBusiness, + @JsonProperty(value = "relatedInstanceList", required = true) List relatedInstanceList, + @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters) + { + this.modelInfo = modelInfo; + this.cloudConfiguration = cloudConfiguration; + this.requestInfo = requestInfo; + this.platform = platform; + this.lineOfBusiness = lineOfBusiness; + this.relatedInstanceList = relatedInstanceList; + this.requestParameters = requestParameters; + } + + public BaseResourceInstantiationRequestDetails(@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, + @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration, + @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo, + @JsonProperty(value = "relatedInstanceList", required = true) List relatedInstanceList, + @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters) + { + this.modelInfo = modelInfo; + this.cloudConfiguration = cloudConfiguration; + this.requestInfo = requestInfo; + this.relatedInstanceList = relatedInstanceList; + this.requestParameters = requestParameters; + } + + public static class RequestInfo { + + @JsonInclude(NON_NULL) public final String instanceName; + @JsonInclude(NON_NULL) public final String productFamilyId; + public final String source; + public final boolean suppressRollback; + public final String requestorId; + + public RequestInfo(String instanceName, String productFamilyId, String source, boolean rollbackOnFailure, String requestorId) { + this.instanceName = instanceName; + this.productFamilyId = productFamilyId; + this.source = source; + this.requestorId = requestorId; + // in the FE we are asking for "RollbackOnFailure" but to MSO we are passing the negative value "suppressRollback" + this.suppressRollback = !rollbackOnFailure; + } + } + + public static class Project{ + public final String projectName; + + public Project(String projectName) { + this.projectName = projectName; + } + } + + public static class Platform{ + public final String platformName; + + public Platform(String platformName) { + this.platformName = platformName; + } + } + + public static class LineOfBusiness{ + public final String lineOfBusinessName; + + public LineOfBusiness(String lineOfBusiness) { + this.lineOfBusinessName = lineOfBusiness; + } + } + + @JsonTypeName("relatedInstance") + @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) + public static class RelatedInstance{ + public ModelInfo modelInfo; + @JsonInclude(NON_NULL) public String instanceId; //TODO ask Eylon - is this needed, and if yes, for other fields as well? + @JsonInclude(NON_NULL) public String instanceName; + + public RelatedInstance (@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, + @JsonProperty (value = "instanceId", required = true) String instanceId){ + this.modelInfo = modelInfo; + this.instanceId = instanceId; + } + + public RelatedInstance (@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, + @JsonProperty (value = "instanceId", required = true) String instanceId, + @JsonProperty (value = "instanceName", required = true) String instanceName){ + this.modelInfo = modelInfo; + this.instanceId = instanceId; + this.instanceName = instanceName; + } + } + + public static class RequestParameters { + public final List userParams; + + public RequestParameters(List userParams) { + this.userParams = userParams; + } + + public List getUserParams() { + return userParams; + } + } +} + diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/CloudConfiguration.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/CloudConfiguration.java new file mode 100644 index 000000000..8286ec2b0 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/CloudConfiguration.java @@ -0,0 +1,173 @@ + +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.*; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.util.HashMap; +import java.util.Map; + + +/** + * fields communicating the cloud configuration in a standard way + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "nodeLocation", + "lcpCloudRegionId", + "tenantId", + "cloudOwner" +}) +public class CloudConfiguration { + + /** + * Location identifier for the node + * + */ + @JsonProperty("nodeLocation") + private String nodeLocation; + /** + * LCP Node Location identifier + * + */ + @JsonProperty("lcpCloudRegionId") + private String lcpCloudRegionId; + /** + * Openstack tenant id + * + */ + @JsonProperty("tenantId") + private String tenantId; + /** + * the cloud owner + * + */ + @JsonProperty("cloudOwner") + private String cloudOwner; + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + /** + * Location identifier for the node + * + * @return + * The nodeLocation + */ + @JsonProperty("nodeLocation") + public String getNodeLocation() { + return nodeLocation; + } + + /** + * Location identifier for the node + * + * @param nodeLocation + * The nodeLocation + */ + @JsonProperty("nodeLocation") + public void setNodeLocation(String nodeLocation) { + this.nodeLocation = nodeLocation; + } + + /** + * LCP Node Location identifier + * + * @return + * The lcpCloudRegionId + */ + @JsonProperty("lcpCloudRegionId") + public String getLcpCloudRegionId() { + return lcpCloudRegionId; + } + + /** + * LCP Node Location identifier + * + * @param lcpCloudRegionId + * The lcpCloudRegionId + */ + @JsonProperty("lcpCloudRegionId") + public void setLcpCloudRegionId(String lcpCloudRegionId) { + this.lcpCloudRegionId = lcpCloudRegionId; + } + + /** + * Openstack tenant id + * + * @return + * The tenantId + */ + @JsonProperty("tenantId") + public String getTenantId() { + return tenantId; + } + + /** + * Openstack tenant id + * + * @param tenantId + * The tenantId + */ + @JsonProperty("tenantId") + public void setTenantId(String tenantId) { + this.tenantId = tenantId; + } + + /** + * the cloud owner + * + * @return + * The cloudOwner + */ + @JsonProperty("cloudOwner") + public String getCloudOwner() { + return cloudOwner; + } + + /** + * the cloud owner + * + * @param cloudOwner + * The cloudOwner + */ + @JsonProperty("cloudOwner") + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(nodeLocation).append(lcpCloudRegionId).append(tenantId).append(cloudOwner).append(additionalProperties).toHashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof CloudConfiguration)) { + return false; + } + CloudConfiguration rhs = ((CloudConfiguration) other); + return new EqualsBuilder().append(nodeLocation, rhs.nodeLocation).append(lcpCloudRegionId, rhs.lcpCloudRegionId).append(tenantId, rhs.tenantId).append(cloudOwner, rhs.cloudOwner).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/InstanceGroupInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/InstanceGroupInstantiationRequestDetails.java new file mode 100644 index 000000000..26013412b --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/InstanceGroupInstantiationRequestDetails.java @@ -0,0 +1,48 @@ +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/* Based on this model: + +//{ +// "requestDetails": { +// "modelInfo": { +// "modelType": "instanceGroup", +// "modelVersionId": "ddcbbf3d-f2c1-4ca0-8852-76a807285efc" +// }, +// "requestInfo": { +// "source": "VID", +// "requestorId": "az2016" +// }, +// "relatedInstanceList": [ +// { +// "relatedInstance": { +// "instanceId": "{the relate-to/parent serviceInstanceId}", +// "modelInfo": { +// "modelType": "service", +// "modelVersionId": "b3b7e7d3-ecb9-4a91-8f6d-e60d236e8e77", +// } +// } +// } +// ], +// "requestParameters": { +// "userParams": [] +// } +// } +//} + + */ + +public class InstanceGroupInstantiationRequestDetails extends BaseResourceInstantiationRequestDetails { + + public InstanceGroupInstantiationRequestDetails(@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, + @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo, + @JsonProperty(value = "relatedInstanceList", required = true) List relatedInstanceList, + @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters) + { + super(modelInfo, null, requestInfo, null, null, relatedInstanceList, requestParameters); + } +} + diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/ModelInfo.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/ModelInfo.java new file mode 100644 index 000000000..091a241df --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/ModelInfo.java @@ -0,0 +1,279 @@ + +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + + +/** + * fields describing the SDC entity being operated on by the request + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "modelCustomizationName", + "modelCustomizationId", + "modelInvariantId", + "modelVersionId", + "modelName", + "modelNameVersionId", + "modelType", + "modelVersion" +}) +public class ModelInfo { + + /** + * reference to the customized set of parameters associated with a model in a given service context + * + */ + @JsonProperty("modelCustomizationName") + private String modelCustomizationName; + /** + * reference to the customized set of parameters associated with a model in a given service context + * + */ + @JsonProperty("modelCustomizationId") + private String modelCustomizationId; + /** + * Invariant UUID for the model name, irrespective of the version, as defined in SDC--authoritative + * + */ + @JsonProperty("modelInvariantId") + private String modelInvariantId; + /** + * Version id for version + * + */ + @JsonProperty("modelVersionId") + private String modelVersionId; + /** + * name of the model as defined in SDC--not authoritative + * + */ + @JsonProperty("modelName") + private String modelName; + /** + * UUID for the model name and version combination as defined in SDC--authoritative + * + */ + @JsonProperty("modelNameVersionId") + private String modelNameVersionId; + /** + * short description of the entity being operated on + * (Required) + * + */ + @JsonProperty("modelType") + private String modelType; + /** + * the version of the model as defined in SDC--not authoritative + * + */ + @JsonProperty("modelVersion") + private String modelVersion; + + /** + * reference to the customized set of parameters associated with a model in a given service context + * + * @return + * The modelCustomizationName + */ + @JsonProperty("modelCustomizationName") + public String getModelCustomizationName() { + return modelCustomizationName; + } + + /** + * reference to the customized set of parameters associated with a model in a given service context + * + * @param modelCustomizationName + * The modelCustomizationName + */ + @JsonProperty("modelCustomizationName") + public void setModelCustomizationName(String modelCustomizationName) { + this.modelCustomizationName = modelCustomizationName; + } + + /** + * reference to the customized set of parameters associated with a model in a given service context + * + * @return + * The modelCustomizationId + */ + @JsonProperty("modelCustomizationId") + public String getModelCustomizationId() { + return modelCustomizationId; + } + + /** + * reference to the customized set of parameters associated with a model in a given service context + * + * @param modelCustomizationId + * The modelCustomizationId + */ + @JsonProperty("modelCustomizationId") + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + /** + * Invariant UUID for the model name, irrespective of the version, as defined in SDC--authoritative + * + * @return + * The modelInvariantId + */ + @JsonProperty("modelInvariantId") + public String getModelInvariantId() { + return modelInvariantId; + } + + /** + * Invariant UUID for the model name, irrespective of the version, as defined in SDC--authoritative + * + * @param modelInvariantId + * The modelInvariantId + */ + @JsonProperty("modelInvariantId") + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + /** + * Version id for version + * + * @return + * The modelVersionId + */ + @JsonProperty("modelVersionId") + public String getModelVersionId() { + return modelVersionId; + } + + /** + * Version id for version + * + * @param modelVersionId + * The modelVersionId + */ + @JsonProperty("modelVersionId") + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + /** + * name of the model as defined in SDC--not authoritative + * + * @return + * The modelName + */ + @JsonProperty("modelName") + public String getModelName() { + return modelName; + } + + /** + * name of the model as defined in SDC--not authoritative + * + * @param modelName + * The modelName + */ + @JsonProperty("modelName") + public void setModelName(String modelName) { + this.modelName = modelName; + } + + /** + * UUID for the model name and version combination as defined in SDC--authoritative + * + * @return + * The modelNameVersionId + */ + @JsonProperty("modelNameVersionId") + public String getModelNameVersionId() { + return modelNameVersionId; + } + + /** + * UUID for the model name and version combination as defined in SDC--authoritative + * + * @param modelNameVersionId + * The modelNameVersionId + */ + @JsonProperty("modelNameVersionId") + public void setModelNameVersionId(String modelNameVersionId) { + this.modelNameVersionId = modelNameVersionId; + } + + /** + * short description of the entity being operated on + * (Required) + * + * @return + * The modelType + */ + @JsonProperty("modelType") + public String getModelType() { + return modelType; + } + + /** + * short description of the entity being operated on + * (Required) + * + * @param modelType + * The modelType + */ + @JsonProperty("modelType") + public void setModelType(String modelType) { + this.modelType = modelType; + } + + /** + * the version of the model as defined in SDC--not authoritative + * + * @return + * The modelVersion + */ + @JsonProperty("modelVersion") + public String getModelVersion() { + return modelVersion; + } + + /** + * the version of the model as defined in SDC--not authoritative + * + * @param modelVersion + * The modelVersion + */ + @JsonProperty("modelVersion") + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationName).append(modelCustomizationId).append(modelInvariantId).append(modelVersionId).append(modelName).append(modelNameVersionId).append(modelType).append(modelVersion).toHashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof ModelInfo)) { + return false; + } + ModelInfo rhs = ((ModelInfo) other); + return new EqualsBuilder().append(modelCustomizationName, rhs.modelCustomizationName).append(modelCustomizationId, rhs.modelCustomizationId).append(modelInvariantId, rhs.modelInvariantId).append(modelVersionId, rhs.modelVersionId).append(modelName, rhs.modelName).append(modelNameVersionId, rhs.modelNameVersionId).append(modelType, rhs.modelType).append(modelVersion, rhs.modelVersion).isEquals(); + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/NetworkInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/NetworkInstantiationRequestDetails.java new file mode 100644 index 000000000..d8539f6a9 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/NetworkInstantiationRequestDetails.java @@ -0,0 +1,86 @@ +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/* Based on this model: + + +// { +// "requestDetails": { +// "modelInfo": { +// “modelType”: “network”, +// “modelInvariantId”: “ff5256d1-5a33-55df-13ab-12abad84e7ff”, +// “modelVersionId”: “fe042c22-ba82-43c6-b2f6-8f1fc4164091”, +// “modelName”: “vSAMP12”, +// "modelVersion": "1.0", +// “modelCustomizationName”: “vSAMP12 1”, +// “modelCustomizationId”: “a7f1d08e-b02d-11e6-80f5-76304dec7eb7” +// }, +// “cloudConfiguration”: { +// “lcpCloudRegionId”: “mdt1”, +// “tenantId”: “88a6ca3ee0394ade9403f075db23167e” +// }, +// "requestInfo": { +// “instanceName”: “MSOTEST103a”, +// “productFamilyId”: “a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb”, +// “source”: “VID”, +// “suppressRollback”: false, +// “requestorId”: “az2016” +// }, +// "platform": { +// "platformName": "{some platformName}" +// }, +// "lineOfBusiness": { +// "lineOfBusinessName": "{some string}" +// }, +// "relatedInstanceList": [ +// { +// “relatedInstance”: { +// “instanceId”: “{serviceInstanceId}”, +// “modelInfo”: { +// “modelType”: “service”, +// “modelInvariantId”: “ff3514e3-5a33-55df-13ab-12abad84e7ff”, +// “modelVersionId”: “fe6985cd-ea33-3346-ac12-ab121484a3fe”, +// “modelName”: “{parent service model name}”, +// "modelVersion": "1.0" +// } +// } +// }, +// { +// “relatedInstance”: { +// “instanceId”: “{instanceGroupId}”, +// “modelInfo”: { +// “modelType”: “networkCollection”, +// “modelInvariantId”: “9ea660dc-155f-44d3-b45c-cc7648b4f31c”, +// “modelVersionId”: “bb07aad1-ce2d-40c1-85cb-5392f76bb1ef”, +// “modelName”: “{network collection model name}”, +// "modelVersion": "1.0" +// } +// } +// } + +// ], +// “requestParameters”: { +// “userParams”: [] +// } +// } +// } + + */ + +public class NetworkInstantiationRequestDetails extends BaseResourceInstantiationRequestDetails { + + public NetworkInstantiationRequestDetails(@JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, + @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration, + @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo, + @JsonProperty(value = "platform", required = true) Platform platform, + @JsonProperty(value = "lineOfBusiness", required = true) LineOfBusiness lineOfBusiness, + @JsonProperty(value = "relatedInstanceList", required = true) List relatedInstanceList, + @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters) + { + super(modelInfo, cloudConfiguration, requestInfo, platform, lineOfBusiness, relatedInstanceList, requestParameters); + } +} + diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfo.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfo.java index a5a10a774..bca643a6d 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfo.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/OperationalEnvironmentActivateInfo.java @@ -1,8 +1,7 @@ package org.onap.vid.mso.model; -import org.onap.vid.controllers.OperationalEnvironmentController; - import com.google.common.base.MoreObjects; +import org.onap.vid.controller.OperationalEnvironmentController; public class OperationalEnvironmentActivateInfo extends OperationalEnvironmentController.OperationalEnvironmentActivateBody { private final String userId; diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestInfo.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestInfo.java new file mode 100644 index 000000000..1290361a1 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestInfo.java @@ -0,0 +1,376 @@ + +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.*; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.util.HashMap; +import java.util.Map; + + +/** + * fields providing general context information for the request + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "billingAccountNumber", + "callbackUrl", + "correlator", + "instanceName", + "orderNumber", + "orderVersion", + "productFamilyId", + "source", + "suppressRollback", + "responseValue", + "requestorId" +}) +public class RequestInfo { + + /** + * billing account associated with the model being operated on + * + */ + @JsonProperty("billingAccountNumber") + private String billingAccountNumber; + /** + * client URL to use for asynchronous responses + * + */ + @JsonProperty("callbackUrl") + private String callbackUrl; + /** + * Optional correlationId for async callback requests + * + */ + @JsonProperty("correlator") + private String correlator; + /** + * Client provided name for the instance being operated on by the operation (note: not guaranteed to be unique) + * + */ + @JsonProperty("instanceName") + private String instanceName; + /** + * reference to an order + * + */ + @JsonProperty("orderNumber") + private String orderNumber; + /** + * order version number + * + */ + @JsonProperty("orderVersion") + private Double orderVersion; + /** + * UUID for the product family associated with the model being operated on + * + */ + @JsonProperty("productFamilyId") + private String productFamilyId; + /** + * source of the request--not authoritative--actual source revealed via authentication + * + */ + @JsonProperty("source") + private String source; + /** + * true or false boolean indicating whether rollbacks should be suppressed on failures + * + */ + @JsonProperty("suppressRollback") + private Boolean suppressRollback; + /** + * Is the user selected value based on the validResponses list provided to complete the manual task + * + */ + @JsonProperty("responseValue") + private String responseValue; + /** + * The id of the person who initiated the completion request + * + */ + @JsonProperty("requestorId") + private String requestorId; + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + /** + * billing account associated with the model being operated on + * + * @return + * The billingAccountNumber + */ + @JsonProperty("billingAccountNumber") + public String getBillingAccountNumber() { + return billingAccountNumber; + } + + /** + * billing account associated with the model being operated on + * + * @param billingAccountNumber + * The billingAccountNumber + */ + @JsonProperty("billingAccountNumber") + public void setBillingAccountNumber(String billingAccountNumber) { + this.billingAccountNumber = billingAccountNumber; + } + + /** + * client URL to use for asynchronous responses + * + * @return + * The callbackUrl + */ + @JsonProperty("callbackUrl") + public String getCallbackUrl() { + return callbackUrl; + } + + /** + * client URL to use for asynchronous responses + * + * @param callbackUrl + * The callbackUrl + */ + @JsonProperty("callbackUrl") + public void setCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + } + + /** + * Optional correlationId for async callback requests + * + * @return + * The correlator + */ + @JsonProperty("correlator") + public String getCorrelator() { + return correlator; + } + + /** + * Optional correlationId for async callback requests + * + * @param correlator + * The correlator + */ + @JsonProperty("correlator") + public void setCorrelator(String correlator) { + this.correlator = correlator; + } + + /** + * Client provided name for the instance being operated on by the operation (note: not guaranteed to be unique) + * + * @return + * The instanceName + */ + @JsonProperty("instanceName") + public String getInstanceName() { + return instanceName; + } + + /** + * Client provided name for the instance being operated on by the operation (note: not guaranteed to be unique) + * + * @param instanceName + * The instanceName + */ + @JsonProperty("instanceName") + public void setInstanceName(String instanceName) { + this.instanceName = instanceName; + } + + /** + * reference to an order + * + * @return + * The orderNumber + */ + @JsonProperty("orderNumber") + public String getOrderNumber() { + return orderNumber; + } + + /** + * reference to an order + * + * @param orderNumber + * The orderNumber + */ + @JsonProperty("orderNumber") + public void setOrderNumber(String orderNumber) { + this.orderNumber = orderNumber; + } + + /** + * order version number + * + * @return + * The orderVersion + */ + @JsonProperty("orderVersion") + public Double getOrderVersion() { + return orderVersion; + } + + /** + * order version number + * + * @param orderVersion + * The orderVersion + */ + @JsonProperty("orderVersion") + public void setOrderVersion(Double orderVersion) { + this.orderVersion = orderVersion; + } + + /** + * UUID for the product family associated with the model being operated on + * + * @return + * The productFamilyId + */ + @JsonProperty("productFamilyId") + public String getProductFamilyId() { + return productFamilyId; + } + + /** + * UUID for the product family associated with the model being operated on + * + * @param productFamilyId + * The productFamilyId + */ + @JsonProperty("productFamilyId") + public void setProductFamilyId(String productFamilyId) { + this.productFamilyId = productFamilyId; + } + + /** + * source of the request--not authoritative--actual source revealed via authentication + * + * @return + * The source + */ + @JsonProperty("source") + public String getSource() { + return source; + } + + /** + * source of the request--not authoritative--actual source revealed via authentication + * + * @param source + * The source + */ + @JsonProperty("source") + public void setSource(String source) { + this.source = source; + } + + /** + * true or false boolean indicating whether rollbacks should be suppressed on failures + * + * @return + * The suppressRollback + */ + @JsonProperty("suppressRollback") + public Boolean getSuppressRollback() { + return suppressRollback; + } + + /** + * true or false boolean indicating whether rollbacks should be suppressed on failures + * + * @param suppressRollback + * The suppressRollback + */ + @JsonProperty("suppressRollback") + public void setSuppressRollback(Boolean suppressRollback) { + this.suppressRollback = suppressRollback; + } + + /** + * Is the user selected value based on the validResponses list provided to complete the manual task + * + * @return + * The responseValue + */ + @JsonProperty("responseValue") + public String getResponseValue() { + return responseValue; + } + + /** + * Is the user selected value based on the validResponses list provided to complete the manual task + * + * @param responseValue + * The responseValue + */ + @JsonProperty("responseValue") + public void setResponseValue(String responseValue) { + this.responseValue = responseValue; + } + + /** + * The id of the person who initiated the completion request + * + * @return + * The requestorId + */ + @JsonProperty("requestorId") + public String getRequestorId() { + return requestorId; + } + + /** + * The id of the person who initiated the completion request + * + * @param requestorId + * The requestorId + */ + @JsonProperty("requestorId") + public void setRequestorId(String requestorId) { + this.requestorId = requestorId; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(billingAccountNumber).append(callbackUrl).append(correlator).append(instanceName).append(orderNumber).append(orderVersion).append(productFamilyId).append(source).append(suppressRollback).append(responseValue).append(requestorId).append(additionalProperties).toHashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof RequestInfo)) { + return false; + } + RequestInfo rhs = ((RequestInfo) other); + return new EqualsBuilder().append(billingAccountNumber, rhs.billingAccountNumber).append(callbackUrl, rhs.callbackUrl).append(correlator, rhs.correlator).append(instanceName, rhs.instanceName).append(orderNumber, rhs.orderNumber).append(orderVersion, rhs.orderVersion).append(productFamilyId, rhs.productFamilyId).append(source, rhs.source).append(suppressRollback, rhs.suppressRollback).append(responseValue, rhs.responseValue).append(requestorId, rhs.requestorId).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestParameters.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestParameters.java new file mode 100644 index 000000000..65e351258 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestParameters.java @@ -0,0 +1,123 @@ + +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.*; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "subscriptionServiceType", + "testApi", + "userParams" +}) +public class RequestParameters { + + @JsonProperty("subscriptionServiceType") + private String subscriptionServiceType; + @JsonProperty("testApi") + private String testApi; + @JsonProperty("userParams") + private List userParams = new ArrayList<>(); + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + /** + * + * @return + * The subscriptionServiceType + */ + @JsonProperty("subscriptionServiceType") + public String getSubscriptionServiceType() { + return subscriptionServiceType; + } + + /** + * + * @param subscriptionServiceType + * The subscriptionServiceType + */ + @JsonProperty("subscriptionServiceType") + public void setSubscriptionServiceType(String subscriptionServiceType) { + this.subscriptionServiceType = subscriptionServiceType; + } + + /** + * + * @return + * The testApi + */ + @JsonProperty("testApi") + public String getTestApi() { + return testApi; + } + + /** + * + * @param testApi + * The testApi + */ + @JsonProperty("testApi") + public void setTestApi(String testApi) { + this.testApi = testApi; + } + + /** + * + * @return + * The userParams + */ + @JsonProperty("userParams") + public List getUserParams() { + return userParams; + } + + /** + * + * @param userParams + * The userParams + */ + @JsonProperty("userParams") + public void setUserParams(List userParams) { + this.userParams = userParams; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(subscriptionServiceType).append(testApi).append(userParams).append(additionalProperties).toHashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof RequestParameters)) { + return false; + } + RequestParameters rhs = ((RequestParameters) other); + return new EqualsBuilder().append(subscriptionServiceType, rhs.subscriptionServiceType).append(testApi, rhs.testApi).append(userParams, rhs.userParams).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestReferences.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestReferences.java new file mode 100644 index 000000000..9c044e113 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/RequestReferences.java @@ -0,0 +1,121 @@ + +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.*; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.util.HashMap; +import java.util.Map; + + +/** + * provides the instanceId and requestId associated with the request + * + */ +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "instanceId", + "requestId" +}) +public class RequestReferences { + + /** + * UUID for the service instance + * (Required) + * + */ + @JsonProperty("instanceId") + private String instanceId; + /** + * UUID for the request + * (Required) + * + */ + @JsonProperty("requestId") + private String requestId; + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + /** + * UUID for the service instance + * (Required) + * + * @return + * The instanceId + */ + @JsonProperty("instanceId") + public String getInstanceId() { + return instanceId; + } + + /** + * UUID for the service instance + * (Required) + * + * @param instanceId + * The instanceId + */ + @JsonProperty("instanceId") + public void setInstanceId(String instanceId) { + this.instanceId = instanceId; + } + + /** + * UUID for the request + * (Required) + * + * @return + * The requestId + */ + @JsonProperty("requestId") + public String getRequestId() { + return requestId; + } + + /** + * UUID for the request + * (Required) + * + * @param requestId + * The requestId + */ + @JsonProperty("requestId") + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(instanceId).append(requestId).append(additionalProperties).toHashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof RequestReferences)) { + return false; + } + RequestReferences rhs = ((RequestReferences) other); + return new EqualsBuilder().append(instanceId, rhs.instanceId).append(requestId, rhs.requestId).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceDeletionRequestDetails.kt b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceDeletionRequestDetails.kt new file mode 100644 index 000000000..c41db0861 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceDeletionRequestDetails.kt @@ -0,0 +1,15 @@ +package org.onap.vid.mso.model + +import com.fasterxml.jackson.annotation.JsonInclude +import com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL +import com.fasterxml.jackson.annotation.JsonProperty + +class ServiceDeletionRequestDetails(val modelInfo: ModelInfo, + val requestInfo: RequestInfo, + val requestParameters: RequestParameters) { + + class RequestInfo(val source: String, val requestorId: String) + + class RequestParameters(@JsonInclude(NON_NULL) @get:JsonProperty("aLaCarte") val aLaCarte: Boolean?, + @JsonInclude(NON_NULL) val testApi: String?) +} \ No newline at end of file diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java index 1a54b74cb..c6d89e31f 100644 --- a/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/ServiceInstantiationRequestDetails.java @@ -2,12 +2,7 @@ package org.onap.vid.mso.model; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import org.onap.vid.domain.mso.CloudConfiguration; -import org.onap.vid.domain.mso.ModelInfo; -import org.onap.vid.domain.mso.SubscriberInfo; -import org.onap.vid.model.serviceInstantiation.VfModule; +import org.onap.vid.mso.rest.SubscriberInfo; import java.util.List; import java.util.Map; @@ -62,7 +57,7 @@ public class ServiceInstantiationRequestDetails { public static class RequestInfo { @JsonInclude(NON_NULL) public final String instanceName; - public final String productFamilyId; + @JsonInclude(NON_NULL) public final String productFamilyId; public final String source; public final boolean suppressRollback; public final String requestorId; @@ -86,33 +81,68 @@ public class ServiceInstantiationRequestDetails { } public static class RequestParameters { - + @JsonInclude(NON_NULL) public final String testApi; public final String subscriptionServiceType; public final boolean aLaCarte; - public final List userParams; + public final List userParams; - public RequestParameters(String subscriptionServiceType, boolean aLaCarte, List userParams) { + public RequestParameters(String subscriptionServiceType, boolean aLaCarte, List userParams) { + this(subscriptionServiceType, aLaCarte, userParams, null); + } + + public RequestParameters(String subscriptionServiceType, boolean aLaCarte, List userParams, String testApi) { this.subscriptionServiceType = subscriptionServiceType; this.aLaCarte = aLaCarte; this.userParams = userParams; + this.testApi = testApi; } } - @JsonTypeName("service") - @JsonTypeInfo(include = JsonTypeInfo.As.WRAPPER_OBJECT, use = JsonTypeInfo.Id.NAME) - public static class ServiceInstantiationService{ - public ModelInfo modelInfo = new ModelInfo(); - @JsonInclude(NON_NULL) public String instanceName; - public List> instanceParams; - public ServiceInstantiationVnfList resources; - - public ServiceInstantiationService (ModelInfo modelInfo, String instanceName, List> instanceParams, ServiceInstantiationVnfList vnfs){ - this.modelInfo.setModelType(modelInfo.getModelType()); - this.modelInfo.setModelName(modelInfo.getModelName()); - this.modelInfo.setModelVersionId(modelInfo.getModelVersionId()); - this.instanceName = instanceName; - this.instanceParams = instanceParams; - this.resources = vnfs; + public static class UserParamNameAndValue implements UserParamTypes { + private final String name; + private final String value; + + public UserParamNameAndValue(String name, String value) { + this.name = name; + this.value = value; + } + + public String getName() { + return name; + } + + public String getValue() { + return value; + } + } + + public static class ServiceInstantiationService implements UserParamTypes { + private final ServiceInstantiationServiceInner serviceInstantiationServiceInner; + + public ServiceInstantiationService(ModelInfo modelInfo, String instanceName, List> instanceParams, ServiceInstantiationVnfList vnfs) { + serviceInstantiationServiceInner = new ServiceInstantiationServiceInner(modelInfo, instanceName, instanceParams, vnfs); + } + + @JsonProperty("service") + public ServiceInstantiationServiceInner getServiceInstantiationServiceInner() { + return serviceInstantiationServiceInner; + } + + private static class ServiceInstantiationServiceInner implements UserParamTypes { + public ModelInfo modelInfo = new ModelInfo(); + @JsonInclude(NON_NULL) + public String instanceName; + public List> instanceParams; + public ServiceInstantiationVnfList resources; + + public ServiceInstantiationServiceInner(ModelInfo modelInfo, String instanceName, List> instanceParams, ServiceInstantiationVnfList vnfs) { + this.modelInfo.setModelType(modelInfo.getModelType()); + this.modelInfo.setModelName(modelInfo.getModelName()); + this.modelInfo.setModelVersionId(modelInfo.getModelVersionId()); + this.instanceName = instanceName; + this.instanceParams = instanceParams; + this.resources = vnfs; + } } } @@ -131,10 +161,10 @@ public class ServiceInstantiationRequestDetails { public final LineOfBusiness lineOfBusiness; public final String productFamilyId; public final List> instanceParams; - @JsonInclude(NON_EMPTY) public final List vfModules; + @JsonInclude(NON_EMPTY) public final List vfModules; @JsonInclude(NON_NULL) public final String instanceName; - public ServiceInstantiationVnf(ModelInfo modelInfo, CloudConfiguration cloudConfiguration, String platform, String lineOfBusiness, String productFamilyId, List> instanceParams, List vfModules, String instanceName) { + public ServiceInstantiationVnf(ModelInfo modelInfo, CloudConfiguration cloudConfiguration, String platform, String lineOfBusiness, String productFamilyId, List> instanceParams, List vfModules, String instanceName) { this.modelInfo = modelInfo; this.cloudConfiguration = cloudConfiguration; this.platform = new Platform(platform); diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParam.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParam.java new file mode 100644 index 000000000..b6c9131ed --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParam.java @@ -0,0 +1,98 @@ + +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.*; +import org.apache.commons.lang.builder.EqualsBuilder; +import org.apache.commons.lang.builder.HashCodeBuilder; +import org.apache.commons.lang.builder.ToStringBuilder; + +import java.util.HashMap; +import java.util.Map; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ + "name", + "value" +}) +public class UserParam { + + @JsonProperty("name") + private String name; + @JsonProperty("value") + private String value; + @JsonIgnore + private Map additionalProperties = new HashMap<>(); + + /** + * + * @return + * The name + */ + @JsonProperty("name") + public String getName() { + return name; + } + + /** + * + * @param name + * The name + */ + @JsonProperty("name") + public void setName(String name) { + this.name = name; + } + + /** + * + * @return + * The value + */ + @JsonProperty("value") + public String getValue() { + return value; + } + + /** + * + * @param value + * The value + */ + @JsonProperty("value") + public void setValue(String value) { + this.value = value; + } + + @Override + public String toString() { + return ToStringBuilder.reflectionToString(this); + } + + @JsonAnyGetter + public Map getAdditionalProperties() { + return this.additionalProperties; + } + + @JsonAnySetter + public void setAdditionalProperty(String name, Object value) { + this.additionalProperties.put(name, value); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(name).append(value).append(additionalProperties).toHashCode(); + } + + @Override + public boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof UserParam)) { + return false; + } + UserParam rhs = ((UserParam) other); + return new EqualsBuilder().append(name, rhs.name).append(value, rhs.value).append(additionalProperties, rhs.additionalProperties).isEquals(); + } + +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParamTypes.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParamTypes.java new file mode 100644 index 000000000..8e5a88d28 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/UserParamTypes.java @@ -0,0 +1,4 @@ +package org.onap.vid.mso.model; + +public interface UserParamTypes { +} diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java new file mode 100644 index 000000000..9a3a0c853 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleInstantiationRequestDetails.java @@ -0,0 +1,111 @@ +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/* Based on this model: + +{ + "requestDetails": { + "modelInfo": { + “modelType”: “vfModule”, + “modelInvariantId”: “ff5256d2-5a33-55df-13ab-12abad84e7ff”, + “modelVersionId”: “fe6478e5-ea33-3346-ac12-ab121484a3fe”, + “modelCustomizationId”: “856f9806-b01a-11e6-80f5-76304dec7eb7”, + “modelName”: “vSAMP12..base..module-0”, + "modelVersion": "1" + }, + “cloudConfiguration”: { + “lcpCloudRegionId”: “mdt1”, + “tenantId”: “88a6ca3ee0394ade9403f075db23167e” + }, + "requestInfo": { + “instanceName”: “MSOTEST103a-vSAMP12_base_module-0”, + “source”: “VID”, + “suppressRollback”: true, + “requestorId”: “az2016” + }, + "relatedInstanceList": [ + { + // This related instance captures the volumeGroup to attach + “relatedInstance”: { + “instanceId”: “17ef4658-bd1f-4ef0-9ca0-ea76e2bf122c”, + “instanceName”: “MSOTESTVOL103a-vSAMP12_base_module-0_vol”, + “modelInfo”: { + “modelType”: “volumeGroup” + } + } + }, + { + “relatedInstance”: { + “instanceId”: “{serviceInstanceId}”, + “modelInfo”: { + “modelType”: “service”, + “modelInvariantId”: “ff3514e3-5a33-55df-13ab-12abad84e7ff”, + “modelVersionId”: “fe6985cd-ea33-3346-ac12-ab121484a3fe”, + “modelName”: “{parent service model name}”, + "modelVersion": "1.0" + } + } + }, + { + “relatedInstance”: { + “instanceId”: “{vnfInstanceId}”, + "modelInfo": { + “modelType”: “vnf”, + “modelInvariantId”: “ff5256d1-5a33-55df-13ab-12abad84e7ff”, + “modelVersionId”: “fe6478e4-ea33-3346-ac12-ab121484a3fe”, + “modelName”: “vSAMP12”, + "modelVersion": "1.0", + “modelCustomizationName”: “vSAMP12 1”, + “modelCustomizationId”: “a7f1d08e-b02d-11e6-80f5-76304dec7eb7” + } + } + } + ], + “requestParameters”: { + “usePreload”: true, + “userParams”: [] + } + } +} + + + */ + +public class VfModuleInstantiationRequestDetails extends BaseResourceInstantiationRequestDetails { + + public VfModuleInstantiationRequestDetails( + @JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, + @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration, + @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo, + @JsonProperty(value = "relatedInstanceList", required = true) List relatedInstanceList, + @JsonProperty(value = "requestParameters", required = true) RequestParametersVfModule requestParameters) + { + super(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters); + } + + public static class RequestParametersVfModule extends BaseResourceInstantiationRequestDetails.RequestParameters { + private final boolean usePreload; + + public RequestParametersVfModule(List userParams, boolean usePreload) { + super(userParams); + this.usePreload = usePreload; + } + + public boolean isUsePreload() { + return usePreload; + } + } + + public static class UserParamMap extends HashMap implements UserParamTypes, Map { + + public UserParamMap() { + super(); + } + } +} + diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleMacro.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleMacro.java new file mode 100644 index 000000000..1bb8a37c6 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VfModuleMacro.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * VID + * ================================================================================ + * 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.vid.mso.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Collections; +import java.util.List; +import java.util.Map; + +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + +public class VfModuleMacro { + + private final ModelInfo modelInfo; + + @JsonInclude(NON_NULL) + private final String instanceName; + + private final List> instanceParams; + + @JsonInclude(NON_NULL) + private final String volumeGroupInstanceName; + + public VfModuleMacro(@JsonProperty("modelInfo") ModelInfo modelInfo, + @JsonProperty("instanceName") String instanceName, + @JsonProperty("volumeGroupName") String volumeGroupInstanceName, + @JsonProperty("instanceParams") List> instanceParams) { + this.modelInfo = modelInfo; + this.modelInfo.setModelType("vfModule"); + this.instanceName = instanceName; + this.instanceParams = instanceParams; + this.volumeGroupInstanceName = volumeGroupInstanceName; + } + + public ModelInfo getModelInfo() { + return modelInfo; + } + + public String getInstanceName() { + return instanceName; + } + + public String getVolumeGroupInstanceName() { + return volumeGroupInstanceName; + } + + public List> getInstanceParams() { + return instanceParams == null ? Collections.emptyList() : instanceParams; + } +} + + diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VnfInstantiationRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VnfInstantiationRequestDetails.java new file mode 100644 index 000000000..4a60c1a51 --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VnfInstantiationRequestDetails.java @@ -0,0 +1,87 @@ +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +/* Based on this model: + + +// { +// "requestDetails": { +// "modelInfo": { +// “modelType”: “vnf”, +// “modelInvariantId”: “ff5256d1-5a33-55df-13ab-12abad84e7ff”, +// “modelVersionId”: “fe042c22-ba82-43c6-b2f6-8f1fc4164091”, +// “modelName”: “vSAMP12”, +// "modelVersion": "1.0", +// “modelCustomizationName”: “vSAMP12 1”, +// “modelCustomizationId”: “a7f1d08e-b02d-11e6-80f5-76304dec7eb7” +// }, +// “cloudConfiguration”: { +// “lcpCloudRegionId”: “mdt1”, +// “tenantId”: “88a6ca3ee0394ade9403f075db23167e” +// }, +// "requestInfo": { +// “instanceName”: “MSOTEST103a”, +// “productFamilyId”: “a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb”, +// “source”: “VID”, +// “suppressRollback”: false, +// “requestorId”: “az2016” +// }, +// "platform": { +// "platformName": "{some platformName}" +// }, +// "lineOfBusiness": { +// "lineOfBusinessName": "{some string}" +// }, +// "relatedInstanceList": [ +// { +// “relatedInstance”: { +// “instanceId”: “{serviceInstanceId}”, +// “modelInfo”: { +// “modelType”: “service”, +// “modelInvariantId”: “ff3514e3-5a33-55df-13ab-12abad84e7ff”, +// “modelVersionId”: “fe6985cd-ea33-3346-ac12-ab121484a3fe”, +// “modelName”: “{parent service model name}”, +// "modelVersion": "1.0" +// } +// } +// }, +// { +// “relatedInstance”: { +// “instanceId”: “{instanceGroupId}”, +// “modelInfo”: { +// “modelType”: “networkCollection”, +// “modelInvariantId”: “9ea660dc-155f-44d3-b45c-cc7648b4f31c”, +// “modelVersionId”: “bb07aad1-ce2d-40c1-85cb-5392f76bb1ef”, +// “modelName”: “{network collection model name}”, +// "modelVersion": "1.0" +// } +// } +// } + +// ], +// “requestParameters”: { +// “userParams”: [] +// } +// } +// } + + */ + +public class VnfInstantiationRequestDetails extends BaseResourceInstantiationRequestDetails { + + public VnfInstantiationRequestDetails( + @JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, + @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration, + @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo, + @JsonProperty(value = "platform", required = true) Platform platform, + @JsonProperty(value = "lineOfBusiness", required = true) LineOfBusiness lineOfBusiness, + @JsonProperty(value = "relatedInstanceList", required = true) List relatedInstanceList, + @JsonProperty(value = "requestParameters", required = true) RequestParameters requestParameters) + { + super(modelInfo, cloudConfiguration, requestInfo, platform, lineOfBusiness, relatedInstanceList, requestParameters); + } +} + diff --git a/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java b/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java new file mode 100644 index 000000000..d60c9975b --- /dev/null +++ b/vid-app-common/src/main/java/org/onap/vid/mso/model/VolumeGroupRequestDetails.java @@ -0,0 +1,18 @@ +package org.onap.vid.mso.model; + +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.List; + +public class VolumeGroupRequestDetails extends BaseResourceInstantiationRequestDetails { + + public VolumeGroupRequestDetails( + @JsonProperty(value = "modelInfo", required = true) ModelInfo modelInfo, + @JsonProperty(value = "cloudConfiguration", required = true) CloudConfiguration cloudConfiguration, + @JsonProperty(value = "requestInfo", required = true) RequestInfo requestInfo, + @JsonProperty(value = "relatedInstanceList", required = true) List relatedInstanceList, + @JsonProperty(value = "requestParameters", required = true) VfModuleInstantiationRequestDetails.RequestParametersVfModule requestParameters) + { + super(modelInfo, cloudConfiguration, requestInfo, relatedInstanceList, requestParameters); + } +} -- cgit 1.2.3-korg