diff options
Diffstat (limited to 'mso-catalog-db')
27 files changed, 1516 insertions, 154 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java index b5da55c7d6..8f3f7a34b0 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ActivitySpecCategories.java @@ -1,8 +1,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; @@ -10,20 +8,12 @@ import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.JoinColumn; -import javax.persistence.Lob; -import javax.persistence.ManyToOne; import javax.persistence.OneToMany; -import javax.persistence.PrePersist; import javax.persistence.Table; -import javax.persistence.Temporal; -import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; import com.openpojo.business.annotation.BusinessKey; -import org.hibernate.annotations.NotFound; -import org.hibernate.annotations.NotFoundAction; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java index 54e2144c81..f94b8155f8 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/BuildingBlockDetail.java @@ -21,22 +21,17 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; -import java.util.List; -import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; import javax.persistence.Enumerated; -import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.OneToMany; import javax.persistence.Table; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; -import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; import com.openpojo.business.annotation.BusinessKey; @Entity diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java index 1117648a7f..3be9e1f1e3 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResourceCustomization.java @@ -22,7 +22,6 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; import java.util.Date; -import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,8 +31,6 @@ import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; -import javax.persistence.MapsId; -import javax.persistence.OneToMany; import javax.persistence.OneToOne; import javax.persistence.PrePersist; import javax.persistence.Table; @@ -67,20 +64,21 @@ public class ConfigurationResourceCustomization implements Serializable { private String modelInstanceName; @Column(name = "CONFIGURATION_FUNCTION") - private String nfFunction; + private String function; @Column(name = "CONFIGURATION_TYPE") - private String nfType; + private String type; @Column(name = "CONFIGURATION_ROLE") - private String nfRole; + private String role; @Column(name = "CREATION_TIMESTAMP", updatable = false) @Temporal(TemporalType.TIMESTAMP) private Date created; - @Column(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID") - private String serviceProxyResourceCustomizationUUID; + @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @JoinColumn(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID") + private ServiceProxyResourceCustomization serviceProxyResourceCustomization; @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID") @@ -123,40 +121,42 @@ public class ConfigurationResourceCustomization implements Serializable { this.modelInstanceName = modelInstanceName; } - public String getNfFunction() { - return nfFunction; + public String getFunction() { + return function; } - public void setNfFunction(String nfFunction) { - this.nfFunction = nfFunction; + public void setFunction(String function) { + this.function = function; } - public String getNfType() { - return nfType; + public String getType() { + return type; } - public void setNfType(String nfType) { - this.nfType = nfType; + public void setType(String type) { + this.type = type; } - public String getNfRole() { - return nfRole; + public String getRole() { + return role; } - public void setNfRole(String nfRole) { - this.nfRole = nfRole; + public void setRole(String role) { + this.role = role; } public Date getCreated() { return created; } - public String getServiceProxyResourceCustomizationUUID() { - return serviceProxyResourceCustomizationUUID; + @LinkedResource + public ServiceProxyResourceCustomization getServiceProxyResourceCustomization() { + return serviceProxyResourceCustomization; } - public void setServiceProxyResourceCustomizationUUID(String serviceProxyResourceCustomizationUUID) { - this.serviceProxyResourceCustomizationUUID = serviceProxyResourceCustomizationUUID; + public void setServiceProxyResourceCustomization( + ServiceProxyResourceCustomization serviceProxyResourceCustomization) { + this.serviceProxyResourceCustomization = serviceProxyResourceCustomization; } @@ -189,8 +189,8 @@ public class ConfigurationResourceCustomization implements Serializable { @Override public String toString() { return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID) - .append("modelInstanceName", modelInstanceName).append("nfFunction", nfFunction) - .append("nfType", nfType).append("nfRole", nfRole).append("created", created) + .append("modelInstanceName", modelInstanceName).append("function", function).append("type", type) + .append("role", role).append("created", created) // .append("serviceProxyResourceCustomization", serviceProxyResourceCustomization) .append("configResourceCustomization", configResourceCustomization) .append("configurationResource", configurationResource).append("service", service).toString(); diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java index 9287fbcf84..21b1550cb5 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/NetworkResourceCustomization.java @@ -44,33 +44,6 @@ import uk.co.blackpepper.bowman.annotation.LinkedResource; public class NetworkResourceCustomization implements Serializable { public static final long serialVersionUID = -1322322139926390329L; - @Override - public String toString() { - return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) - .append("modelInstanceName", modelInstanceName).append("created", created) - .append("networkTechnology", networkTechnology).append("networkType", networkType) - .append("networkScope", networkScope).append("networkRole", networkRole) - .append("networkResource", networkResource).toString(); - } - - @Override - public boolean equals(final Object other) { - if (!(other instanceof NetworkResourceCustomization)) { - return false; - } - NetworkResourceCustomization castOther = (NetworkResourceCustomization) other; - return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); - } - - @Override - public int hashCode() { - return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); - } - - public NetworkResourceCustomization() { - super(); - } - @BusinessKey @Id @Column(name = "MODEL_CUSTOMIZATION_UUID") @@ -102,6 +75,10 @@ public class NetworkResourceCustomization implements Serializable { @JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID") private NetworkResource networkResource = null; + public NetworkResourceCustomization() { + super(); + } + @PrePersist protected void onCreate() { this.created = new Date(); @@ -175,4 +152,27 @@ public class NetworkResourceCustomization implements Serializable { public void setResourceInput(String resourceInput) { this.resourceInput = resourceInput; } + + @Override + public String toString() { + return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID) + .append("modelInstanceName", modelInstanceName).append("created", created) + .append("networkTechnology", networkTechnology).append("networkType", networkType) + .append("networkScope", networkScope).append("networkRole", networkRole) + .append("networkResource", networkResource).toString(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof NetworkResourceCustomization)) { + return false; + } + NetworkResourceCustomization castOther = (NetworkResourceCustomization) other; + return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode(); + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java index cf8644eedc..b340fdea2b 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java @@ -22,9 +22,17 @@ package org.onap.so.db.catalog.beans; // TODO find this file a new location? public enum OrchestrationAction { - ASSIGN("Assign"), UNASSIGN("Unassign"), ACTIVATE("Activate"), DEACTIVATE("Deactivate"), CHANGE_MODEL( - "ChangeModel"), CREATE("Create"), DELETE("Delete"), UPDATE( - "Update"), ADD_MEMBERS("AddMembers"), REMOVE_MEMBERS("RemoveMembers"), CUSTOM("Custom"); + ASSIGN("Assign"), + UNASSIGN("Unassign"), + ACTIVATE("Activate"), + DEACTIVATE("Deactivate"), + CHANGE_MODEL("ChangeModel"), + CREATE("Create"), + DELETE("Delete"), + UPDATE("Update"), + ADD_MEMBERS("AddMembers"), + REMOVE_MEMBERS("RemoveMembers"), + CUSTOM("Custom"); private final String name; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java index e608bfed21..93e2992d3f 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java @@ -7,9 +7,9 @@ * 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. @@ -21,12 +21,18 @@ package org.onap.so.db.catalog.beans; public enum OrchestrationStatus { - ACTIVE("Active", "active"), ASSIGNED("Assigned", "assigned"), CREATED("Created", "created"), INVENTORIED( - "Inventoried", "inventoried"), PENDING("Pending", "pending"), PENDING_ACTIVATION("PendingActivation", - "pending.?activation"), PENDING_CREATE("PendingCreate", "pending.?create"), PENDING_DELETE( - "PendingDelete", "pending.?delete"), PRECREATED("PreCreated", - "pre.?created"), CONFIGASSIGNED("ConfigAssigned", "config.?assigned"), CONFIGURE( - "Configure", "configure"), CONFIGURED("Configured", "configured"); + ACTIVE("Active", "active"), + ASSIGNED("Assigned", "assigned"), + CREATED("Created", "created"), + INVENTORIED("Inventoried", "inventoried"), + PENDING("Pending", "pending"), + PENDING_ACTIVATION("PendingActivation", "pending.?activation"), + PENDING_CREATE("PendingCreate", "pending.?create"), + PENDING_DELETE("PendingDelete", "pending.?delete"), + PRECREATED("PreCreated", "pre.?created"), + CONFIGASSIGNED("ConfigAssigned", "config.?assigned"), + CONFIGURE("Configure", "configure"), + CONFIGURED("Configured", "configured"); private final String name; private final String fuzzyMatcher; @@ -43,7 +49,7 @@ public enum OrchestrationStatus { /** * case insensitive regular expression match to enum value - * + * * @param status * @return */ diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java index b41548ca99..4fd28c910e 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java @@ -21,9 +21,15 @@ package org.onap.so.db.catalog.beans; public enum ResourceType { - SERVICE("Service"), VNF("Vnf"), VOLUME_GROUP("VolumeGroup"), VF_MODULE("VfModule"), NETWORK( - "Network"), NETWORK_COLLECTION("NetworkCollection"), CONFIGURATION( - "Configuration"), INSTANCE_GROUP("InstanceGroup"), NO_VALIDATE("NoValidate"); + SERVICE("Service"), + VNF("Vnf"), + VOLUME_GROUP("VolumeGroup"), + VF_MODULE("VfModule"), + NETWORK("Network"), + NETWORK_COLLECTION("NetworkCollection"), + CONFIGURATION("Configuration"), + INSTANCE_GROUP("InstanceGroup"), + NO_VALIDATE("NoValidate"); private final String name; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java index ffcc8e9717..e591552ebf 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java @@ -25,11 +25,9 @@ import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; -import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; -import javax.persistence.FetchType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; @@ -93,6 +91,9 @@ public class Service implements Serializable { @Column(name = "RESOURCE_ORDER") private String resourceOrder; + @Column(name = "OVERALL_DISTRIBUTION_STATUS") + private String distrobutionStatus; + @OneToMany(cascade = CascadeType.ALL) @JoinTable(name = "network_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), @@ -135,6 +136,12 @@ public class Service implements Serializable { @JoinColumn(name = "TOSCA_CSAR_ARTIFACT_UUID") private ToscaCsar csar; + @Column(name = "NAMING_POLICY") + private String namingPolicy; + + @Column(name = "ONAP_GENERATED_NAMING") + private Boolean onapGeneratedNaming; + @Override public String toString() { return new ToStringBuilder(this).append("modelName", modelName).append("description", description) @@ -148,7 +155,7 @@ public class Service implements Serializable { .append("serviceProxyCustomizations", serviceProxyCustomizations) .append("configurationCustomizations", configurationCustomizations) .append("pnfCustomizations", pnfCustomizations).append("recipes", recipes).append("csar", csar) - .toString(); + .append("namingPolicy", namingPolicy).append("onapGeneratedNaming", onapGeneratedNaming).toString(); } @PrePersist @@ -367,4 +374,29 @@ public class Service implements Serializable { public void setResourceOrder(String resourceOrder) { this.resourceOrder = resourceOrder; } + + public String getDistrobutionStatus() { + return distrobutionStatus; + } + + public void setDistrobutionStatus(String distrobutionStatus) { + this.distrobutionStatus = distrobutionStatus; + } + + public String getNamingPolicy() { + return namingPolicy; + } + + public void setNamingPolicy(String namingPolicy) { + this.namingPolicy = namingPolicy; + } + + public Boolean getOnapGeneratedNaming() { + return onapGeneratedNaming; + } + + public void setOnapGeneratedNaming(Boolean onapGeneratedNaming) { + this.onapGeneratedNaming = onapGeneratedNaming; + } + } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java index 5d9deb6c89..fb54449d5f 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResource.java @@ -38,9 +38,9 @@ import javax.persistence.TemporalType; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.ToStringBuilder; -import com.openpojo.business.annotation.BusinessKey; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; +import com.openpojo.business.annotation.BusinessKey; import uk.co.blackpepper.bowman.annotation.LinkedResource; @Entity @@ -93,9 +93,6 @@ public class VnfResource implements Serializable { @JoinColumn(name = "HEAT_TEMPLATE_ARTIFACT_UUID") private HeatTemplate heatTemplates; - @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResources") - private List<VnfResourceCustomization> vnfResourceCustomizations; - @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResource") private List<VnfResourceWorkflow> vnfResourceWorkflow; @@ -111,8 +108,7 @@ public class VnfResource implements Serializable { .append("toscaNodeType", toscaNodeType).append("description", description) .append("orchestrationMode", orchestrationMode).append("aicVersionMin", aicVersionMin) .append("aicVersionMax", aicVersionMax).append("created", created) - .append("heatTemplates", heatTemplates).append("vnfResourceCustomizations", vnfResourceCustomizations) - .append("vnfResourceWorkflow", vnfResourceWorkflow).toString(); + .append("heatTemplates", heatTemplates).append("vnfResourceWorkflow", vnfResourceWorkflow).toString(); } @Override @@ -230,17 +226,6 @@ public class VnfResource implements Serializable { } @LinkedResource - public List<VnfResourceCustomization> getVnfResourceCustomizations() { - if (vnfResourceCustomizations == null) - vnfResourceCustomizations = new ArrayList<>(); - return vnfResourceCustomizations; - } - - public void setVnfResourceCustomizations(List<VnfResourceCustomization> vnfResourceCustomizations) { - this.vnfResourceCustomizations = vnfResourceCustomizations; - } - - @LinkedResource public HeatTemplate getHeatTemplates() { return heatTemplates; } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java index af99aa8c80..36c9251d59 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java @@ -121,6 +121,9 @@ public class VnfResourceCustomization implements Serializable { @Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION") private Boolean skipPostInstConf; + @Column(name = "VNFCINSTANCEGROUP_ORDER") + private String vnfcInstanceGroupOrder; + @Override public boolean equals(final Object other) { if (!(other instanceof VnfResourceCustomization)) { @@ -148,6 +151,7 @@ public class VnfResourceCustomization implements Serializable { .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode) .append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources) .append("vfModuleCustomizations", vfModuleCustomizations) + .append("vnfcInstanceGroupOrder", vnfcInstanceGroupOrder) .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString(); } @@ -324,4 +328,12 @@ public class VnfResourceCustomization implements Serializable { public void setSkipPostInstConf(Boolean skipPostInstConf) { this.skipPostInstConf = skipPostInstConf; } + + public String getVnfcInstanceGroupOrder() { + return vnfcInstanceGroupOrder; + } + + public void setVnfcInstanceGroupOrder(String vnfcInstanceGroupOrder) { + this.vnfcInstanceGroupOrder = vnfcInstanceGroupOrder; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java index f6ae503c61..413efaf12c 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 Huawei 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. @@ -20,23 +21,25 @@ package org.onap.so.db.catalog.beans; -import java.io.Serializable; -import java.util.Date; -import java.util.List; +import com.fasterxml.jackson.annotation.JsonFormat; +import com.openpojo.business.annotation.BusinessKey; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import org.apache.commons.lang3.builder.ToStringBuilder; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.PrePersist; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.openpojo.business.annotation.BusinessKey; -import org.apache.commons.lang3.builder.HashCodeBuilder; -import org.apache.commons.lang3.builder.EqualsBuilder; -import org.apache.commons.lang3.builder.ToStringBuilder; +import java.io.Serializable; +import java.util.Date; +import java.util.List; @Entity @Table(name = "vnfc_customization") @@ -70,6 +73,9 @@ public class VnfcCustomization implements Serializable { @Column(name = "DESCRIPTION") private String description; + @Column(name = "RESOURCE_INPUT") + private String resourceInput; + @Column(name = "CREATION_TIMESTAMP", updatable = false) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS") @Temporal(TemporalType.TIMESTAMP) @@ -78,6 +84,10 @@ public class VnfcCustomization implements Serializable { @OneToMany(cascade = CascadeType.ALL, mappedBy = "vnfcCustomization") private List<CvnfcCustomization> cvnfcCustomization; + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID") + private VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization; + @Override public boolean equals(final Object other) { if (!(other instanceof VnfcCustomization)) { @@ -186,4 +196,20 @@ public class VnfcCustomization implements Serializable { public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) { this.cvnfcCustomization = cvnfcCustomization; } + + public VnfcInstanceGroupCustomization getVnfcInstanceGroupCustomization() { + return vnfcInstanceGroupCustomization; + } + + public void setVnfcInstanceGroupCustomization(VnfcInstanceGroupCustomization vnfcInstanceGroupCustomization) { + this.vnfcInstanceGroupCustomization = vnfcInstanceGroupCustomization; + } + + public String getResourceInput() { + return resourceInput; + } + + public void setResourceInput(String resourceInput) { + this.resourceInput = resourceInput; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java index 695e5bbbb9..8a00ccd261 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcInstanceGroupCustomization.java @@ -3,6 +3,7 @@ * ONAP - SO * ================================================================================ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2019 Huawei 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. @@ -22,6 +23,7 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; import java.util.Date; +import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -32,6 +34,7 @@ import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; +import javax.persistence.OneToMany; import javax.persistence.PrePersist; import javax.persistence.Table; import javax.persistence.Temporal; @@ -66,6 +69,9 @@ public class VnfcInstanceGroupCustomization implements Serializable { @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID") private InstanceGroup instanceGroup; + @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy = "vnfcInstanceGroupCustomization") + private List<VnfcCustomization> vnfcCustomizations; + @Column(name = "FUNCTION") private String function; @@ -150,4 +156,12 @@ public class VnfcInstanceGroupCustomization implements Serializable { public void setInstanceGroup(InstanceGroup instanceGroup) { this.instanceGroup = instanceGroup; } + + public List<VnfcCustomization> getVnfcCustomizations() { + return vnfcCustomizations; + } + + public void setVnfcCustomizations(List<VnfcCustomization> vnfcCustomizations) { + this.vnfcCustomizations = vnfcCustomizations; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java index a12edac8a0..1882ad5964 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/macro/RainyDayHandlerStatus.java @@ -63,6 +63,10 @@ public class RainyDayHandlerStatus implements Serializable { private String errorCode; @BusinessKey + @Column(name = "REG_EX_ERROR_MESSAGE") + private String errorMessage; + + @BusinessKey @Column(name = "WORK_STEP") private String workStep; @@ -77,8 +81,8 @@ public class RainyDayHandlerStatus implements Serializable { public String toString() { return new ToStringBuilder(this).append("id", id).append("flowName", flowName) .append("serviceType", serviceType).append("vnfType", vnfType).append("errorCode", errorCode) - .append("workStep", workStep).append("policy", policy).append("secondaryPolicy", secondaryPolicy) - .toString(); + .append("errorMessage", errorMessage).append("workStep", workStep).append("policy", policy) + .append("secondaryPolicy", secondaryPolicy).toString(); } @Override @@ -161,4 +165,14 @@ public class RainyDayHandlerStatus implements Serializable { public void setSecondaryPolicy(String secondaryPolicy) { this.secondaryPolicy = secondaryPolicy; } + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java index ab5fdb939c..30801119b6 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java @@ -73,6 +73,7 @@ import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; import uk.co.blackpepper.bowman.Client; import uk.co.blackpepper.bowman.ClientFactory; import uk.co.blackpepper.bowman.Configuration; @@ -84,7 +85,6 @@ public class CatalogDbClient { private static final String CLOUD_SITE = "/cloudSite"; private static final String CLOUDIFY_MANAGER = "/cloudifyManager"; - private static final String CVNFC_CUSTOMZIATION = "/cvnfcCustomization"; private static final String RAINY_DAY_HANDLER_MACRO = "/rainy_day_handler_macro"; private static final String NORTHBOUND_REQUEST_REF_LOOKUP = "/northbound_request_ref_lookup"; private static final String NETWORK_RESOURCE_CUSTOMIZATION = "/networkResourceCustomization"; @@ -124,7 +124,6 @@ public class CatalogDbClient { private static final String MODEL_NAME = "modelName"; private static final String MODEL_VERSION = "modelVersion"; private static final String MODEL_INVARIANT_UUID = "modelInvariantUUID"; - private static final String MODEL_INSTANCE_NAME = "modelInstanceName"; private static final String VNF_RESOURCE_MODEL_UUID = "vnfResourceModelUUID"; private static final String NF_ROLE = "nfRole"; private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUID"; @@ -137,6 +136,7 @@ public class CatalogDbClient { private static final String IS_ALACARTE = "isALaCarte"; private static final String CLOUD_OWNER = "cloudOwner"; private static final String FLOW_NAME = "flowName"; + private static final String ERROR_MESSAGE = "errorMessage"; private static final String SERVICE_TYPE = "serviceType"; private static final String VNF_TYPE = "vnfType"; private static final String ERROR_CODE = "errorCode"; @@ -185,8 +185,8 @@ public class CatalogDbClient { "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner"; private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType"; - private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = - "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep"; + + private static final String findRainyDayHandler = "/findRainyDayHandler"; private String findByClliAndCloudVersion = "/findByClliAndCloudVersion"; private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId"; private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid"; @@ -198,10 +198,8 @@ public class CatalogDbClient { private String serviceURI; private String vfModuleURI; private String vnfResourceURI; - private String vfModuleCustomizationURI; private String networkCollectionResourceCustomizationURI; private String networkResourceCustomizationURI; - private String vnfResourceCustomizationURI; private String collectionNetworkResourceCustomizationURI; private String instanceGroupURI; private String cloudifyManagerURI; @@ -260,8 +258,6 @@ public class CatalogDbClient { private final Client<CloudifyManager> cloudifyManagerClient; - private final Client<CvnfcCustomization> cvnfcCustomizationClient; - private final Client<ControllerSelectionReference> controllerSelectionReferenceClient; private final Client<PnfResource> pnfResourceClient; @@ -326,8 +322,6 @@ public class CatalogDbClient { findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType; - findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH - + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep; findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion; findPnfResourceCustomizationByModelUuid = @@ -343,12 +337,9 @@ public class CatalogDbClient { serviceURI = endpoint + SERVICE + URI_SEPARATOR; vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR; vnfResourceURI = endpoint + VNF_RESOURCE + URI_SEPARATOR; - vfModuleCustomizationURI = endpoint + VFMODULE_CUSTOMIZATION + URI_SEPARATOR; networkCollectionResourceCustomizationURI = endpoint + NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION + URI_SEPARATOR; networkResourceCustomizationURI = endpoint + NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR; - cvnfcResourceCustomizationURI = endpoint + CVNFC_CUSTOMZIATION + URI_SEPARATOR; - vnfResourceCustomizationURI = endpoint + VNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR; collectionNetworkResourceCustomizationURI = endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR; instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR; @@ -403,7 +394,6 @@ public class CatalogDbClient { homingInstanceClient = clientFactory.create(HomingInstance.class); cloudifyManagerClient = clientFactory.create(CloudifyManager.class); serviceRecipeClient = clientFactory.create(ServiceRecipe.class); - cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class); controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class); externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class); pnfResourceClient = clientFactory.create(PnfResource.class); @@ -453,7 +443,6 @@ public class CatalogDbClient { homingInstanceClient = clientFactory.create(HomingInstance.class); cloudifyManagerClient = clientFactory.create(CloudifyManager.class); serviceRecipeClient = clientFactory.create(ServiceRecipe.class); - cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class); controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class); externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class); pnfResourceClient = clientFactory.create(PnfResource.class); @@ -648,13 +637,16 @@ public class CatalogDbClient { .queryParam(SERVICE_TYPE, serviceType).build().toString())); } - public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep( - String flowName, String serviceType, String vnfType, String errorCode, String workStep) { + public RainyDayHandlerStatus getRainyDayHandlerStatus(String flowName, String serviceType, String vnfType, + String errorCode, String workStep, String errorMessage) { + logger.debug( + "Get Rainy Day Status - Flow Name {}, Service Type: {} , vnfType {} , errorCode {}, workStep {}, errorMessage {}", + flowName, serviceType, vnfType, errorCode, workStep, errorMessage); return this.getSingleResource(rainyDayHandlerStatusClient, - getUri(UriBuilder.fromUri(findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep) + UriComponentsBuilder.fromUriString(endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findRainyDayHandler) .queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType) .queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep) - .build().toString())); + .queryParam(ERROR_MESSAGE, errorMessage).build().encode().toUri()); } public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action) { @@ -663,6 +655,8 @@ public class CatalogDbClient { .queryParam(SERVICE_MODEL_UUID, modelUUID).queryParam(ACTION, action).build().toString())); } + + public NetworkRecipe getFirstNetworkRecipeByModelNameAndAction(String modelName, String action) { return this.getSingleResource(networkRecipeClient, UriBuilder.fromUri(findFirstByModelNameAndAction) .queryParam(MODEL_NAME, modelName).queryParam(ACTION, action).build()); @@ -725,22 +719,20 @@ public class CatalogDbClient { } public VnfComponentsRecipe getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction( - String vfModuleModelUUID, String vnfComponentType, String action) { + String vfModuleModelUUID, String modelType, String action) { return this.getSingleResource(vnfComponentsRecipeClient, getUri(UriBuilder.fromUri(findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction) - .queryParam(VF_MODULE_MODEL_UUID, vfModuleModelUUID) - .queryParam(VNF_COMPONENT_TYPE, vnfComponentType).queryParam(ACTION, action).build() - .toString())); + .queryParam(VF_MODULE_MODEL_UUID, vfModuleModelUUID).queryParam(VNF_COMPONENT_TYPE, modelType) + .queryParam(ACTION, action).build().toString())); } - public VnfComponentsRecipe getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType, - String action) { + public VnfComponentsRecipe getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String modelType, String action) { return this.getSingleResource(vnfComponentsRecipeClient, getUri(UriBuilder.fromUri(findFirstVnfComponentsRecipeByVnfComponentTypeAndAction) - .queryParam(VNF_COMPONENT_TYPE, vnfComponentType).queryParam(ACTION, action).build() - .toString())); + .queryParam(VNF_COMPONENT_TYPE, modelType).queryParam(ACTION, action).build().toString())); } + protected URI getUri(String template) { return URI.create(template); } @@ -831,9 +823,14 @@ public class CatalogDbClient { public VnfResourceCustomization findVnfResourceCustomizationInList(String vnfCustomizationUUID, List<VnfResourceCustomization> vnfResourceCusts) { - List<VnfResourceCustomization> filtered = vnfResourceCusts.stream() - .filter(vnfCustRes -> vnfCustomizationUUID.equals(vnfCustRes.getModelCustomizationUUID())) - .collect(Collectors.toList()); + if (vnfCustomizationUUID == null) { + throw new EntityNotFoundException( + "a NULL UUID was provided in query to search for VnfResourceCustomization"); + } + List<VnfResourceCustomization> filtered = + vnfResourceCusts.stream().filter(v -> v.getModelCustomizationUUID() != null) + .filter(vnfCustRes -> vnfCustomizationUUID.equals(vnfCustRes.getModelCustomizationUUID())) + .collect(Collectors.toList()); if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) { return filtered.get(0); } else @@ -841,9 +838,12 @@ public class CatalogDbClient { "Unable to find VnfResourceCustomization ModelCustomizationUUID:" + vnfCustomizationUUID); } - private VfModuleCustomization findVfModuleCustomizationInList(String vfModuleCustomizationUUID, + protected VfModuleCustomization findVfModuleCustomizationInList(String vfModuleCustomizationUUID, List<VfModuleCustomization> vfModuleList) { - List<VfModuleCustomization> filtered = vfModuleList.stream() + if (vfModuleCustomizationUUID == null) { + throw new EntityNotFoundException("a NULL UUID was provided in query to search for VfModuleCustomization"); + } + List<VfModuleCustomization> filtered = vfModuleList.stream().filter(v -> v.getModelCustomizationUUID() != null) .filter(vfModuleCust -> vfModuleCustomizationUUID.equals(vfModuleCust.getModelCustomizationUUID())) .collect(Collectors.toList()); if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) { @@ -853,9 +853,13 @@ public class CatalogDbClient { "Unable to find VfModuleCustomization ModelCustomizationUUID:" + vfModuleCustomizationUUID); } - private CvnfcCustomization findCvnfcCustomizationInAList(String cvnfcCustomizationUuid, + protected CvnfcCustomization findCvnfcCustomizationInAList(String cvnfcCustomizationUuid, List<CvnfcCustomization> cvnfcCustomList) { - List<CvnfcCustomization> filtered = cvnfcCustomList.stream() + if (cvnfcCustomizationUuid == null) { + throw new EntityNotFoundException( + "a NULL UUID was provided in query to search for CvnfcCustomization" + cvnfcCustomizationUuid); + } + List<CvnfcCustomization> filtered = cvnfcCustomList.stream().filter(c -> c.getModelCustomizationUUID() != null) .filter(cvnfc -> cvnfcCustomizationUuid.equals(cvnfc.getModelCustomizationUUID())) .collect(Collectors.toList()); if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) { @@ -897,4 +901,12 @@ public class CatalogDbClient { return this.getMultipleResources(workflowClient, getUri(UriBuilder.fromUri(findWorkflowBySource).queryParam(SOURCE, source).build().toString())); } + + public String getEndpoint() { + return endpoint; + } + + public void setEndpoint(String endpoint) { + this.endpoint = endpoint; + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java index 2c61d91d6b..6819657b78 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java @@ -22,10 +22,20 @@ package org.onap.so.db.catalog.data.repository; import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "rainy_day_handler_macro", path = "rainy_day_handler_macro") public interface RainyDayHandlerStatusRepository extends JpaRepository<RainyDayHandlerStatus, Integer> { - RainyDayHandlerStatus findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(String flowName, - String serviceType, String vnfType, String errorCode, String workStep); + + @Query(value = "SELECT * FROM rainy_day_handler_macro WHERE (FLOW_NAME = :flowName ) AND SERVICE_TYPE IN (:serviceType ,'*') " + + " AND VNF_TYPE IN ( :vnfType , '*') AND ERROR_CODE IN (:errorCode ,'*') AND WORK_STEP IN (:workStep , '*' ) " + + " AND ( :errorMessage REGEXP rainy_day_handler_macro.REG_EX_ERROR_MESSAGE OR REG_EX_ERROR_MESSAGE = '*') " + + " ORDER BY CASE WHEN :errorMessage REGEXP REG_EX_ERROR_MESSAGE THEN 0 WHEN ERROR_CODE != '*' THEN 1 WHEN VNF_TYPE != '*' THEN 2 WHEN SERVICE_TYPE != '*' THEN 3 ELSE 4 END LIMIT 1;", + nativeQuery = true) + RainyDayHandlerStatus findRainyDayHandler(@Param("flowName") String flowName, + @Param("serviceType") String serviceType, @Param("vnfType") String vnfType, + @Param("errorCode") String errorCode, @Param("workStep") String workStep, + @Param("errorMessage") String errorMessage); } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java index c107192060..b456beaeff 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java @@ -30,6 +30,8 @@ import java.util.List; public interface ServiceRepository extends JpaRepository<Service, String> { List<Service> findByModelName(String modelName); + List<Service> findByModelNameAndDistrobutionStatus(String modelName, String distrobutionStatus); + Service findOneByModelName(String modelName); /** diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java index a7610fec92..98db12c288 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/utils/MavenLikeVersioning.java @@ -90,8 +90,8 @@ public class MavenLikeVersioning implements Serializable { public boolean isTheSameVersion(String versionToCompare) { if (versionToCompare == null && this.version == null) { return true; - } else if (versionToCompare == null || versionToCompare.trim().equals("") || this.version == null - || this.version.trim().equals("")) { + } else if (versionToCompare == null || "".equals(versionToCompare.trim()) || this.version == null + || "".equals(this.version.trim())) { return false; } String[] currentVersionArray = this.version.split("\\."); diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java new file mode 100644 index 0000000000..97f67a5438 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatEnvironment.java @@ -0,0 +1,160 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.so.rest.catalog.beans; + +import java.io.Serializable; +import java.text.DateFormat; +import java.util.Date; +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.PrePersist; +import javax.persistence.Table; +import javax.persistence.Temporal; +import javax.persistence.TemporalType; +import org.apache.commons.lang3.builder.EqualsBuilder; +import org.apache.commons.lang3.builder.HashCodeBuilder; +import com.openpojo.business.annotation.BusinessKey; + +@Entity +@Table(name = "heat_environment") +public class HeatEnvironment implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + @BusinessKey + @Id + @Column(name = "ARTIFACT_UUID") + private String artifactUuid; + + @Column(name = "NAME") + private String name = null; + + @Column(name = "DESCRIPTION") + private String description = null; + + @Lob + @Column(name = "BODY", columnDefinition = "LONGTEXT") + private String environment = null; + + @Column(name = "ARTIFACT_CHECKSUM") + private String artifactChecksum; + + @Column(name = "CREATION_TIMESTAMP", updatable = false) + @Temporal(TemporalType.TIMESTAMP) + private Date created; + + @BusinessKey + @Column(name = "VERSION") + private String version; + + @PrePersist + protected void onCreate() { + this.created = new Date(); + } + + @Override + public boolean equals(final Object other) { + if (!(other instanceof HeatEnvironment)) { + return false; + } + HeatEnvironment castOther = (HeatEnvironment) other; + return new EqualsBuilder().append(artifactUuid, castOther.artifactUuid).append(version, castOther.version) + .isEquals(); + } + + @Override + public int hashCode() { + return new HashCodeBuilder().append(artifactUuid).append(version).toHashCode(); + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getArtifactUuid() { + return this.artifactUuid; + } + + public void setArtifactUuid(String artifactUuid) { + this.artifactUuid = artifactUuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getEnvironment() { + return this.environment; + } + + public void setEnvironment(String environment) { + this.environment = environment; + } + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + public Date getCreated() { + return created; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("Artifact UUID=" + this.artifactUuid); + sb.append(", name="); + sb.append(name); + sb.append(", version="); + sb.append(version); + sb.append(", description="); + sb.append(this.description == null ? "null" : this.description); + sb.append(", body="); + sb.append(this.environment == null ? "null" : this.environment); + if (this.created != null) { + sb.append(",creationTimestamp="); + sb.append(DateFormat.getInstance().format(this.created)); + } + return sb.toString(); + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java new file mode 100644 index 0000000000..94f61d30e3 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatFile.java @@ -0,0 +1,115 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.so.rest.catalog.beans; + +import java.io.Serializable; +import java.util.Date; +import org.apache.commons.lang3.builder.ToStringBuilder; + + +public class HeatFile implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -3280125018687060890L; + + private String artifactUuid; + + private String description = null; + + private String fileName; + + private String fileBody; + + private Date created; + + private String artifactChecksum; + + private String version; + + @Override + public String toString() { + return new ToStringBuilder(this).append("artifactUuid", artifactUuid).append("description", description) + .append("fileName", fileName).append("fileBody", fileBody).append("created", created) + .append("artifactChecksum", artifactChecksum).toString(); + } + + public String getArtifactUuid() { + return this.artifactUuid; + } + + public void setArtifactUuid(String artifactUuid) { + this.artifactUuid = artifactUuid; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getFileName() { + return this.fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getFileBody() { + return this.fileBody; + } + + public void setFileBody(String fileBody) { + this.fileBody = fileBody; + } + + public Date getCreated() { + return created; + } + + public String getAsdcUuid() { + return this.artifactUuid; + } + + public void setAsdcUuid(String artifactUuid) { + this.artifactUuid = artifactUuid; + } + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java new file mode 100644 index 0000000000..cb346e4167 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplate.java @@ -0,0 +1,147 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.so.rest.catalog.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.apache.commons.lang3.builder.ToStringBuilder; + + +public class HeatTemplate implements Serializable { + + + private String artifactUuid; + + private String templateName; + + private String templateBody = null; + + private Integer timeoutMinutes; + + private String version; + + private String description; + + private String artifactChecksum; + + private Date created; + + private Set<HeatTemplateParam> parameters; + + private List<HeatTemplate> childTemplates; + + @Override + public String toString() { + return new ToStringBuilder(this).append("artifactUuid", artifactUuid).append("templateName", templateName) + .append("templateBody", templateBody).append("timeoutMinutes", timeoutMinutes) + .append("version", version).append("description", description) + .append("artifactChecksum", artifactChecksum).append("created", created) + .append("parameters", parameters).append("childTemplates", childTemplates).toString(); + } + + public List<HeatTemplate> getChildTemplates() { + if (childTemplates == null) + childTemplates = new ArrayList<>(); + return childTemplates; + } + + public void setChildTemplates(List<HeatTemplate> childTemplates) { + this.childTemplates = childTemplates; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } + + public String getArtifactUuid() { + return this.artifactUuid; + } + + public void setArtifactUuid(String artifactUuid) { + this.artifactUuid = artifactUuid; + } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } + + public String getTemplateBody() { + return templateBody; + } + + public void setTemplateBody(String templateBody) { + this.templateBody = templateBody; + } + + public Integer getTimeoutMinutes() { + return timeoutMinutes; + } + + public void setTimeoutMinutes(Integer timeout) { + this.timeoutMinutes = timeout; + } + + public Set<HeatTemplateParam> getParameters() { + if (parameters == null) + parameters = new HashSet<>(); + return parameters; + } + + public void setParameters(Set<HeatTemplateParam> parameters) { + this.parameters = parameters; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getHeatTemplate() { + return this.templateBody; + } + + public String getArtifactChecksum() { + return artifactChecksum; + } + + public void setArtifactChecksum(String artifactChecksum) { + this.artifactChecksum = artifactChecksum; + } + + public Date getCreated() { + return created; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java new file mode 100644 index 0000000000..a79ec962f8 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/HeatTemplateParam.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.so.rest.catalog.beans; + +import java.io.Serializable; +import org.apache.commons.lang3.builder.ToStringBuilder; + + +public class HeatTemplateParam implements Serializable { + + /** + * + */ + private static final long serialVersionUID = -8251042980747916191L; + + private String paramName; + + private Boolean required; + + private String paramType; + + private String paramAlias; + + public String getParamName() { + return paramName; + } + + public void setParamName(String paramName) { + this.paramName = paramName; + } + + public Boolean isRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public String getParamAlias() { + return paramAlias; + } + + public void setParamAlias(String paramAlias) { + this.paramAlias = paramAlias; + } + + public String getParamType() { + return paramType; + } + + public void setParamType(String paramType) { + this.paramType = paramType; + } +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java new file mode 100644 index 0000000000..1620058e1e --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Service.java @@ -0,0 +1,165 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.so.rest.catalog.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_DEFAULT) +public class Service implements Serializable { + + private static final long serialVersionUID = 768026109321305392L; + + private String modelName; + + private String description; + + private String modelVersionId; + + private String modelInvariantId; + + private Date created; + + private String modelVersion; + + private String serviceType; + + private String serviceRole; + + private String environmentContext; + + private String workloadContext; + + private String category; + + private String distrobutionStatus; + + private List<Vnf> vnf = new ArrayList<>(); + + public List<Vnf> getVnf() { + return vnf; + } + + public void setVnf(List<Vnf> vnf) { + this.vnf = vnf; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getServiceType() { + return serviceType; + } + + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + public String getServiceRole() { + return serviceRole; + } + + public void setServiceRole(String serviceRole) { + this.serviceRole = serviceRole; + } + + public String getEnvironmentContext() { + return environmentContext; + } + + public void setEnvironmentContext(String environmentContext) { + this.environmentContext = environmentContext; + } + + public String getWorkloadContext() { + return workloadContext; + } + + public void setWorkloadContext(String workloadContext) { + this.workloadContext = workloadContext; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getDistrobutionStatus() { + return distrobutionStatus; + } + + public void setDistrobutionStatus(String distrobutionStatus) { + this.distrobutionStatus = distrobutionStatus; + } + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java new file mode 100644 index 0000000000..8e18f94faf --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/VfModule.java @@ -0,0 +1,196 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.so.rest.catalog.beans; + +import java.util.Date; +import java.util.List; +import org.onap.so.db.catalog.beans.HeatEnvironment; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_DEFAULT) +public class VfModule { + + // VfModule + private String modelVersionId; + private String modelInvariantId; + private String modelName; + private String modelVersion; + private String description; + private Boolean isBase; + private HeatTemplate heatTemplate; + private Date created; + private List<HeatFile> heatFile; + + // Customization + private String modelCustomizationId; + private String label; + private Integer minInstances; + private Integer maxInstances; + private Integer initialCount; + private Integer availabilityZoneCount; + private HeatEnvironment heatEnv; + private Boolean isVolumeGroup; + + + // Add in cvnfcCustomization + + + + public String getModelName() { + return modelName; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Boolean getIsBase() { + return isBase; + } + + public void setIsBase(Boolean isBase) { + this.isBase = isBase; + } + + public HeatTemplate getHeatTemplate() { + return heatTemplate; + } + + public void setHeatTemplate(HeatTemplate heatTemplate) { + this.heatTemplate = heatTemplate; + } + + public Date getCreated() { + return created; + } + + public void setCreated(Date created) { + this.created = created; + } + + public List<HeatFile> getHeatFile() { + return heatFile; + } + + public void setHeatFile(List<HeatFile> heatFile) { + this.heatFile = heatFile; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public Integer getMinInstances() { + return minInstances; + } + + public void setMinInstances(Integer minInstances) { + this.minInstances = minInstances; + } + + public Integer getMaxInstances() { + return maxInstances; + } + + public void setMaxInstances(Integer maxInstances) { + this.maxInstances = maxInstances; + } + + public Integer getInitialCount() { + return initialCount; + } + + public void setInitialCount(Integer integer) { + this.initialCount = integer; + } + + public Integer getAvailabilityZoneCount() { + return availabilityZoneCount; + } + + public void setAvailabilityZoneCount(Integer availabilityZoneCount) { + this.availabilityZoneCount = availabilityZoneCount; + } + + public HeatEnvironment getHeatEnv() { + return heatEnv; + } + + public void setHeatEnv(HeatEnvironment heatEnv) { + this.heatEnv = heatEnv; + } + + public Boolean getIsVolumeGroup() { + return isVolumeGroup; + } + + public void setIsVolumeGroup(Boolean isVolumeGroup) { + this.isVolumeGroup = isVolumeGroup; + } + + + +} diff --git a/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java new file mode 100644 index 0000000000..40d701c3c5 --- /dev/null +++ b/mso-catalog-db/src/main/java/org/onap/so/rest/catalog/beans/Vnf.java @@ -0,0 +1,218 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.so.rest.catalog.beans; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonInclude.Include; + +@JsonInclude(Include.NON_DEFAULT) +public class Vnf implements Serializable { + + /** + * + */ + private static final long serialVersionUID = 2956199674955504834L; + + private String modelName; + private String modelVersionId; + private String modelInvariantId; + private String modelVersion; + private String modelCustomizationId; + private String modelInstanceName; + private Integer minInstances; + private Integer maxInstances; + private Integer availabilityZoneMaxCount; + private String toscaNodeType; + private String nfFunction; + private String nfRole; + private String nfNamingCode; + private String multiStageDesign; + private String orchestrationMode; + private String cloudVersionMin; + private String cloudVersionMax; + private String category; + private String subCategory; + private List<VfModule> vfModule = new ArrayList<>(); + + public List<VfModule> getVfModule() { + return vfModule; + } + + public void setVfModule(List<VfModule> vfModule) { + this.vfModule = vfModule; + } + + public Integer getAvailabilityZoneMaxCount() { + return availabilityZoneMaxCount; + } + + public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) { + this.availabilityZoneMaxCount = availabilityZoneMaxCount; + } + + public Integer getMinInstances() { + return minInstances; + } + + public void setMinInstances(Integer minInstances) { + this.minInstances = minInstances; + } + + public Integer getMaxInstances() { + return maxInstances; + } + + public void setMaxInstances(Integer maxInstances) { + this.maxInstances = maxInstances; + } + + public String getCloudVersionMin() { + return cloudVersionMin; + } + + public void setCloudVersionMin(String cloudVersionMin) { + this.cloudVersionMin = cloudVersionMin; + } + + public String getCloudVersionMax() { + return cloudVersionMax; + } + + public void setCloudVersionMax(String cloudVersionMax) { + this.cloudVersionMax = cloudVersionMax; + } + + public String getModelVersionId() { + return modelVersionId; + } + + public void setModelVersionId(String modelVersionId) { + this.modelVersionId = modelVersionId; + } + + public String getModelInvariantId() { + return modelInvariantId; + } + + public void setModelInvariantId(String modelInvariantId) { + this.modelInvariantId = modelInvariantId; + } + + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public String getSubCategory() { + return subCategory; + } + + public void setSubCategory(String subCategory) { + this.subCategory = subCategory; + } + + public String getOrchestrationMode() { + return orchestrationMode; + } + + public void setOrchestrationMode(String orchestrationMode) { + this.orchestrationMode = orchestrationMode; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + public String getModelVersion() { + return modelVersion; + } + + public void setModelVersion(String modelVersion) { + this.modelVersion = modelVersion; + } + + + public String getModelInstanceName() { + return modelInstanceName; + } + + public void setModelInstanceName(String modelInstanceName) { + this.modelInstanceName = modelInstanceName; + } + + public String getToscaNodeType() { + return toscaNodeType; + } + + public void setToscaNodeType(String toscaNodeType) { + this.toscaNodeType = toscaNodeType; + } + + public String getNfFunction() { + return nfFunction; + } + + public void setNfFunction(String nfFunction) { + this.nfFunction = nfFunction; + } + + public String getNfRole() { + return nfRole; + } + + public void setNfRole(String nfRole) { + this.nfRole = nfRole; + } + + public String getNfNamingCode() { + return nfNamingCode; + } + + public void setNfNamingCode(String nfNamingCode) { + this.nfNamingCode = nfNamingCode; + } + + public String getMultiStageDesign() { + return multiStageDesign; + } + + public void setMultiStageDesign(String multiStepDesign) { + this.multiStageDesign = multiStepDesign; + } +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java new file mode 100644 index 0000000000..9c257bdec3 --- /dev/null +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java @@ -0,0 +1,173 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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.so.db.catalog.client; + +import static org.junit.Assert.assertTrue; +import java.util.ArrayList; +import javax.persistence.EntityNotFoundException; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.ExpectedException; +import org.onap.so.db.catalog.beans.CvnfcCustomization; +import org.onap.so.db.catalog.beans.VfModuleCustomization; +import org.onap.so.db.catalog.beans.VnfResourceCustomization; + +public class CatalogDbClientTest { + + private CatalogDbClient catalogDbClient; + + @Before + public void init() { + catalogDbClient = new CatalogDbClient(); + } + + @Rule + public ExpectedException thrown = ExpectedException.none(); + + @Test + public final void testFindVnfResourceCustomizationInListNullInList() { + thrown.expect(EntityNotFoundException.class); + String vnfCustomizationUUID = "a123"; + VnfResourceCustomization vrc = new VnfResourceCustomization(); + vrc.setModelCustomizationUUID("z789J"); + VnfResourceCustomization vrc2 = new VnfResourceCustomization(); + vrc2.setModelCustomizationUUID(null); + ArrayList<VnfResourceCustomization> vrcs = new ArrayList<VnfResourceCustomization>(); + vrcs.add(vrc); + vrcs.add(vrc2); + catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vrcs); + } + + @Test + public final void testFindVnfResourceCustomizationInListNullString() { + thrown.expect(EntityNotFoundException.class); + thrown.expectMessage("a NULL UUID was provided in query to search for VnfResourceCustomization"); + String vnfCustomizationUUID = null; + VnfResourceCustomization vrc = new VnfResourceCustomization(); + vrc.setModelCustomizationUUID("z789J"); + VnfResourceCustomization vrc2 = new VnfResourceCustomization(); + vrc2.setModelCustomizationUUID("a123"); + ArrayList<VnfResourceCustomization> vrcs = new ArrayList<VnfResourceCustomization>(); + vrcs.add(vrc); + vrcs.add(vrc2); + catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vrcs); + } + + @Test + public final void testFindVnfResourceCustomizationInListNoNulls() { + String vnfCustomizationUUID = "a123"; + VnfResourceCustomization vrc = new VnfResourceCustomization(); + vrc.setModelCustomizationUUID("z789J"); + VnfResourceCustomization vrc2 = new VnfResourceCustomization(); + vrc2.setModelCustomizationUUID("a123"); + ArrayList<VnfResourceCustomization> vrcs = new ArrayList<VnfResourceCustomization>(); + vrcs.add(vrc); + vrcs.add(vrc2); + VnfResourceCustomization aVrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vrcs); + assertTrue(aVrc.getModelCustomizationUUID().equals("a123")); + } + + @Test + public final void testFindVfModuleCustomizationInListNullInList() { + thrown.expect(EntityNotFoundException.class); + String vfModuleCustomizationUUID = "a123"; + VfModuleCustomization vmc = new VfModuleCustomization(); + vmc.setModelCustomizationUUID("z789J"); + VfModuleCustomization vmc2 = new VfModuleCustomization(); + vmc2.setModelCustomizationUUID(null); + ArrayList<VfModuleCustomization> vmcs = new ArrayList<VfModuleCustomization>(); + vmcs.add(vmc); + vmcs.add(vmc2); + catalogDbClient.findVfModuleCustomizationInList(vfModuleCustomizationUUID, vmcs); + } + + @Test + public final void testFindVfModuleCustomizationInListNullString() { + thrown.expect(EntityNotFoundException.class); + thrown.expectMessage("a NULL UUID was provided in query to search for VfModuleCustomization"); + String vfModuleCustomizationUUID = null; + VfModuleCustomization vmc = new VfModuleCustomization(); + vmc.setModelCustomizationUUID("z789J"); + VfModuleCustomization vmc2 = new VfModuleCustomization(); + vmc2.setModelCustomizationUUID("a123"); + ArrayList<VfModuleCustomization> vmcs = new ArrayList<VfModuleCustomization>(); + vmcs.add(vmc); + vmcs.add(vmc2); + catalogDbClient.findVfModuleCustomizationInList(vfModuleCustomizationUUID, vmcs); + } + + @Test + public final void testFindVfModuleCustomizationInListNoNulls() { + String vfModuleCustomizationUUID = "a123"; + VfModuleCustomization vmc = new VfModuleCustomization(); + vmc.setModelCustomizationUUID("z789J"); + VfModuleCustomization vmc2 = new VfModuleCustomization(); + vmc2.setModelCustomizationUUID("a123"); + ArrayList<VfModuleCustomization> vmcs = new ArrayList<VfModuleCustomization>(); + vmcs.add(vmc); + vmcs.add(vmc2); + VfModuleCustomization aVmc = catalogDbClient.findVfModuleCustomizationInList(vfModuleCustomizationUUID, vmcs); + assertTrue(aVmc.getModelCustomizationUUID().equals("a123")); + } + + @Test + public final void testFindCvnfcCustomizationInListNullInList() { + thrown.expect(EntityNotFoundException.class); + String cvnfcCustomizationUuid = "a123"; + CvnfcCustomization cvnfc = new CvnfcCustomization(); + cvnfc.setModelCustomizationUUID("z789J"); + CvnfcCustomization cvnfc2 = new CvnfcCustomization(); + cvnfc2.setModelCustomizationUUID(null); + ArrayList<CvnfcCustomization> cvnfcs = new ArrayList<CvnfcCustomization>(); + cvnfcs.add(cvnfc); + cvnfcs.add(cvnfc2); + catalogDbClient.findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcs); + } + + @Test + public final void testFindCvnfcCustomizationInListNullString() { + thrown.expect(EntityNotFoundException.class); + thrown.expectMessage("a NULL UUID was provided in query to search for CvnfcCustomization"); + String cvnfcCustomizationUuid = null; + CvnfcCustomization cvnfc = new CvnfcCustomization(); + cvnfc.setModelCustomizationUUID("z789J"); + CvnfcCustomization cvnfc2 = new CvnfcCustomization(); + cvnfc2.setModelCustomizationUUID("a123"); + ArrayList<CvnfcCustomization> cvnfcs = new ArrayList<CvnfcCustomization>(); + cvnfcs.add(cvnfc); + cvnfcs.add(cvnfc2); + catalogDbClient.findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcs); + } + + @Test + public final void testFindCvnfcCustomizationInListNoNulls() { + String cvnfcCustomizationUuid = "a123"; + CvnfcCustomization cvnfc = new CvnfcCustomization(); + cvnfc.setModelCustomizationUUID("z789J"); + CvnfcCustomization cvnfc2 = new CvnfcCustomization(); + cvnfc2.setModelCustomizationUUID("a123"); + ArrayList<CvnfcCustomization> cvnfcs = new ArrayList<CvnfcCustomization>(); + cvnfcs.add(cvnfc); + cvnfcs.add(cvnfc2); + CvnfcCustomization aCvnfc = catalogDbClient.findCvnfcCustomizationInAList(cvnfcCustomizationUuid, cvnfcs); + assertTrue(aCvnfc.getModelCustomizationUUID().equals("a123")); + } +} diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java index 371a9c13e0..e8addc4aa8 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java @@ -74,7 +74,6 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>(); vnfResourceCustomizations.add(vnfResourceCustomization); - vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); vnfResourceCustomization.setVnfResources(vnfResource); @@ -123,7 +122,6 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>(); vnfResourceCustomizations.add(vnfResourceCustomization); - vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); vnfResourceCustomization.setVnfResources(vnfResource); @@ -177,7 +175,6 @@ public class CvnfcCustomizationRepositoryTest extends BaseTest { List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList(); vnfResourceCustomizations.add(vnfResourceCustomization); - vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations); vnfResourceCustomization.setVnfResources(vnfResource); diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql index f5e7d52ba4..7cd13a3780 100644 --- a/mso-catalog-db/src/test/resources/schema.sql +++ b/mso-catalog-db/src/test/resources/schema.sql @@ -803,6 +803,9 @@ CREATE TABLE `service` ( `WORKLOAD_CONTEXT` varchar(200) DEFAULT NULL, `SERVICE_CATEGORY` varchar(200) DEFAULT NULL, `RESOURCE_ORDER` varchar(200) default NULL, + `OVERALL_DISTRIBUTION_STATUS` varchar(45), + `ONAP_GENERATED_NAMING` TINYINT(1) DEFAULT NULL, + `NAMING_POLICY` varchar(200) DEFAULT NULL, PRIMARY KEY (`MODEL_UUID`), KEY `fk_service__tosca_csar1_idx` (`TOSCA_CSAR_ARTIFACT_UUID`), CONSTRAINT `fk_service__tosca_csar1` FOREIGN KEY (`TOSCA_CSAR_ARTIFACT_UUID`) REFERENCES `tosca_csar` (`ARTIFACT_UUID`) ON DELETE CASCADE ON UPDATE CASCADE @@ -1106,6 +1109,7 @@ CREATE TABLE `vnf_resource_customization` ( `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `VNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL, `SERVICE_MODEL_UUID` varchar(200) NOT NULL, + `VNFCINSTANCEGROUP_ORDER` varchar(200) default NULL, PRIMARY KEY (`ID`), UNIQUE KEY `UK_vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`,`SERVICE_MODEL_UUID`), KEY `fk_vnf_resource_customization__vnf_resource1_idx` (`VNF_RESOURCE_MODEL_UUID`), @@ -1132,6 +1136,8 @@ CREATE TABLE `vnfc_customization` ( `MODEL_NAME` varchar(200) NOT NULL, `TOSCA_NODE_TYPE` varchar(200) NOT NULL, `DESCRIPTION` varchar(1200) DEFAULT NULL, + `RESOURCE_INPUT` varchar(20000) DEFAULT NULL, + `VNFC_INSTANCE_GROUP_CUSTOMIZATION_ID` integer DEFAULT NULL, `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; |