summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src
diff options
context:
space:
mode:
Diffstat (limited to 'mso-catalog-db/src')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResource.java215
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java220
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java606
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java510
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java1348
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java32
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfResourceRepository.java29
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java89
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java62
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfResourceRepositoryTest.java50
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java78
-rw-r--r--mso-catalog-db/src/test/resources/data.sql17
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql40
13 files changed, 2093 insertions, 1203 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResource.java
new file mode 100644
index 0000000000..5e9a07443f
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResource.java
@@ -0,0 +1,215 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+import com.openpojo.business.annotation.BusinessKey;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+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 uk.co.blackpepper.bowman.annotation.LinkedResource;
+
+@Entity
+@Table(name = "pnf_resource")
+public class PnfResource implements Serializable {
+
+ private static final long serialVersionUID = 7680261093213053483L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "MODEL_UUID")
+ private String modelUUID;
+
+ @Column(name = "MODEL_INVARIANT_UUID")
+ private String modelInvariantUUID;
+
+ @Column(name = "MODEL_NAME")
+ private String modelName;
+
+ @Column(name = "MODEL_VERSION")
+ private String modelVersion;
+
+ @Column(name = "TOSCA_NODE_TYPE")
+ private String toscaNodeType;
+
+ @Column(name = "DESCRIPTION")
+ private String description;
+
+ @Column(name = "ORCHESTRATION_MODE")
+ private String orchestrationMode;
+
+ @Column(name = "RESOURCE_CATEGORY")
+ private String category;
+
+ @Column(name = "RESOURCE_SUB_CATEGORY")
+ private String subCategory;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "pnfResources")
+ private List<PnfResourceCustomization> pnfResourceCustomizations;
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
+ .append("modelName", modelName).append("modelVersion", modelVersion)
+ .append("toscaNodeType", toscaNodeType).append("description", description)
+ .append("orchestrationMode", orchestrationMode).append("created", created)
+ .append("pnfResourceCustomizations", pnfResourceCustomizations)
+ .toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof PnfResource)) {
+ return false;
+ }
+ PnfResource castOther = (PnfResource) other;
+ return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelUUID).toHashCode();
+ }
+
+ public String getOrchestrationMode() {
+ return orchestrationMode;
+ }
+
+ public void setOrchestrationMode(String orchestrationMode) {
+ this.orchestrationMode = orchestrationMode;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ /**
+ * @return Returns the category.
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * @param category The category to set.
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ /**
+ * @return Returns the subCategory.
+ */
+ public String getSubCategory() {
+ return subCategory;
+ }
+
+ /**
+ * @param subCategory The subCategory to set.
+ */
+ public void setSubCategory(String subCategory) {
+ this.subCategory = subCategory;
+ }
+
+ public String getModelInvariantUUID() {
+ return this.modelInvariantUUID;
+ }
+
+ public void setModelInvariantUUID(String modelInvariantUUID) {
+ this.modelInvariantUUID = modelInvariantUUID;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getModelUUID() {
+ return modelUUID;
+ }
+
+ public void setModelUUID(String modelUUID) {
+ this.modelUUID = modelUUID;
+ }
+
+ public String getModelInvariantId() {
+ return this.modelInvariantUUID;
+ }
+
+ public String getToscaNodeType() {
+ return toscaNodeType;
+ }
+
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+
+ @LinkedResource
+ public List<PnfResourceCustomization> getPnfResourceCustomizations() {
+ if (pnfResourceCustomizations == null) {
+ pnfResourceCustomizations = new ArrayList<>();
+ }
+ return pnfResourceCustomizations;
+ }
+
+ public void setPnfResourceCustomizations(List<PnfResourceCustomization> pnfResourceCustomizations) {
+ this.pnfResourceCustomizations = pnfResourceCustomizations;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
new file mode 100644
index 0000000000..b2d40b8409
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/PnfResourceCustomization.java
@@ -0,0 +1,220 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.beans;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.openpojo.business.annotation.BusinessKey;
+import java.io.Serializable;
+import java.util.Date;
+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.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 uk.co.blackpepper.bowman.annotation.LinkedResource;
+
+@Entity
+@Table(name = "pnf_resource_customization")
+public class PnfResourceCustomization implements Serializable {
+
+ private static final long serialVersionUID = 768026109321305415L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "MODEL_CUSTOMIZATION_UUID")
+ private String modelCustomizationUUID;
+
+ @Column(name = "MODEL_INSTANCE_NAME")
+ private String modelInstanceName;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @Column(name = "NF_FUNCTION")
+ private String nfFunction;
+
+ @Column(name = "NF_TYPE")
+ private String nfType;
+
+ @Column(name = "NF_ROLE")
+ private String nfRole;
+
+ @Column(name = "NF_NAMING_CODE")
+ private String nfNamingCode;
+
+ @Column(name = "MULTI_STAGE_DESIGN")
+ private String multiStageDesign;
+
+ @Column(name = "RESOURCE_INPUT")
+ private String resourceInput;
+
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "PNF_RESOURCE_MODEL_UUID")
+ private PnfResource pnfResources;
+
+ @Column(name = "CDS_BLUEPRINT_NAME")
+ private String blueprintName;
+
+ @Column(name = "CDS_BLUEPRINT_VERSION")
+ private String blueprintVersion;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
+ .append("modelInstanceName", modelInstanceName).append("created", created)
+ .append("nfFunction", nfFunction)
+ .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
+ .append("multiStageDesign", multiStageDesign).append("pnfResources", pnfResources)
+ .append("blueprintName", blueprintName).append("blueprintVersion", blueprintVersion)
+ .toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof PnfResourceCustomization)) {
+ return false;
+ }
+ PnfResourceCustomization castOther = (PnfResourceCustomization) other;
+ return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ public Date getCreationTimestamp() {
+ return this.created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public String getModelCustomizationUUID() {
+ return modelCustomizationUUID;
+ }
+
+ public void setModelCustomizationUUID(String modelCustomizationUUID) {
+ this.modelCustomizationUUID = modelCustomizationUUID;
+ }
+
+ public String getModelInstanceName() {
+ return this.modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public String getNfFunction() {
+ return nfFunction;
+ }
+
+ public void setNfFunction(String nfFunction) {
+ this.nfFunction = nfFunction;
+ }
+
+ public String getNfType() {
+ return nfType;
+ }
+
+ public void setNfType(String nfType) {
+ this.nfType = nfType;
+ }
+
+ 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 this.multiStageDesign;
+ }
+
+ public void setMultiStageDesign(String multiStageDesign) {
+ this.multiStageDesign = multiStageDesign;
+ }
+
+ @LinkedResource
+ public PnfResource getPnfResources() {
+ return pnfResources;
+ }
+
+ public void setPnfResources(PnfResource pnfResources) {
+ this.pnfResources = pnfResources;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
+
+
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
+}
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 28ff778d44..e0b783fd9e 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
@@ -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.
@@ -53,294 +53,316 @@ import uk.co.blackpepper.bowman.annotation.LinkedResource;
@Table(name = "service")
public class Service implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
- @Column(name = "MODEL_NAME")
- private String modelName;
-
- @Column(name = "DESCRIPTION", length = 1200)
- private String description;
-
- @BusinessKey
- @Id
- @Column(name = "MODEL_UUID")
- private String modelUUID;
-
- @Column(name = "MODEL_INVARIANT_UUID")
- private String modelInvariantUUID;
-
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
- @Column(name = "CREATION_TIMESTAMP", updatable = false)
- @Temporal(TemporalType.TIMESTAMP)
- private Date created;
-
- @Column(name = "MODEL_VERSION")
- private String modelVersion;
-
- @Column(name = "SERVICE_TYPE")
- private String serviceType;
-
- @Column(name = "SERVICE_ROLE")
- private String serviceRole;
-
- @Column(name = "ENVIRONMENT_CONTEXT")
- private String environmentContext;
-
- @Column(name = "WORKLOAD_CONTEXT")
- private String workloadContext;
-
- @Column(name = "SERVICE_CATEGORY")
- private String category;
-
- @Column(name = "RESOURCE_ORDER")
- private String resourceOrder;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "network_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<NetworkResourceCustomization> networkCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "vnf_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<VnfResourceCustomization> vnfCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "allotted_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<AllottedResourceCustomization> allottedCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "collection_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<CollectionResourceCustomization> collectionResourceCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "service_proxy_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<ServiceProxyResourceCustomization> serviceProxyCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "configuration_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
- private List<ConfigurationResourceCustomization> configurationCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL)
- @MapKey(name = "action")
- @JoinColumn(name = "SERVICE_MODEL_UUID")
- private Map<String, ServiceRecipe> recipes;
-
- @ManyToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "TOSCA_CSAR_ARTIFACT_UUID")
- private ToscaCsar csar;
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("modelName", modelName).append("description", description)
- .append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
- .append("created", created).append("modelVersion", modelVersion).append("serviceType", serviceType)
- .append("serviceRole", serviceRole).append("environmentContext", environmentContext)
- .append("workloadContext", workloadContext).append("category", category)
- .append("networkCustomizations", networkCustomizations).append("vnfCustomizations", vnfCustomizations)
- .append("allottedCustomizations", allottedCustomizations)
- .append("collectionResourceCustomizations", collectionResourceCustomizations)
- .append("serviceProxyCustomizations", serviceProxyCustomizations)
- .append("configurationCustomizations", configurationCustomizations).append("recipes", recipes)
- .append("csar", csar).toString();
- }
-
- @PrePersist
- protected void onCreate() {
- this.created = new Date();
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof Service)) {
- return false;
- }
- Service castOther = (Service) other;
- return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(modelUUID).toHashCode();
- }
-
- @LinkedResource
- public List<ServiceProxyResourceCustomization> getServiceProxyCustomizations() {
- return serviceProxyCustomizations;
- }
-
- public void setServiceProxyCustomizations(List<ServiceProxyResourceCustomization> serviceProxyCustomizations) {
- this.serviceProxyCustomizations = serviceProxyCustomizations;
- }
-
- @LinkedResource
- public List<NetworkResourceCustomization> getNetworkCustomizations() {
- if (networkCustomizations == null)
- networkCustomizations = new ArrayList<>();
- return networkCustomizations;
- }
-
- public void setNetworkCustomizations(List<NetworkResourceCustomization> networkCustomizations) {
- this.networkCustomizations = networkCustomizations;
- }
-
- @LinkedResource
- public List<VnfResourceCustomization> getVnfCustomizations() {
- if (vnfCustomizations == null)
- vnfCustomizations = new ArrayList<>();
- return vnfCustomizations;
- }
-
- public void setVnfCustomizations(List<VnfResourceCustomization> vnfCustomizations) {
- this.vnfCustomizations = vnfCustomizations;
- }
-
- @LinkedResource
- public List<AllottedResourceCustomization> getAllottedCustomizations() {
- if (allottedCustomizations == null)
- allottedCustomizations = new ArrayList<>();
- return allottedCustomizations;
- }
-
- public void setAllottedCustomizations(List<AllottedResourceCustomization> allotedCustomizations) {
- this.allottedCustomizations = allotedCustomizations;
- }
-
- @LinkedResource
- public List<CollectionResourceCustomization> getCollectionResourceCustomizations() {
- if (collectionResourceCustomizations == null)
- collectionResourceCustomizations = new ArrayList<>();
- return collectionResourceCustomizations;
- }
-
- public void setCollectionResourceCustomizations(
- List<CollectionResourceCustomization> collectionResourceCustomizations) {
- this.collectionResourceCustomizations = collectionResourceCustomizations;
- }
-
- @LinkedResource
- public List<ConfigurationResourceCustomization> getConfigurationCustomizations() {
- if(configurationCustomizations == null)
- configurationCustomizations = new ArrayList<>();
- return configurationCustomizations;
- }
-
- public void setConfigurationCustomizations(List<ConfigurationResourceCustomization> configurationCustomizations) {
- this.configurationCustomizations = configurationCustomizations;
- }
-
- 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;
- }
-
- @LinkedResource
- public Map<String, ServiceRecipe> getRecipes() {
- return recipes;
- }
-
- public void setRecipes(Map<String, ServiceRecipe> recipes) {
- this.recipes = recipes;
- }
-
- public Date getCreated() {
- return created;
- }
-
- public String getModelUUID() {
- return modelUUID;
- }
-
- public void setModelUUID(String modelUUID) {
- this.modelUUID = modelUUID;
- }
-
- public String getModelInvariantUUID() {
- return modelInvariantUUID;
- }
-
- public void setModelInvariantUUID(String modelInvariantUUID) {
- this.modelInvariantUUID = modelInvariantUUID;
- }
-
- public String getModelVersion() {
- return modelVersion;
- }
-
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
-
- /**
- * @return Returns the category.
- */
- public String getCategory() {
- return category;
- }
-
- /**
- * @param category
- * The category to set.
- */
- public void setCategory(String category) {
- this.category = category;
- }
-
- 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 this.environmentContext;
- }
-
- public void setEnvironmentContext(String environmentContext) {
- this.environmentContext = environmentContext;
- }
-
- @LinkedResource
- public ToscaCsar getCsar() {
- return csar;
- }
-
- public void setCsar(ToscaCsar csar) {
- this.csar = csar;
- }
-
- public String getWorkloadContext() {
- return this.workloadContext;
- }
-
- public void setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- }
-
- public String getResourceOrder() {
- return resourceOrder;
- }
-
- public void setResourceOrder(String resourceOrder) {
- this.resourceOrder = resourceOrder;
- }
+ private static final long serialVersionUID = 768026109321305392L;
+
+ @Column(name = "MODEL_NAME")
+ private String modelName;
+
+ @Column(name = "DESCRIPTION", length = 1200)
+ private String description;
+
+ @BusinessKey
+ @Id
+ @Column(name = "MODEL_UUID")
+ private String modelUUID;
+
+ @Column(name = "MODEL_INVARIANT_UUID")
+ private String modelInvariantUUID;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @Column(name = "MODEL_VERSION")
+ private String modelVersion;
+
+ @Column(name = "SERVICE_TYPE")
+ private String serviceType;
+
+ @Column(name = "SERVICE_ROLE")
+ private String serviceRole;
+
+ @Column(name = "ENVIRONMENT_CONTEXT")
+ private String environmentContext;
+
+ @Column(name = "WORKLOAD_CONTEXT")
+ private String workloadContext;
+
+ @Column(name = "SERVICE_CATEGORY")
+ private String category;
+
+ @Column(name = "RESOURCE_ORDER")
+ private String resourceOrder;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "network_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<NetworkResourceCustomization> networkCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "vnf_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<VnfResourceCustomization> vnfCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "allotted_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<AllottedResourceCustomization> allottedCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "collection_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<CollectionResourceCustomization> collectionResourceCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "service_proxy_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<ServiceProxyResourceCustomization> serviceProxyCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "configuration_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<ConfigurationResourceCustomization> configurationCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "pnf_resource_customization_to_service", joinColumns = @JoinColumn(name = "SERVICE_MODEL_UUID"), inverseJoinColumns = @JoinColumn(name = "RESOURCE_MODEL_CUSTOMIZATION_UUID"))
+ private List<PnfResourceCustomization> pnfCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @MapKey(name = "action")
+ @JoinColumn(name = "SERVICE_MODEL_UUID")
+ private Map<String, ServiceRecipe> recipes;
+
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "TOSCA_CSAR_ARTIFACT_UUID")
+ private ToscaCsar csar;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelName", modelName).append("description", description)
+ .append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
+ .append("created", created).append("modelVersion", modelVersion).append("serviceType", serviceType)
+ .append("serviceRole", serviceRole).append("environmentContext", environmentContext)
+ .append("workloadContext", workloadContext).append("category", category)
+ .append("networkCustomizations", networkCustomizations).append("vnfCustomizations", vnfCustomizations)
+ .append("allottedCustomizations", allottedCustomizations)
+ .append("collectionResourceCustomizations", collectionResourceCustomizations)
+ .append("serviceProxyCustomizations", serviceProxyCustomizations)
+ .append("configurationCustomizations", configurationCustomizations)
+ .append("pnfCustomizations", pnfCustomizations)
+ .append("recipes", recipes)
+ .append("csar", csar).toString();
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof Service)) {
+ return false;
+ }
+ Service castOther = (Service) other;
+ return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelUUID).toHashCode();
+ }
+
+ @LinkedResource
+ public List<ServiceProxyResourceCustomization> getServiceProxyCustomizations() {
+ return serviceProxyCustomizations;
+ }
+
+ public void setServiceProxyCustomizations(List<ServiceProxyResourceCustomization> serviceProxyCustomizations) {
+ this.serviceProxyCustomizations = serviceProxyCustomizations;
+ }
+
+ @LinkedResource
+ public List<NetworkResourceCustomization> getNetworkCustomizations() {
+ if (networkCustomizations == null) {
+ networkCustomizations = new ArrayList<>();
+ }
+ return networkCustomizations;
+ }
+
+ public void setNetworkCustomizations(List<NetworkResourceCustomization> networkCustomizations) {
+ this.networkCustomizations = networkCustomizations;
+ }
+
+ @LinkedResource
+ public List<VnfResourceCustomization> getVnfCustomizations() {
+ if (vnfCustomizations == null) {
+ vnfCustomizations = new ArrayList<>();
+ }
+ return vnfCustomizations;
+ }
+
+ public void setVnfCustomizations(List<VnfResourceCustomization> vnfCustomizations) {
+ this.vnfCustomizations = vnfCustomizations;
+ }
+
+ @LinkedResource
+ public List<AllottedResourceCustomization> getAllottedCustomizations() {
+ if (allottedCustomizations == null) {
+ allottedCustomizations = new ArrayList<>();
+ }
+ return allottedCustomizations;
+ }
+
+ public void setAllottedCustomizations(List<AllottedResourceCustomization> allotedCustomizations) {
+ this.allottedCustomizations = allotedCustomizations;
+ }
+
+ @LinkedResource
+ public List<CollectionResourceCustomization> getCollectionResourceCustomizations() {
+ if (collectionResourceCustomizations == null) {
+ collectionResourceCustomizations = new ArrayList<>();
+ }
+ return collectionResourceCustomizations;
+ }
+
+ public void setCollectionResourceCustomizations(
+ List<CollectionResourceCustomization> collectionResourceCustomizations) {
+ this.collectionResourceCustomizations = collectionResourceCustomizations;
+ }
+
+ @LinkedResource
+ public List<ConfigurationResourceCustomization> getConfigurationCustomizations() {
+ if (configurationCustomizations == null) {
+ configurationCustomizations = new ArrayList<>();
+ }
+ return configurationCustomizations;
+ }
+
+ public void setConfigurationCustomizations(List<ConfigurationResourceCustomization> configurationCustomizations) {
+ this.configurationCustomizations = configurationCustomizations;
+ }
+
+ @LinkedResource
+ public List<PnfResourceCustomization> getPnfCustomizations() {
+ if (pnfCustomizations == null) {
+ pnfCustomizations = new ArrayList<>();
+ }
+ return pnfCustomizations;
+ }
+
+ public void setPnfCustomizations(List<PnfResourceCustomization> pnfCustomizations) {
+ this.pnfCustomizations = pnfCustomizations;
+ }
+
+ 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;
+ }
+
+ @LinkedResource
+ public Map<String, ServiceRecipe> getRecipes() {
+ return recipes;
+ }
+
+ public void setRecipes(Map<String, ServiceRecipe> recipes) {
+ this.recipes = recipes;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public String getModelUUID() {
+ return modelUUID;
+ }
+
+ public void setModelUUID(String modelUUID) {
+ this.modelUUID = modelUUID;
+ }
+
+ public String getModelInvariantUUID() {
+ return modelInvariantUUID;
+ }
+
+ public void setModelInvariantUUID(String modelInvariantUUID) {
+ this.modelInvariantUUID = modelInvariantUUID;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ /**
+ * @return Returns the category.
+ */
+ public String getCategory() {
+ return category;
+ }
+
+ /**
+ * @param category The category to set.
+ */
+ public void setCategory(String category) {
+ this.category = category;
+ }
+
+ 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 this.environmentContext;
+ }
+
+ public void setEnvironmentContext(String environmentContext) {
+ this.environmentContext = environmentContext;
+ }
+
+ @LinkedResource
+ public ToscaCsar getCsar() {
+ return csar;
+ }
+
+ public void setCsar(ToscaCsar csar) {
+ this.csar = csar;
+ }
+
+ public String getWorkloadContext() {
+ return this.workloadContext;
+ }
+
+ public void setWorkloadContext(String workloadContext) {
+ this.workloadContext = workloadContext;
+ }
+
+ public String getResourceOrder() {
+ return resourceOrder;
+ }
+
+ public void setResourceOrder(String resourceOrder) {
+ this.resourceOrder = resourceOrder;
+ }
}
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 53e8c9613e..c75199ed41 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
@@ -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.
@@ -54,244 +54,270 @@ import uk.co.blackpepper.bowman.annotation.LinkedResource;
@Table(name = "vnf_resource_customization")
public class VnfResourceCustomization implements Serializable {
- private static final long serialVersionUID = 768026109321305392L;
-
- @BusinessKey
- @Id
- @Column(name = "MODEL_CUSTOMIZATION_UUID")
- private String modelCustomizationUUID;
-
- @Column(name = "MODEL_INSTANCE_NAME")
- private String modelInstanceName;
-
- @Column(name = "CREATION_TIMESTAMP", updatable = false)
- @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
- @Temporal(TemporalType.TIMESTAMP)
- private Date created;
-
- public void setCreated(Date created) {
- this.created = created;
- }
-
- @Column(name = "MIN_INSTANCES")
- private Integer minInstances;
-
- @Column(name = "MAX_INSTANCES")
- private Integer maxInstances;
-
- @Column(name = "AVAILABILITY_ZONE_MAX_COUNT")
- private Integer availabilityZoneMaxCount;
-
- @Column(name = "NF_FUNCTION")
- private String nfFunction;
-
- @Column(name = "NF_TYPE")
- private String nfType;
-
- @Column(name = "NF_ROLE")
- private String nfRole;
-
- @Column(name = "NF_NAMING_CODE")
- private String nfNamingCode;
-
- @Column(name = "MULTI_STAGE_DESIGN")
- private String multiStageDesign;
-
- @Column(name = "RESOURCE_INPUT")
- private String resourceInput;
-
- @ManyToOne(cascade = CascadeType.ALL)
- @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID")
- private VnfResource vnfResources;
-
- @OneToMany(cascade = CascadeType.ALL)
- @JoinTable(name = "vnf_res_custom_to_vf_module_custom", joinColumns = @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID"), inverseJoinColumns = @JoinColumn(name = "VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID"))
- private List<VfModuleCustomization> vfModuleCustomizations;
-
- @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust")
- private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
- private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization;
-
- @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
- private List<CvnfcCustomization> cvnfcCustomization;
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
- .append("modelInstanceName", modelInstanceName).append("created", created)
- .append("minInstances", minInstances).append("maxInstances", maxInstances)
- .append("availabilityZoneMaxCount", availabilityZoneMaxCount).append("nfFunction", nfFunction)
- .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
- .append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources)
- .append("vfModuleCustomizations", vfModuleCustomizations)
- .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString();
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof VnfResourceCustomization)) {
- return false;
- }
- VnfResourceCustomization castOther = (VnfResourceCustomization) other;
- return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
- }
-
- @PrePersist
- protected void onCreate() {
- this.created = new Date();
- }
-
- public String getModelCustomizationUUID() {
- return modelCustomizationUUID;
- }
-
- public void setModelCustomizationUUID(String modelCustomizationUUID) {
- this.modelCustomizationUUID = modelCustomizationUUID;
- }
-
- public String getModelInstanceName() {
- return this.modelInstanceName;
- }
-
- public void setModelInstanceName(String modelInstanceName) {
- this.modelInstanceName = modelInstanceName;
- }
-
- public Date getCreationTimestamp() {
- return this.created;
- }
-
- public Integer getMinInstances() {
- return this.minInstances;
- }
-
- public void setMinInstances(Integer minInstances) {
- this.minInstances = minInstances;
- }
-
- public Integer getMaxInstances() {
- return this.maxInstances;
- }
-
- public void setMaxInstances(Integer maxInstances) {
- this.maxInstances = maxInstances;
- }
-
- public Integer getAvailabilityZoneMaxCount() {
- return this.availabilityZoneMaxCount;
- }
-
- public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) {
- this.availabilityZoneMaxCount = availabilityZoneMaxCount;
- }
-
- public String getNfFunction() {
- return nfFunction;
- }
-
- public void setNfFunction(String nfFunction) {
- this.nfFunction = nfFunction;
- }
-
- public String getNfType() {
- return nfType;
- }
-
- public void setNfType(String nfType) {
- this.nfType = nfType;
- }
-
- 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 this.multiStageDesign;
- }
-
- public void setMultiStageDesign(String multiStageDesign) {
- this.multiStageDesign = multiStageDesign;
- }
-
- @LinkedResource
- public List<VfModuleCustomization> getVfModuleCustomizations() {
- if (vfModuleCustomizations == null)
- vfModuleCustomizations = new ArrayList<>();
- return vfModuleCustomizations;
- }
-
- public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
- this.vfModuleCustomizations = vfModuleCustomizations;
- }
-
- @LinkedResource
- public VnfResource getVnfResources() {
- return vnfResources;
- }
-
- public void setVnfResources(VnfResource vnfResources) {
- this.vnfResources = vnfResources;
- }
-
- public Date getCreated() {
- return created;
- }
-
- @LinkedResource
- public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupCustomizations() {
- return vnfcInstanceGroupCustomizations;
- }
-
- public void setVnfcInstanceGroupCustomizations(
- List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
- this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations;
- }
-
- @LinkedResource
- public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() {
- if (vnfVfmoduleCvnfcConfigurationCustomization == null)
- vnfVfmoduleCvnfcConfigurationCustomization = new HashSet<>();
- return vnfVfmoduleCvnfcConfigurationCustomization;
- }
-
- public void setVnfVfmoduleCvnfcConfigurationCustomization(
- Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) {
- this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization;
- }
-
- @LinkedResource
- public List<CvnfcCustomization> getCvnfcCustomization() {
- return cvnfcCustomization;
- }
-
- public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
- this.cvnfcCustomization = cvnfcCustomization;
- }
-
- public String getResourceInput() {
- return resourceInput;
- }
-
- public void setResourceInput(String resourceInput) {
- this.resourceInput = resourceInput;
- }
+ private static final long serialVersionUID = 768026109321305392L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "MODEL_CUSTOMIZATION_UUID")
+ private String modelCustomizationUUID;
+
+ @Column(name = "MODEL_INSTANCE_NAME")
+ private String modelInstanceName;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ @Column(name = "MIN_INSTANCES")
+ private Integer minInstances;
+
+ @Column(name = "MAX_INSTANCES")
+ private Integer maxInstances;
+
+ @Column(name = "AVAILABILITY_ZONE_MAX_COUNT")
+ private Integer availabilityZoneMaxCount;
+
+ @Column(name = "NF_FUNCTION")
+ private String nfFunction;
+
+ @Column(name = "NF_TYPE")
+ private String nfType;
+
+ @Column(name = "NF_ROLE")
+ private String nfRole;
+
+ @Column(name = "NF_NAMING_CODE")
+ private String nfNamingCode;
+
+ @Column(name = "MULTI_STAGE_DESIGN")
+ private String multiStageDesign;
+
+ @Column(name = "RESOURCE_INPUT")
+ private String resourceInput;
+
+ @ManyToOne(cascade = CascadeType.ALL)
+ @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID")
+ private VnfResource vnfResources;
+
+ @OneToMany(cascade = CascadeType.ALL)
+ @JoinTable(name = "vnf_res_custom_to_vf_module_custom", joinColumns = @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID"), inverseJoinColumns = @JoinColumn(name = "VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID"))
+ private List<VfModuleCustomization> vfModuleCustomizations;
+
+ @OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust")
+ private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ private List<CvnfcCustomization> cvnfcCustomization;
+
+ @Column(name = "CDS_BLUEPRINT_NAME")
+ private String blueprintName;
+
+ @Column(name = "CDS_BLUEPRINT_VERSION")
+ private String blueprintVersion;
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
+ .append("modelInstanceName", modelInstanceName).append("created", created)
+ .append("minInstances", minInstances).append("maxInstances", maxInstances)
+ .append("availabilityZoneMaxCount", availabilityZoneMaxCount).append("nfFunction", nfFunction)
+ .append("nfType", nfType).append("nfRole", nfRole).append("nfNamingCode", nfNamingCode)
+ .append("multiStageDesign", multiStageDesign).append("vnfResources", vnfResources)
+ .append("vfModuleCustomizations", vfModuleCustomizations)
+ .append("vnfcInstanceGroupCustomizations", vnfcInstanceGroupCustomizations).toString();
+ }
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof VnfResourceCustomization)) {
+ return false;
+ }
+ VnfResourceCustomization castOther = (VnfResourceCustomization) other;
+ return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ public String getModelCustomizationUUID() {
+ return modelCustomizationUUID;
+ }
+
+ public void setModelCustomizationUUID(String modelCustomizationUUID) {
+ this.modelCustomizationUUID = modelCustomizationUUID;
+ }
+
+ public String getModelInstanceName() {
+ return this.modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public Date getCreationTimestamp() {
+ return this.created;
+ }
+
+ public Integer getMinInstances() {
+ return this.minInstances;
+ }
+
+ public void setMinInstances(Integer minInstances) {
+ this.minInstances = minInstances;
+ }
+
+ public Integer getMaxInstances() {
+ return this.maxInstances;
+ }
+
+ public void setMaxInstances(Integer maxInstances) {
+ this.maxInstances = maxInstances;
+ }
+
+ public Integer getAvailabilityZoneMaxCount() {
+ return this.availabilityZoneMaxCount;
+ }
+
+ public void setAvailabilityZoneMaxCount(Integer availabilityZoneMaxCount) {
+ this.availabilityZoneMaxCount = availabilityZoneMaxCount;
+ }
+
+ public String getNfFunction() {
+ return nfFunction;
+ }
+
+ public void setNfFunction(String nfFunction) {
+ this.nfFunction = nfFunction;
+ }
+
+ public String getNfType() {
+ return nfType;
+ }
+
+ public void setNfType(String nfType) {
+ this.nfType = nfType;
+ }
+
+ 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 this.multiStageDesign;
+ }
+
+ public void setMultiStageDesign(String multiStageDesign) {
+ this.multiStageDesign = multiStageDesign;
+ }
+
+ @LinkedResource
+ public List<VfModuleCustomization> getVfModuleCustomizations() {
+ if (vfModuleCustomizations == null) {
+ vfModuleCustomizations = new ArrayList<>();
+ }
+ return vfModuleCustomizations;
+ }
+
+ public void setVfModuleCustomizations(List<VfModuleCustomization> vfModuleCustomizations) {
+ this.vfModuleCustomizations = vfModuleCustomizations;
+ }
+
+ @LinkedResource
+ public VnfResource getVnfResources() {
+ return vnfResources;
+ }
+
+ public void setVnfResources(VnfResource vnfResources) {
+ this.vnfResources = vnfResources;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ @LinkedResource
+ public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupCustomizations() {
+ return vnfcInstanceGroupCustomizations;
+ }
+
+ public void setVnfcInstanceGroupCustomizations(
+ List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
+ this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations;
+ }
+
+ @LinkedResource
+ public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() {
+ if (vnfVfmoduleCvnfcConfigurationCustomization == null) {
+ vnfVfmoduleCvnfcConfigurationCustomization = new HashSet<>();
+ }
+ return vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ public void setVnfVfmoduleCvnfcConfigurationCustomization(
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) {
+ this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ @LinkedResource
+ public List<CvnfcCustomization> getCvnfcCustomization() {
+ return cvnfcCustomization;
+ }
+
+ public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
+ this.cvnfcCustomization = cvnfcCustomization;
+ }
+
+ public String getResourceInput() {
+ return resourceInput;
+ }
+
+ public void setResourceInput(String resourceInput) {
+ this.resourceInput = resourceInput;
+ }
+
+
+ public String getBlueprintName() {
+ return blueprintName;
+ }
+
+ public void setBlueprintName(String blueprintName) {
+ this.blueprintName = blueprintName;
+ }
+
+ public String getBlueprintVersion() {
+ return blueprintVersion;
+ }
+
+ public void setBlueprintVersion(String blueprintVersion) {
+ this.blueprintVersion = blueprintVersion;
+ }
+
}
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 ac123b280d..b79ffedf83 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
@@ -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.
@@ -24,10 +24,8 @@ import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
import javax.annotation.PostConstruct;
import javax.ws.rs.core.UriBuilder;
-
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -44,6 +42,8 @@ import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationAction;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.ResourceType;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
@@ -65,7 +65,6 @@ import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
-
import uk.co.blackpepper.bowman.Client;
import uk.co.blackpepper.bowman.ClientFactory;
import uk.co.blackpepper.bowman.Configuration;
@@ -73,633 +72,716 @@ import uk.co.blackpepper.bowman.Configuration;
@Component("CatalogDbClient")
public class CatalogDbClient {
- private static final String CLOUD_SITE = "/cloudSite";
- private static final String CLOUDIFY_MANAGER = "/cloudifyManager";
- 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";
- private static final String COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION = "/collectionResourceInstanceGroupCustomization";
- private static final String VNFC_INSTANCE_GROUP_CUSTOMIZATION = "/vnfcInstanceGroupCustomization";
- private static final String ORCHESTRATION_FLOW = "/orchestrationFlow";
- private static final String ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE = "/orchestrationStatusStateTransitionDirective";
- private static final String INSTANCE_GROUP = "/instanceGroup";
- private static final String COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION = "/collectionNetworkResourceCustomization";
- private static final String BUILDING_BLOCK_DETAIL = "/buildingBlockDetail";
- private static final String NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION = "/networkCollectionResourceCustomization";
- private static final String VNF_RESOURCE_CUSTOMIZATION = "/vnfResourceCustomization";
- private static final String SERVICE = "/service";
- private static final String EXTERNAL_SERVICE_TO_INTERNAL_MODEL_MAPPING = "/externalServiceToInternalService";
- private static final String VNF_RESOURCE = "/vnfResource";
- private static final String VNF_RECIPE = "/vnfRecipe";
- private static final String VFMODULE = "/vfModule";
- private static final String VFMODULE_CUSTOMIZATION = "/vfModuleCustomization";
- private static final String VNF_COMPONENTS_RECIPE = "/vnfComponentsRecipe";
- private static final String SERVICE_RECIPE = "/serviceRecipe";
- private static final String NETWORK_RECIPE = "/networkRecipe";
-
- private static final String SEARCH = "/search";
- private static final String URI_SEPARATOR = "/";
-
- private static final String SERVICE_MODEL_UUID = "serviceModelUUID";
- private static final String SERVICE_NAME = "serviceName";
- private static final String MODEL_UUID = "modelUUID";
- private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID";
- private static final String ACTION = "action";
- 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";
- private static final String VNF_COMPONENT_TYPE = "vnfComponentType";
- private static final String BUILDING_BLOCK_NAME = "buildingBlockName";
- private static final String RESOURCE_TYPE = "resourceType";
- private static final String ORCHESTRATION_STATUS = "orchestrationStatus";
- private static final String TARGET_ACTION = "targetAction";
- private static final String REQUEST_SCOPE = "requestScope";
- 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 SERVICE_TYPE = "serviceType";
- private static final String VNF_TYPE = "vnfType";
- private static final String ERROR_CODE = "errorCode";
- private static final String WORK_STEP = "workStep";
- private static final String CLLI = "clli";
- private static final String CLOUD_VERSION = "cloudVersion";
- private static final String HOMING_INSTANCE = "/homingInstance";
-
- private static final String TARGET_ENTITY = "SO:CatalogDB";
- private static final String ASTERISK = "*";
-
- private String findExternalToInternalServiceByServiceName = "/findByServiceName";
- private String findServiceByModelName = "/findOneByModelName";
- private String findServiceRecipeByActionAndServiceModelUUID = "/findByActionAndServiceModelUUID";
- private String findServiceByModelUUID = "/findOneByModelUUID";
- private String findFirstByModelNameURI = "/findFirstByModelNameOrderByModelVersionDesc";
- private String findFirstByServiceModelUUIDAndActionURI = "/findFirstByServiceModelUUIDAndAction";
- private String findFirstByModelVersionAndModelInvariantUUIDURI = "/findFirstByModelVersionAndModelInvariantUUID";
- private String findByModelInvariantUUIDURI = "/findByModelInvariantUUIDOrderByModelVersionDesc";
- private String findFirstByModelNameAndAction = "/findFirstByModelNameAndAction";
- private String findFirstResourceByModelInvariantUUIDAndModelVersion = "/findFirstResourceByModelInvariantUUIDAndModelVersion";
- private String findByModelInstanceNameAndVnfResources = "/findByModelInstanceNameAndVnfResources";
- private String findFirstVnfRecipeByNfRoleAndAction = "/findFirstVnfRecipeByNfRoleAndAction";
- private String findByModelCustomizationUUIDAndVfModuleModelUUID = "/findByModelCustomizationUUIDAndVfModuleModelUUID";
- private String findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction";
- private String findFirstVnfComponentsRecipeByVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVnfComponentTypeAndAction";
- private String findVfModuleByModelInvariantUUIDOrderByModelVersionDesc = "/findByModelInvariantUUIDOrderByModelVersionDesc";
- private String findFirstVfModuleByModelInvariantUUIDAndModelVersion = "/findFirstVfModuleByModelInvariantUUIDAndModelVersion";
- private String findOneByBuildingBlockName = "/findOneByBuildingBlockName";
- private String findOneByResourceTypeAndOrchestrationStatusAndTargetAction = "/findOneByResourceTypeAndOrchestrationStatusAndTargetAction";
- private String findByAction = "/findByAction";
- private String findVnfcInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
- private String findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
- private String findOneByActionAndRequestScopeAndIsAlacarte = "/findOneByActionAndRequestScopeAndIsAlacarte";
- private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner";
- private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType";
- private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep";
- private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
- private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId";
-
-
- 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;
- private String cloudSiteURI;
- private String homingInstanceURI;
-
- private final Client<Service> serviceClient;
-
- private final Client<NetworkRecipe> networkRecipeClient;
-
- private final Client<NetworkResourceCustomization> networkResourceCustomizationClient;
-
- private final Client<VnfResource> vnfResourceClient;
-
- private final Client<VnfResourceCustomization> vnfResourceCustomizationClient;
-
- private final Client<VnfRecipe> vnfRecipeClient;
-
- private final Client<VfModuleCustomization> vfModuleCustomizationClient;
-
- private final Client<VfModule> vfModuleClient;
-
- private final Client<VnfComponentsRecipe> vnfComponentsRecipeClient;
-
- private final Client<OrchestrationFlow> orchestrationClient;
-
- private final Client<NorthBoundRequest> northBoundRequestClient;
-
- private final Client<RainyDayHandlerStatus> rainyDayHandlerStatusClient;
-
- private final Client<BuildingBlockDetail> buildingBlockDetailClient;
-
- private final Client<OrchestrationStatusStateTransitionDirective> orchestrationStatusStateTransitionDirectiveClient;
-
- private final Client<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizationClient;
-
- private final Client<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationClient;
-
- private final Client<InstanceGroup> instanceGroupClient;
-
- private final Client<NetworkCollectionResourceCustomization> networkCollectionResourceCustomizationClient;
-
- private final Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient;
-
- private final Client<ServiceRecipe> serviceRecipeClient;
-
- private final Client<ExternalServiceToInternalService> externalServiceToInternalServiceClient;
-
- private final Client<CloudSite> cloudSiteClient;
-
- private final Client<HomingInstance> homingInstanceClient;
-
- private final Client<CloudifyManager> cloudifyManagerClient;
-
- private final Client<CvnfcCustomization> cvnfcCustomizationClient;
-
- private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
-
- @Value("${mso.catalog.db.spring.endpoint}")
- private String endpoint;
-
- @Value("${mso.db.auth}")
- private String msoAdaptersAuth;
-
-
- @PostConstruct
- public void init(){
- findExternalToInternalServiceByServiceName = endpoint + EXTERNAL_SERVICE_TO_INTERNAL_MODEL_MAPPING + SEARCH + findExternalToInternalServiceByServiceName;
- findServiceByModelName = endpoint + SERVICE + SEARCH + findServiceByModelName;
- findServiceRecipeByActionAndServiceModelUUID = endpoint + SERVICE_RECIPE + SEARCH + findServiceRecipeByActionAndServiceModelUUID;
- findServiceByModelUUID = endpoint + SERVICE + SEARCH + findServiceByModelUUID;
- findFirstByModelNameURI = endpoint + SERVICE + SEARCH + findFirstByModelNameURI;
- findFirstByModelVersionAndModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findFirstByModelVersionAndModelInvariantUUIDURI;
- findByModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findByModelInvariantUUIDURI;
- findFirstByServiceModelUUIDAndActionURI = endpoint + SERVICE_RECIPE + SEARCH + findFirstByServiceModelUUIDAndActionURI;
- findFirstByModelNameAndAction = endpoint + NETWORK_RECIPE + SEARCH + findFirstByModelNameAndAction;
- findFirstResourceByModelInvariantUUIDAndModelVersion = endpoint + VNF_RESOURCE + SEARCH + findFirstResourceByModelInvariantUUIDAndModelVersion;
- findByModelInstanceNameAndVnfResources = endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findByModelInstanceNameAndVnfResources;
- findFirstVnfRecipeByNfRoleAndAction = endpoint + VNF_RECIPE + SEARCH + findFirstVnfRecipeByNfRoleAndAction;
- findByModelCustomizationUUIDAndVfModuleModelUUID = endpoint + VFMODULE_CUSTOMIZATION + SEARCH + findByModelCustomizationUUIDAndVfModuleModelUUID;
- findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction = endpoint + VNF_COMPONENTS_RECIPE + SEARCH + findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction;
- findFirstVnfComponentsRecipeByVnfComponentTypeAndAction = endpoint + VNF_COMPONENTS_RECIPE + SEARCH + findFirstVnfComponentsRecipeByVnfComponentTypeAndAction;
- findVfModuleByModelInvariantUUIDOrderByModelVersionDesc = endpoint + VFMODULE + SEARCH +findVfModuleByModelInvariantUUIDOrderByModelVersionDesc;
- findFirstVfModuleByModelInvariantUUIDAndModelVersion = endpoint + VFMODULE + SEARCH + findFirstVfModuleByModelInvariantUUIDAndModelVersion;
- findOneByBuildingBlockName = endpoint + BUILDING_BLOCK_DETAIL + SEARCH + findOneByBuildingBlockName;
- findOneByResourceTypeAndOrchestrationStatusAndTargetAction = endpoint + ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE + SEARCH + findOneByResourceTypeAndOrchestrationStatusAndTargetAction;
- findByAction = endpoint + ORCHESTRATION_FLOW + SEARCH + findByAction;
- findVnfcInstanceGroupCustomizationByModelCustomizationUUID = endpoint + VNFC_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findVnfcInstanceGroupCustomizationByModelCustomizationUUID;
- findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = endpoint + COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID;
- findOneByActionAndRequestScopeAndIsAlacarte = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarte;
- findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner;
- findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType;
- findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep;
- findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion;
-
- 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;
- vnfResourceCustomizationURI = endpoint + VNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
- collectionNetworkResourceCustomizationURI = endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
- instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
- cloudifyManagerURI = endpoint + CLOUDIFY_MANAGER + URI_SEPARATOR;
- cloudSiteURI = endpoint + CLOUD_SITE + URI_SEPARATOR;
- homingInstanceURI = endpoint + HOMING_INSTANCE + URI_SEPARATOR;
-
- }
-
- public CatalogDbClient() {
- ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory());
-
- ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
-
- restTemplate.getInterceptors().add((request, body, execution) -> {
-
- request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
- request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER,TARGET_ENTITY);
- return execution.execute(request, body);
- });
- }).build().buildClientFactory();
- serviceClient = clientFactory.create(Service.class);
- networkRecipeClient = clientFactory.create(NetworkRecipe.class);
- networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
- vnfResourceClient = clientFactory.create(VnfResource.class);
- vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
- vnfRecipeClient = clientFactory.create(VnfRecipe.class);
- orchestrationClient = clientFactory.create(OrchestrationFlow.class);
- vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
- vfModuleClient = clientFactory.create(VfModule.class);
- vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
- northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
- rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
- buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
- orchestrationStatusStateTransitionDirectiveClient = clientFactory
- .create(OrchestrationStatusStateTransitionDirective.class);
- vnfcInstanceGroupCustomizationClient = clientFactory.create(VnfcInstanceGroupCustomization.class);
- collectionResourceInstanceGroupCustomizationClient = clientFactory
- .create(CollectionResourceInstanceGroupCustomization.class);
- instanceGroupClient = clientFactory.create(InstanceGroup.class);
- networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
- collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
- cloudSiteClient = clientFactory.create(CloudSite.class);
- 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);
- }
-
- public CatalogDbClient(String baseUri, String auth) {
- ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory());
-
- ClientFactory clientFactory = Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
-
- restTemplate.getInterceptors().add((request, body, execution) -> {
-
- request.getHeaders().add(HttpHeaders.AUTHORIZATION, auth);
- request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER,TARGET_ENTITY);
- return execution.execute(request, body);
- });
- }).build().buildClientFactory();
- serviceClient = clientFactory.create(Service.class);
- networkRecipeClient = clientFactory.create(NetworkRecipe.class);
- networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
- vnfResourceClient = clientFactory.create(VnfResource.class);
- vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
- vnfRecipeClient = clientFactory.create(VnfRecipe.class);
- orchestrationClient = clientFactory.create(OrchestrationFlow.class);
- vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
- vfModuleClient = clientFactory.create(VfModule.class);
- vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
- northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
- rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
- buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
- orchestrationStatusStateTransitionDirectiveClient = clientFactory
- .create(OrchestrationStatusStateTransitionDirective.class);
- vnfcInstanceGroupCustomizationClient = clientFactory.create(VnfcInstanceGroupCustomization.class);
- collectionResourceInstanceGroupCustomizationClient = clientFactory
- .create(CollectionResourceInstanceGroupCustomization.class);
- instanceGroupClient = clientFactory.create(InstanceGroup.class);
- networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
- collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
- cloudSiteClient = clientFactory.create(CloudSite.class);
- 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);
- }
-
- public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) {
- NetworkCollectionResourceCustomization networkCollectionResourceCustomization =
- this.getSingleResource(networkCollectionResourceCustomizationClient, getUri(networkCollectionResourceCustomizationURI + modelCustomizationUUID));
- if (networkCollectionResourceCustomization != null) {
- networkCollectionResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return networkCollectionResourceCustomization;
- }
-
- public Service getServiceByID(String modelUUID) {
- Service service = getSingleResource(serviceClient,getUri(serviceURI + modelUUID));
- if (service != null) {
- service.setModelUUID(modelUUID);
- }
- return service;
- }
-
- public VfModule getVfModuleByModelUUID(String modelUUID) {
- VfModule vfModule = getSingleResource(vfModuleClient,getUri(vfModuleURI + modelUUID));
- if (vfModule != null) {
- vfModule.setModelUUID(modelUUID);
- }
- return vfModule;
- }
-
- public VnfResource getVnfResourceByModelUUID(String modelUUID){
-
- VnfResource vnfResource = this.getSingleResource(vnfResourceClient, getUri(vnfResourceURI + modelUUID));
- if (vnfResource != null) {
- vnfResource.setModelUUID(modelUUID);
- }
- return vnfResource;
- }
-
- public VnfResourceCustomization getVnfResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID){
- VnfResourceCustomization vnfResourceCustomization = getSingleResource(vnfResourceCustomizationClient, getUri(vnfResourceCustomizationURI + modelCustomizationUUID));
- if (vnfResourceCustomization != null) {
- vnfResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return vnfResourceCustomization;
- }
-
- public CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomizationByID(String modelCustomizationUUID) {
- CollectionNetworkResourceCustomization collectionNetworkResourceCustomization =
- this.getSingleResource(collectionNetworkResourceCustomizationClient,getUri(UriBuilder
- .fromUri(collectionNetworkResourceCustomizationURI + modelCustomizationUUID).build().toString()));
- if (collectionNetworkResourceCustomization != null) {
- collectionNetworkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return collectionNetworkResourceCustomization;
- }
-
- public InstanceGroup getInstanceGroupByModelUUID(String modelUUID) {
- InstanceGroup instanceGroup = this.getSingleResource(instanceGroupClient, getUri(instanceGroupURI + modelUUID));
- if (instanceGroup != null) {
- instanceGroup.setModelUUID(modelUUID);
- }
- return instanceGroup;
- }
-
- public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
- VfModuleCustomization vfModuleCust = this.getSingleResource(vfModuleCustomizationClient, getUri(vfModuleCustomizationURI + modelCustomizationUUID));
- if (vfModuleCust != null) {
- vfModuleCust.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return vfModuleCust;
- }
-
- public NetworkResourceCustomization getNetworkResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID){
- NetworkResourceCustomization networkResourceCustomization =
- this.getSingleResource(networkResourceCustomizationClient, getUri(networkResourceCustomizationURI + modelCustomizationUUID));
- if (networkResourceCustomization != null) {
- networkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return networkResourceCustomization;
- }
-
- public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
- BuildingBlockDetail buildingBlockDetail = getSingleResource(buildingBlockDetailClient, getUri(UriBuilder
- .fromUri(findOneByBuildingBlockName).queryParam(BUILDING_BLOCK_NAME, buildingBlockName).build().toString()));
- if (buildingBlockDetail != null) {
- buildingBlockDetail.setBuildingBlockName(buildingBlockName);
- }
- return buildingBlockDetail;
- }
-
-
- public OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective(
- ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction) {
- return getSingleResource(orchestrationStatusStateTransitionDirectiveClient, UriBuilder
- .fromUri(findOneByResourceTypeAndOrchestrationStatusAndTargetAction)
- .queryParam(RESOURCE_TYPE, resourceType.name())
- .queryParam(ORCHESTRATION_STATUS, orchestrationStatus.name())
- .queryParam(TARGET_ACTION, targetAction.name()).build());
- }
-
- public List<OrchestrationFlow> getOrchestrationFlowByAction(String action) {
- return this.getMultipleResources(orchestrationClient, UriBuilder
- .fromUri(findByAction).queryParam(ACTION, action).build());
- }
-
- public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupsByVnfResourceCust(String modelCustomizationUUID) {
- return this.getMultipleResources(vnfcInstanceGroupCustomizationClient, UriBuilder
- .fromUri(findVnfcInstanceGroupCustomizationByModelCustomizationUUID)
- .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
- }
-
- public List<CollectionResourceInstanceGroupCustomization> getCollectionResourceInstanceGroupCustomizationByModelCustUUID(
- String modelCustomizationUUID) {
- return this.getMultipleResources(collectionResourceInstanceGroupCustomizationClient, UriBuilder
- .fromUri(findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID)
- .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
- }
-
- public VfModuleCustomization getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(String modelCustomizationUUID, String vfModuleModelUUID) {
- return this.getSingleResource(vfModuleCustomizationClient, getUri(UriBuilder
- .fromUri(findByModelCustomizationUUIDAndVfModuleModelUUID)
- .queryParam(MODEL_CUSTOMIZATION_UUID,modelCustomizationUUID)
- .queryParam(VF_MODULE_MODEL_UUID,vfModuleModelUUID).build().toString()));
- }
-
- public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(String requestAction,
- String resourceName, boolean aLaCarte) {
- return this.getSingleResource(northBoundRequestClient, UriBuilder
- .fromUri(findOneByActionAndRequestScopeAndIsAlacarte)
- .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
- .queryParam(IS_ALACARTE, aLaCarte).build());
- }
-
- public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String requestAction,
- String resourceName, boolean aLaCarte, String cloudOwner) {
- return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder
- .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType)
- .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
- .queryParam(IS_ALACARTE, aLaCarte)
- .queryParam(CLOUD_OWNER, cloudOwner)
- .queryParam(SERVICE_TYPE, ASTERISK).build().toString()));
- }
-
- public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(String requestAction,
- String resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
- return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder
- .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType)
- .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
- .queryParam(IS_ALACARTE, aLaCarte)
- .queryParam(CLOUD_OWNER, cloudOwner)
- .queryParam(SERVICE_TYPE, serviceType).build().toString()));
- }
-
- public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- String flowName, String serviceType, String vnfType, String errorCode, String workStep) {
- return this.getSingleResource(rainyDayHandlerStatusClient, getUri(UriBuilder
- .fromUri(findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep)
- .queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
- .queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
- .build().toString()));
- }
-
- public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action){
- return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder
- .fromUri(findFirstByServiceModelUUIDAndActionURI)
- .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());
- }
-
- public ControllerSelectionReference getControllerSelectionReferenceByVnfTypeAndActionCategory(String vnfType, String actionCategory) {
- return this.getSingleResource(controllerSelectionReferenceClient, UriBuilder
- .fromUri(endpoint + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfTypeAndActionCategory")
- .queryParam("VNF_TYPE", vnfType).queryParam("ACTION_CATEGORY", actionCategory).build());
- }
-
- public Service getFirstByModelNameOrderByModelVersionDesc(String modelName){
- return this.getSingleResource(serviceClient,UriBuilder
- .fromUri(findFirstByModelNameURI)
- .queryParam(MODEL_NAME,modelName).build());
- }
-
- public ExternalServiceToInternalService findExternalToInternalServiceByServiceName(String serviceName){
- return this.getSingleResource(externalServiceToInternalServiceClient, getUri(UriBuilder
- .fromUri(findExternalToInternalServiceByServiceName)
- .queryParam(SERVICE_NAME,serviceName).build().toString()));
- }
-
- public ServiceRecipe findServiceRecipeByActionAndServiceModelUUID(String action,String modelUUID){
- return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder
- .fromUri(findServiceRecipeByActionAndServiceModelUUID)
- .queryParam(ACTION,action)
- .queryParam(SERVICE_MODEL_UUID,modelUUID).build().toString()));
- }
-
- public Service getServiceByModelName(String modelName){
- return this.getSingleResource(serviceClient,getUri(UriBuilder
- .fromUri(findServiceByModelName)
- .queryParam(MODEL_NAME,modelName).build().toString()));
- }
-
- public Service getServiceByModelUUID(String modelModelUUID){
- return this.getSingleResource(serviceClient,getUri(UriBuilder
- .fromUri(findServiceByModelUUID)
- .queryParam(MODEL_UUID,modelModelUUID).build().toString()));
- }
-
- public VnfResource getFirstVnfResourceByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion){
- return this.getSingleResource(vnfResourceClient, getUri(UriBuilder
- .fromUri(findFirstResourceByModelInvariantUUIDAndModelVersion)
- .queryParam(MODEL_INVARIANT_UUID,modelInvariantUUID)
- .queryParam(MODEL_VERSION,modelVersion).build().toString()));
- }
-
-
- public VnfResourceCustomization getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(String modelInstanceName, VnfResource vnfResource){
- return this.getSingleResource(vnfResourceCustomizationClient, getUri(UriBuilder
- .fromUri(findByModelInstanceNameAndVnfResources)
- .queryParam(MODEL_INSTANCE_NAME,modelInstanceName)
- .queryParam(VNF_RESOURCE_MODEL_UUID,vnfResource.getModelUUID()).build().toString()));
- }
-
- public VnfRecipe getFirstVnfRecipeByNfRoleAndAction(String nfRole, String action){
- return this.getSingleResource(vnfRecipeClient,getUri(UriBuilder
- .fromUri(findFirstVnfRecipeByNfRoleAndAction)
- .queryParam(NF_ROLE,nfRole)
- .queryParam(ACTION,action).build().toString()));
- }
-
- public VnfComponentsRecipe getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(String vfModuleModelUUID, String vnfComponentType, 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()));
- }
-
- public VnfComponentsRecipe getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType, String action) {
- return this.getSingleResource(vnfComponentsRecipeClient,getUri(UriBuilder
- .fromUri(findFirstVnfComponentsRecipeByVnfComponentTypeAndAction)
- .queryParam(VNF_COMPONENT_TYPE,vnfComponentType)
- .queryParam(ACTION,action).build().toString()));
- }
- protected URI getUri(String template){
- return URI.create(template);
- }
-
- public CloudifyManager getCloudifyManager(String id) {
- return this.getSingleResource(cloudifyManagerClient,getUri(cloudifyManagerURI + id));
- }
-
- public CloudSite getCloudSite(String id){
- return this.getSingleResource(cloudSiteClient,
- getUri(cloudSiteURI + id));
- }
-
- public CloudSite getCloudSite(String id, String uri){
- return this.getSingleResource(cloudSiteClient,
- getUri(uri + id));
- }
-
- public void postCloudSite(CloudSite cloudSite){
- this.postSingleResource(cloudSiteClient, cloudSite);
- }
-
- public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){
- return this.getSingleResource(cloudSiteClient, getUri(UriBuilder
- .fromUri(findByClliAndCloudVersion)
- .queryParam(CLLI,clli).queryParam(CLOUD_VERSION,cloudVersion).build().toString()));
- }
-
- public HomingInstance getHomingInstance (String serviceInstanceId){
- return this.getSingleResource(homingInstanceClient,
- getUri(homingInstanceURI + serviceInstanceId));
- }
-
- public HomingInstance getHomingInstance (String serviceInstanceId, String uri){
- return this.getSingleResource(homingInstanceClient,
- getUri(uri + serviceInstanceId));
- }
-
- public void postHomingInstance(HomingInstance homingInstance){
- this.postSingleResource(homingInstanceClient, homingInstance);
- }
-
- public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
- return this.getSingleResource(serviceClient, getUri(UriBuilder
- .fromUri(findFirstByModelVersionAndModelInvariantUUIDURI)
- .queryParam(MODEL_VERSION, modelVersion)
- .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
- }
-
- public VfModule getVfModuleByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion){
- return this.getSingleResource(vfModuleClient,getUri(UriBuilder
- .fromUri(findFirstVfModuleByModelInvariantUUIDAndModelVersion)
- .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID)
- .queryParam(MODEL_VERSION, modelVersion).build().toString()));
- }
-
- public List<Service> getServiceByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
- return this.getMultipleResources(serviceClient, getUri(UriBuilder
- .fromUri(findByModelInvariantUUIDURI)
- .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
- }
-
- public List<VfModule> getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
- return this.getMultipleResources(vfModuleClient, getUri(UriBuilder
- .fromUri(findVfModuleByModelInvariantUUIDOrderByModelVersionDesc)
- .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
- }
-
- private <T> T getSingleResource(Client<T> client, URI uri) {
- return client.get(uri);
- }
-
- private <T> List<T> getMultipleResources(Client<T> client, URI uri) {
- Iterable<T> iterator = client.getAll(uri);
- List<T> list = new ArrayList<>();
- Iterator<T> it = iterator.iterator();
- it.forEachRemaining(list::add);
- return list;
- }
-
- private <T> URI postSingleResource(Client<T> client, T type){
- return client.post(type);
- }
-
- public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(String vnfCustomizationUUID, String vfModuleCustomizationUUID){
-
- return this.getMultipleResources(cvnfcCustomizationClient,getUri(UriBuilder
- .fromUri(endpoint + "/cvnfcCustomization/search/findByVnfResourceCustomizationAndVfModuleCustomization")
- .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUUID)
- .queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString()));
- }
+ private static final String CLOUD_SITE = "/cloudSite";
+ private static final String CLOUDIFY_MANAGER = "/cloudifyManager";
+ 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";
+ private static final String COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION = "/collectionResourceInstanceGroupCustomization";
+ private static final String VNFC_INSTANCE_GROUP_CUSTOMIZATION = "/vnfcInstanceGroupCustomization";
+ private static final String ORCHESTRATION_FLOW = "/orchestrationFlow";
+ private static final String ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE = "/orchestrationStatusStateTransitionDirective";
+ private static final String INSTANCE_GROUP = "/instanceGroup";
+ private static final String COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION = "/collectionNetworkResourceCustomization";
+ private static final String BUILDING_BLOCK_DETAIL = "/buildingBlockDetail";
+ private static final String NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION = "/networkCollectionResourceCustomization";
+ private static final String VNF_RESOURCE_CUSTOMIZATION = "/vnfResourceCustomization";
+ private static final String SERVICE = "/service";
+ private static final String EXTERNAL_SERVICE_TO_INTERNAL_MODEL_MAPPING = "/externalServiceToInternalService";
+ private static final String VNF_RESOURCE = "/vnfResource";
+ private static final String VNF_RECIPE = "/vnfRecipe";
+ private static final String VFMODULE = "/vfModule";
+ private static final String VFMODULE_CUSTOMIZATION = "/vfModuleCustomization";
+ private static final String VNF_COMPONENTS_RECIPE = "/vnfComponentsRecipe";
+ private static final String SERVICE_RECIPE = "/serviceRecipe";
+ private static final String NETWORK_RECIPE = "/networkRecipe";
+ private static final String PNF_RESOURCE = "/pnfResource";
+ private static final String PNF_RESOURCE_CUSTOMIZATION = "/pnfResourceCustomization";
+
+
+ private static final String SEARCH = "/search";
+ private static final String URI_SEPARATOR = "/";
+
+ private static final String SERVICE_MODEL_UUID = "serviceModelUUID";
+ private static final String SERVICE_NAME = "serviceName";
+ private static final String MODEL_UUID = "modelUUID";
+ private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID";
+ private static final String ACTION = "action";
+ 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";
+ private static final String VNF_COMPONENT_TYPE = "vnfComponentType";
+ private static final String BUILDING_BLOCK_NAME = "buildingBlockName";
+ private static final String RESOURCE_TYPE = "resourceType";
+ private static final String ORCHESTRATION_STATUS = "orchestrationStatus";
+ private static final String TARGET_ACTION = "targetAction";
+ private static final String REQUEST_SCOPE = "requestScope";
+ 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 SERVICE_TYPE = "serviceType";
+ private static final String VNF_TYPE = "vnfType";
+ private static final String ERROR_CODE = "errorCode";
+ private static final String WORK_STEP = "workStep";
+ private static final String CLLI = "clli";
+ private static final String CLOUD_VERSION = "cloudVersion";
+ private static final String HOMING_INSTANCE = "/homingInstance";
+
+ private static final String TARGET_ENTITY = "SO:CatalogDB";
+ private static final String ASTERISK = "*";
+
+ private String findExternalToInternalServiceByServiceName = "/findByServiceName";
+ private String findServiceByModelName = "/findOneByModelName";
+ private String findServiceRecipeByActionAndServiceModelUUID = "/findByActionAndServiceModelUUID";
+ private String findServiceByModelUUID = "/findOneByModelUUID";
+ private String findFirstByModelNameURI = "/findFirstByModelNameOrderByModelVersionDesc";
+ private String findFirstByServiceModelUUIDAndActionURI = "/findFirstByServiceModelUUIDAndAction";
+ private String findFirstByModelVersionAndModelInvariantUUIDURI = "/findFirstByModelVersionAndModelInvariantUUID";
+ private String findByModelInvariantUUIDURI = "/findByModelInvariantUUIDOrderByModelVersionDesc";
+ private String findFirstByModelNameAndAction = "/findFirstByModelNameAndAction";
+ private String findFirstResourceByModelInvariantUUIDAndModelVersion = "/findFirstResourceByModelInvariantUUIDAndModelVersion";
+ private String findByModelInstanceNameAndVnfResources = "/findByModelInstanceNameAndVnfResources";
+ private String findFirstVnfRecipeByNfRoleAndAction = "/findFirstVnfRecipeByNfRoleAndAction";
+ private String findByModelCustomizationUUIDAndVfModuleModelUUID = "/findByModelCustomizationUUIDAndVfModuleModelUUID";
+ private String findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction";
+ private String findFirstVnfComponentsRecipeByVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVnfComponentTypeAndAction";
+ private String findVfModuleByModelInvariantUUIDOrderByModelVersionDesc = "/findByModelInvariantUUIDOrderByModelVersionDesc";
+ private String findFirstVfModuleByModelInvariantUUIDAndModelVersion = "/findFirstVfModuleByModelInvariantUUIDAndModelVersion";
+ private String findOneByBuildingBlockName = "/findOneByBuildingBlockName";
+ private String findOneByResourceTypeAndOrchestrationStatusAndTargetAction = "/findOneByResourceTypeAndOrchestrationStatusAndTargetAction";
+ private String findByAction = "/findByAction";
+ private String findVnfcInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
+ private String findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
+ private String findOneByActionAndRequestScopeAndIsAlacarte = "/findOneByActionAndRequestScopeAndIsAlacarte";
+ private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner";
+ private String findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType = "/findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType";
+ private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep";
+ private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
+ private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId";
+
+
+ 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;
+ private String cloudSiteURI;
+ private String homingInstanceURI;
+ private String pnfResourceURI;
+ private String pnfResourceCustomizationURI;
+
+ private final Client<Service> serviceClient;
+
+ private final Client<NetworkRecipe> networkRecipeClient;
+
+ private final Client<NetworkResourceCustomization> networkResourceCustomizationClient;
+
+ private final Client<VnfResource> vnfResourceClient;
+
+ private final Client<VnfResourceCustomization> vnfResourceCustomizationClient;
+
+ private final Client<VnfRecipe> vnfRecipeClient;
+
+ private final Client<VfModuleCustomization> vfModuleCustomizationClient;
+
+ private final Client<VfModule> vfModuleClient;
+
+ private final Client<VnfComponentsRecipe> vnfComponentsRecipeClient;
+
+ private final Client<OrchestrationFlow> orchestrationClient;
+
+ private final Client<NorthBoundRequest> northBoundRequestClient;
+
+ private final Client<RainyDayHandlerStatus> rainyDayHandlerStatusClient;
+
+ private final Client<BuildingBlockDetail> buildingBlockDetailClient;
+
+ private final Client<OrchestrationStatusStateTransitionDirective> orchestrationStatusStateTransitionDirectiveClient;
+
+ private final Client<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizationClient;
+
+ private final Client<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationClient;
+
+ private final Client<InstanceGroup> instanceGroupClient;
+
+ private final Client<NetworkCollectionResourceCustomization> networkCollectionResourceCustomizationClient;
+
+ private final Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient;
+
+ private final Client<ServiceRecipe> serviceRecipeClient;
+
+ private final Client<ExternalServiceToInternalService> externalServiceToInternalServiceClient;
+
+ private final Client<CloudSite> cloudSiteClient;
+
+ private final Client<HomingInstance> homingInstanceClient;
+
+ private final Client<CloudifyManager> cloudifyManagerClient;
+
+ private final Client<CvnfcCustomization> cvnfcCustomizationClient;
+
+ private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
+
+ private final Client<PnfResource> pnfResourceClient;
+
+ private final Client<PnfResourceCustomization> pnfResourceCustomizationClient;
+
+ @Value("${mso.catalog.db.spring.endpoint}")
+ private String endpoint;
+
+ @Value("${mso.db.auth}")
+ private String msoAdaptersAuth;
+
+
+ @PostConstruct
+ public void init() {
+ findExternalToInternalServiceByServiceName =
+ endpoint + EXTERNAL_SERVICE_TO_INTERNAL_MODEL_MAPPING + SEARCH + findExternalToInternalServiceByServiceName;
+ findServiceByModelName = endpoint + SERVICE + SEARCH + findServiceByModelName;
+ findServiceRecipeByActionAndServiceModelUUID =
+ endpoint + SERVICE_RECIPE + SEARCH + findServiceRecipeByActionAndServiceModelUUID;
+ findServiceByModelUUID = endpoint + SERVICE + SEARCH + findServiceByModelUUID;
+ findFirstByModelNameURI = endpoint + SERVICE + SEARCH + findFirstByModelNameURI;
+ findFirstByModelVersionAndModelInvariantUUIDURI =
+ endpoint + SERVICE + SEARCH + findFirstByModelVersionAndModelInvariantUUIDURI;
+ findByModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findByModelInvariantUUIDURI;
+ findFirstByServiceModelUUIDAndActionURI =
+ endpoint + SERVICE_RECIPE + SEARCH + findFirstByServiceModelUUIDAndActionURI;
+ findFirstByModelNameAndAction = endpoint + NETWORK_RECIPE + SEARCH + findFirstByModelNameAndAction;
+ findFirstResourceByModelInvariantUUIDAndModelVersion =
+ endpoint + VNF_RESOURCE + SEARCH + findFirstResourceByModelInvariantUUIDAndModelVersion;
+ findByModelInstanceNameAndVnfResources =
+ endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findByModelInstanceNameAndVnfResources;
+ findFirstVnfRecipeByNfRoleAndAction = endpoint + VNF_RECIPE + SEARCH + findFirstVnfRecipeByNfRoleAndAction;
+ findByModelCustomizationUUIDAndVfModuleModelUUID =
+ endpoint + VFMODULE_CUSTOMIZATION + SEARCH + findByModelCustomizationUUIDAndVfModuleModelUUID;
+ findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction =
+ endpoint + VNF_COMPONENTS_RECIPE + SEARCH
+ + findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction;
+ findFirstVnfComponentsRecipeByVnfComponentTypeAndAction =
+ endpoint + VNF_COMPONENTS_RECIPE + SEARCH + findFirstVnfComponentsRecipeByVnfComponentTypeAndAction;
+ findVfModuleByModelInvariantUUIDOrderByModelVersionDesc =
+ endpoint + VFMODULE + SEARCH + findVfModuleByModelInvariantUUIDOrderByModelVersionDesc;
+ findFirstVfModuleByModelInvariantUUIDAndModelVersion =
+ endpoint + VFMODULE + SEARCH + findFirstVfModuleByModelInvariantUUIDAndModelVersion;
+ findOneByBuildingBlockName = endpoint + BUILDING_BLOCK_DETAIL + SEARCH + findOneByBuildingBlockName;
+ findOneByResourceTypeAndOrchestrationStatusAndTargetAction =
+ endpoint + ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE + SEARCH
+ + findOneByResourceTypeAndOrchestrationStatusAndTargetAction;
+ findByAction = endpoint + ORCHESTRATION_FLOW + SEARCH + findByAction;
+ findVnfcInstanceGroupCustomizationByModelCustomizationUUID =
+ endpoint + VNFC_INSTANCE_GROUP_CUSTOMIZATION + SEARCH
+ + findVnfcInstanceGroupCustomizationByModelCustomizationUUID;
+ findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID =
+ endpoint + COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION + SEARCH
+ + findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID;
+ findOneByActionAndRequestScopeAndIsAlacarte =
+ endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarte;
+ findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH
+ + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwner;
+ findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType =
+ endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH
+ + findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType;
+ findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH
+ + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep;
+ findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion;
+
+ 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;
+ vnfResourceCustomizationURI = endpoint + VNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ collectionNetworkResourceCustomizationURI =
+ endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
+ cloudifyManagerURI = endpoint + CLOUDIFY_MANAGER + URI_SEPARATOR;
+ cloudSiteURI = endpoint + CLOUD_SITE + URI_SEPARATOR;
+ homingInstanceURI = endpoint + HOMING_INSTANCE + URI_SEPARATOR;
+ pnfResourceURI = endpoint + PNF_RESOURCE + URI_SEPARATOR;
+ pnfResourceCustomizationURI = endpoint + PNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+
+ }
+
+ public CatalogDbClient() {
+ ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(
+ new HttpComponentsClientHttpRequestFactory());
+
+ ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory)
+ .setRestTemplateConfigurer(restTemplate -> {
+ restTemplate.getInterceptors().add((new SpringClientFilter()));
+
+ restTemplate.getInterceptors().add((request, body, execution) -> {
+
+ request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
+ request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ return execution.execute(request, body);
+ });
+ }).build().buildClientFactory();
+ serviceClient = clientFactory.create(Service.class);
+ networkRecipeClient = clientFactory.create(NetworkRecipe.class);
+ networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
+ vnfResourceClient = clientFactory.create(VnfResource.class);
+ vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
+ vnfRecipeClient = clientFactory.create(VnfRecipe.class);
+ orchestrationClient = clientFactory.create(OrchestrationFlow.class);
+ vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
+ vfModuleClient = clientFactory.create(VfModule.class);
+ vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
+ northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
+ rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
+ buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
+ orchestrationStatusStateTransitionDirectiveClient = clientFactory
+ .create(OrchestrationStatusStateTransitionDirective.class);
+ vnfcInstanceGroupCustomizationClient = clientFactory.create(VnfcInstanceGroupCustomization.class);
+ collectionResourceInstanceGroupCustomizationClient = clientFactory
+ .create(CollectionResourceInstanceGroupCustomization.class);
+ instanceGroupClient = clientFactory.create(InstanceGroup.class);
+ networkCollectionResourceCustomizationClient = clientFactory
+ .create(NetworkCollectionResourceCustomization.class);
+ collectionNetworkResourceCustomizationClient = clientFactory
+ .create(CollectionNetworkResourceCustomization.class);
+ cloudSiteClient = clientFactory.create(CloudSite.class);
+ 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);
+ pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
+ }
+
+ public CatalogDbClient(String baseUri, String auth) {
+ ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(
+ new HttpComponentsClientHttpRequestFactory());
+
+ ClientFactory clientFactory = Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory)
+ .setRestTemplateConfigurer(restTemplate -> {
+ restTemplate.getInterceptors().add((new SpringClientFilter()));
+
+ restTemplate.getInterceptors().add((request, body, execution) -> {
+
+ request.getHeaders().add(HttpHeaders.AUTHORIZATION, auth);
+ request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ return execution.execute(request, body);
+ });
+ }).build().buildClientFactory();
+ serviceClient = clientFactory.create(Service.class);
+ networkRecipeClient = clientFactory.create(NetworkRecipe.class);
+ networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
+ vnfResourceClient = clientFactory.create(VnfResource.class);
+ vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
+ vnfRecipeClient = clientFactory.create(VnfRecipe.class);
+ orchestrationClient = clientFactory.create(OrchestrationFlow.class);
+ vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
+ vfModuleClient = clientFactory.create(VfModule.class);
+ vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
+ northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
+ rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
+ buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
+ orchestrationStatusStateTransitionDirectiveClient = clientFactory
+ .create(OrchestrationStatusStateTransitionDirective.class);
+ vnfcInstanceGroupCustomizationClient = clientFactory.create(VnfcInstanceGroupCustomization.class);
+ collectionResourceInstanceGroupCustomizationClient = clientFactory
+ .create(CollectionResourceInstanceGroupCustomization.class);
+ instanceGroupClient = clientFactory.create(InstanceGroup.class);
+ networkCollectionResourceCustomizationClient = clientFactory
+ .create(NetworkCollectionResourceCustomization.class);
+ collectionNetworkResourceCustomizationClient = clientFactory
+ .create(CollectionNetworkResourceCustomization.class);
+ cloudSiteClient = clientFactory.create(CloudSite.class);
+ 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);
+ pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class);
+ }
+
+ public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(
+ String modelCustomizationUUID) {
+ NetworkCollectionResourceCustomization networkCollectionResourceCustomization =
+ this.getSingleResource(networkCollectionResourceCustomizationClient,
+ getUri(networkCollectionResourceCustomizationURI + modelCustomizationUUID));
+ if (networkCollectionResourceCustomization != null) {
+ networkCollectionResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return networkCollectionResourceCustomization;
+ }
+
+ public Service getServiceByID(String modelUUID) {
+ Service service = getSingleResource(serviceClient, getUri(serviceURI + modelUUID));
+ if (service != null) {
+ service.setModelUUID(modelUUID);
+ }
+ return service;
+ }
+
+ public VfModule getVfModuleByModelUUID(String modelUUID) {
+ VfModule vfModule = getSingleResource(vfModuleClient, getUri(vfModuleURI + modelUUID));
+ if (vfModule != null) {
+ vfModule.setModelUUID(modelUUID);
+ }
+ return vfModule;
+ }
+
+ public VnfResource getVnfResourceByModelUUID(String modelUUID) {
+
+ VnfResource vnfResource = this.getSingleResource(vnfResourceClient, getUri(vnfResourceURI + modelUUID));
+ if (vnfResource != null) {
+ vnfResource.setModelUUID(modelUUID);
+ }
+ return vnfResource;
+ }
+
+ public VnfResourceCustomization getVnfResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID) {
+ VnfResourceCustomization vnfResourceCustomization = getSingleResource(vnfResourceCustomizationClient,
+ getUri(vnfResourceCustomizationURI + modelCustomizationUUID));
+ if (vnfResourceCustomization != null) {
+ vnfResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return vnfResourceCustomization;
+ }
+
+ public PnfResource getPnfResourceByModelUUID(String modelUUID) {
+ PnfResource PnfResource = this.getSingleResource(pnfResourceClient, getUri(pnfResourceURI + modelUUID));
+ if (PnfResource != null) {
+ PnfResource.setModelUUID(modelUUID);
+ }
+ return PnfResource;
+ }
+
+ public PnfResourceCustomization getPnfResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID) {
+ PnfResourceCustomization pnfResourceCustomization = getSingleResource(pnfResourceCustomizationClient,
+ getUri(pnfResourceCustomizationURI + modelCustomizationUUID));
+ if (pnfResourceCustomization != null) {
+ pnfResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return pnfResourceCustomization;
+ }
+
+ public CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomizationByID(
+ String modelCustomizationUUID) {
+ CollectionNetworkResourceCustomization collectionNetworkResourceCustomization =
+ this.getSingleResource(collectionNetworkResourceCustomizationClient, getUri(UriBuilder
+ .fromUri(collectionNetworkResourceCustomizationURI + modelCustomizationUUID).build().toString()));
+ if (collectionNetworkResourceCustomization != null) {
+ collectionNetworkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return collectionNetworkResourceCustomization;
+ }
+
+ public InstanceGroup getInstanceGroupByModelUUID(String modelUUID) {
+ InstanceGroup instanceGroup = this.getSingleResource(instanceGroupClient, getUri(instanceGroupURI + modelUUID));
+ if (instanceGroup != null) {
+ instanceGroup.setModelUUID(modelUUID);
+ }
+ return instanceGroup;
+ }
+
+ public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
+ VfModuleCustomization vfModuleCust = this
+ .getSingleResource(vfModuleCustomizationClient, getUri(vfModuleCustomizationURI + modelCustomizationUUID));
+ if (vfModuleCust != null) {
+ vfModuleCust.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return vfModuleCust;
+ }
+
+ public NetworkResourceCustomization getNetworkResourceCustomizationByModelCustomizationUUID(
+ String modelCustomizationUUID) {
+ NetworkResourceCustomization networkResourceCustomization =
+ this.getSingleResource(networkResourceCustomizationClient,
+ getUri(networkResourceCustomizationURI + modelCustomizationUUID));
+ if (networkResourceCustomization != null) {
+ networkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return networkResourceCustomization;
+ }
+
+ public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
+ BuildingBlockDetail buildingBlockDetail = getSingleResource(buildingBlockDetailClient, getUri(UriBuilder
+ .fromUri(findOneByBuildingBlockName).queryParam(BUILDING_BLOCK_NAME, buildingBlockName).build()
+ .toString()));
+ if (buildingBlockDetail != null) {
+ buildingBlockDetail.setBuildingBlockName(buildingBlockName);
+ }
+ return buildingBlockDetail;
+ }
+
+
+ public OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective(
+ ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction) {
+ return getSingleResource(orchestrationStatusStateTransitionDirectiveClient, UriBuilder
+ .fromUri(findOneByResourceTypeAndOrchestrationStatusAndTargetAction)
+ .queryParam(RESOURCE_TYPE, resourceType.name())
+ .queryParam(ORCHESTRATION_STATUS, orchestrationStatus.name())
+ .queryParam(TARGET_ACTION, targetAction.name()).build());
+ }
+
+ public List<OrchestrationFlow> getOrchestrationFlowByAction(String action) {
+ return this.getMultipleResources(orchestrationClient, UriBuilder
+ .fromUri(findByAction).queryParam(ACTION, action).build());
+ }
+
+ public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupsByVnfResourceCust(String modelCustomizationUUID) {
+ return this.getMultipleResources(vnfcInstanceGroupCustomizationClient, UriBuilder
+ .fromUri(findVnfcInstanceGroupCustomizationByModelCustomizationUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
+ }
+
+ public List<CollectionResourceInstanceGroupCustomization> getCollectionResourceInstanceGroupCustomizationByModelCustUUID(
+ String modelCustomizationUUID) {
+ return this.getMultipleResources(collectionResourceInstanceGroupCustomizationClient, UriBuilder
+ .fromUri(findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
+ }
+
+ public VfModuleCustomization getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
+ String modelCustomizationUUID, String vfModuleModelUUID) {
+ return this.getSingleResource(vfModuleCustomizationClient, getUri(UriBuilder
+ .fromUri(findByModelCustomizationUUIDAndVfModuleModelUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID)
+ .queryParam(VF_MODULE_MODEL_UUID, vfModuleModelUUID).build().toString()));
+ }
+
+ public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(String requestAction,
+ String resourceName, boolean aLaCarte) {
+ return this.getSingleResource(northBoundRequestClient, UriBuilder
+ .fromUri(findOneByActionAndRequestScopeAndIsAlacarte)
+ .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
+ .queryParam(IS_ALACARTE, aLaCarte).build());
+ }
+
+ public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(String requestAction,
+ String resourceName, boolean aLaCarte, String cloudOwner) {
+ return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder
+ .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType)
+ .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
+ .queryParam(IS_ALACARTE, aLaCarte)
+ .queryParam(CLOUD_OWNER, cloudOwner)
+ .queryParam(SERVICE_TYPE, ASTERISK).build().toString()));
+ }
+
+ public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwnerAndServiceType(
+ String requestAction,
+ String resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
+ return this.getSingleResource(northBoundRequestClient, getUri(UriBuilder
+ .fromUri(findOneByActionAndRequestScopeAndIsAlacarteAndCloudOwnerAndServiceType)
+ .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
+ .queryParam(IS_ALACARTE, aLaCarte)
+ .queryParam(CLOUD_OWNER, cloudOwner)
+ .queryParam(SERVICE_TYPE, serviceType).build().toString()));
+ }
+
+ public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
+ String flowName, String serviceType, String vnfType, String errorCode, String workStep) {
+ return this.getSingleResource(rainyDayHandlerStatusClient, getUri(UriBuilder
+ .fromUri(findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep)
+ .queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
+ .queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
+ .build().toString()));
+ }
+
+ public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action) {
+ return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder
+ .fromUri(findFirstByServiceModelUUIDAndActionURI)
+ .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());
+ }
+
+ public ControllerSelectionReference getControllerSelectionReferenceByVnfTypeAndActionCategory(String vnfType,
+ String actionCategory) {
+ return this.getSingleResource(controllerSelectionReferenceClient, UriBuilder
+ .fromUri(endpoint
+ + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfTypeAndActionCategory")
+ .queryParam("VNF_TYPE", vnfType).queryParam("ACTION_CATEGORY", actionCategory).build());
+ }
+
+ public Service getFirstByModelNameOrderByModelVersionDesc(String modelName) {
+ return this.getSingleResource(serviceClient, UriBuilder
+ .fromUri(findFirstByModelNameURI)
+ .queryParam(MODEL_NAME, modelName).build());
+ }
+
+ public ExternalServiceToInternalService findExternalToInternalServiceByServiceName(String serviceName) {
+ return this.getSingleResource(externalServiceToInternalServiceClient, getUri(UriBuilder
+ .fromUri(findExternalToInternalServiceByServiceName)
+ .queryParam(SERVICE_NAME, serviceName).build().toString()));
+ }
+
+ public ServiceRecipe findServiceRecipeByActionAndServiceModelUUID(String action, String modelUUID) {
+ return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder
+ .fromUri(findServiceRecipeByActionAndServiceModelUUID)
+ .queryParam(ACTION, action)
+ .queryParam(SERVICE_MODEL_UUID, modelUUID).build().toString()));
+ }
+
+ public Service getServiceByModelName(String modelName) {
+ return this.getSingleResource(serviceClient, getUri(UriBuilder
+ .fromUri(findServiceByModelName)
+ .queryParam(MODEL_NAME, modelName).build().toString()));
+ }
+
+ public Service getServiceByModelUUID(String modelModelUUID) {
+ return this.getSingleResource(serviceClient, getUri(UriBuilder
+ .fromUri(findServiceByModelUUID)
+ .queryParam(MODEL_UUID, modelModelUUID).build().toString()));
+ }
+
+ public VnfResource getFirstVnfResourceByModelInvariantUUIDAndModelVersion(String modelInvariantUUID,
+ String modelVersion) {
+ return this.getSingleResource(vnfResourceClient, getUri(UriBuilder
+ .fromUri(findFirstResourceByModelInvariantUUIDAndModelVersion)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID)
+ .queryParam(MODEL_VERSION, modelVersion).build().toString()));
+ }
+
+
+ public VnfResourceCustomization getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(
+ String modelInstanceName, VnfResource vnfResource) {
+ return this.getSingleResource(vnfResourceCustomizationClient, getUri(UriBuilder
+ .fromUri(findByModelInstanceNameAndVnfResources)
+ .queryParam(MODEL_INSTANCE_NAME, modelInstanceName)
+ .queryParam(VNF_RESOURCE_MODEL_UUID, vnfResource.getModelUUID()).build().toString()));
+ }
+
+ public VnfRecipe getFirstVnfRecipeByNfRoleAndAction(String nfRole, String action) {
+ return this.getSingleResource(vnfRecipeClient, getUri(UriBuilder
+ .fromUri(findFirstVnfRecipeByNfRoleAndAction)
+ .queryParam(NF_ROLE, nfRole)
+ .queryParam(ACTION, action).build().toString()));
+ }
+
+ public VnfComponentsRecipe getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ String vfModuleModelUUID, String vnfComponentType, 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()));
+ }
+
+ public VnfComponentsRecipe getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType,
+ String action) {
+ return this.getSingleResource(vnfComponentsRecipeClient, getUri(UriBuilder
+ .fromUri(findFirstVnfComponentsRecipeByVnfComponentTypeAndAction)
+ .queryParam(VNF_COMPONENT_TYPE, vnfComponentType)
+ .queryParam(ACTION, action).build().toString()));
+ }
+
+ protected URI getUri(String template) {
+ return URI.create(template);
+ }
+
+ public CloudifyManager getCloudifyManager(String id) {
+ return this.getSingleResource(cloudifyManagerClient, getUri(cloudifyManagerURI + id));
+ }
+
+ public CloudSite getCloudSite(String id) {
+ return this.getSingleResource(cloudSiteClient,
+ getUri(cloudSiteURI + id));
+ }
+
+ public CloudSite getCloudSite(String id, String uri) {
+ return this.getSingleResource(cloudSiteClient,
+ getUri(uri + id));
+ }
+
+ public void postCloudSite(CloudSite cloudSite) {
+ this.postSingleResource(cloudSiteClient, cloudSite);
+ }
+
+ public CloudSite getCloudSiteByClliAndAicVersion(String clli, String cloudVersion) {
+ return this.getSingleResource(cloudSiteClient, getUri(UriBuilder
+ .fromUri(findByClliAndCloudVersion)
+ .queryParam(CLLI, clli).queryParam(CLOUD_VERSION, cloudVersion).build().toString()));
+ }
+
+ public HomingInstance getHomingInstance(String serviceInstanceId) {
+ return this.getSingleResource(homingInstanceClient,
+ getUri(homingInstanceURI + serviceInstanceId));
+ }
+
+ public HomingInstance getHomingInstance(String serviceInstanceId, String uri) {
+ return this.getSingleResource(homingInstanceClient,
+ getUri(uri + serviceInstanceId));
+ }
+
+ public void postHomingInstance(HomingInstance homingInstance) {
+ this.postSingleResource(homingInstanceClient, homingInstance);
+ }
+
+ public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
+ return this.getSingleResource(serviceClient, getUri(UriBuilder
+ .fromUri(findFirstByModelVersionAndModelInvariantUUIDURI)
+ .queryParam(MODEL_VERSION, modelVersion)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
+ }
+
+ public VfModule getVfModuleByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion) {
+ return this.getSingleResource(vfModuleClient, getUri(UriBuilder
+ .fromUri(findFirstVfModuleByModelInvariantUUIDAndModelVersion)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID)
+ .queryParam(MODEL_VERSION, modelVersion).build().toString()));
+ }
+
+ public List<Service> getServiceByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
+ return this.getMultipleResources(serviceClient, getUri(UriBuilder
+ .fromUri(findByModelInvariantUUIDURI)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
+ }
+
+ public List<VfModule> getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
+ return this.getMultipleResources(vfModuleClient, getUri(UriBuilder
+ .fromUri(findVfModuleByModelInvariantUUIDOrderByModelVersionDesc)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
+ }
+
+ private <T> T getSingleResource(Client<T> client, URI uri) {
+ return client.get(uri);
+ }
+
+ private <T> List<T> getMultipleResources(Client<T> client, URI uri) {
+ Iterable<T> iterator = client.getAll(uri);
+ List<T> list = new ArrayList<>();
+ Iterator<T> it = iterator.iterator();
+ it.forEachRemaining(list::add);
+ return list;
+ }
+
+ private <T> URI postSingleResource(Client<T> client, T type) {
+ return client.post(type);
+ }
+
+ public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(
+ String vnfCustomizationUUID, String vfModuleCustomizationUUID) {
+
+ return this.getMultipleResources(cvnfcCustomizationClient, getUri(UriBuilder
+ .fromUri(endpoint + "/cvnfcCustomization/search/findByVnfResourceCustomizationAndVfModuleCustomization")
+ .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUUID)
+ .queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString()));
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java
new file mode 100644
index 0000000000..8252b2427e
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepository.java
@@ -0,0 +1,32 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+import java.util.List;
+
+@RepositoryRestResource(collectionResourceRel = "pnfResourceCustomization", path = "pnfResourceCustomization")
+public interface PnfCustomizationRepository extends JpaRepository<PnfResourceCustomization, String> {
+
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfResourceRepository.java
new file mode 100644
index 0000000000..bf8e83bbac
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/PnfResourceRepository.java
@@ -0,0 +1,29 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.data.repository;
+
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "pnfResource", path = "pnfResource")
+public interface PnfResourceRepository extends JpaRepository<PnfResource, String> {
+
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java
index ffa56a9ce3..7028d9161c 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ServiceTest.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,11 +21,14 @@
package org.onap.so.db.catalog;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.springframework.beans.factory.annotation.Autowired;
@@ -37,42 +40,62 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class ServiceTest {
- @Autowired
- private ServiceRepository serviceRepo;
- @Test
- public void Find_LatestService_Test() {
- Service latestVersionService = serviceRepo.findFirstByModelNameOrderByModelVersionDesc("MSOTADevInfra_vSAMP10a_Service");
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.getModelUUID());
- }
+ @Autowired
+ private ServiceRepository serviceRepo;
+ @Test
+ public void Find_LatestService_Test() {
+ Service latestVersionService = serviceRepo
+ .findFirstByModelNameOrderByModelVersionDesc("MSOTADevInfra_vSAMP10a_Service");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002675", latestVersionService.getModelUUID());
+ }
- @Test
- public void Find_LatestService_Test_2() {
- Service latestVersionService = serviceRepo.findByModelNameOrderByModelVersionDesc("MSOTADevInfra_vSAMP10a_Service");
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.getModelUUID());
- }
+ @Test
+ public void Find_LatestService_Test_2() {
+ Service latestVersionService = serviceRepo
+ .findByModelNameOrderByModelVersionDesc("MSOTADevInfra_vSAMP10a_Service");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002675", latestVersionService.getModelUUID());
+ }
- @Test
- public void Find_LatestService_Test_Invariant_UUID() {
- List<Service> latestVersionService = serviceRepo.findByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.get(0).getModelUUID());
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002674",latestVersionService.get(1).getModelUUID());
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002673",latestVersionService.get(2).getModelUUID());
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002672",latestVersionService.get(3).getModelUUID());
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002671",latestVersionService.get(4).getModelUUID());
- }
+ @Test
+ public void Find_LatestService_Test_Invariant_UUID() {
+ List<Service> latestVersionService = serviceRepo
+ .findByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002675", latestVersionService.get(0).getModelUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002674", latestVersionService.get(1).getModelUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002673", latestVersionService.get(2).getModelUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002672", latestVersionService.get(3).getModelUUID());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002671", latestVersionService.get(4).getModelUUID());
+ }
- @Test
- public void Find_LatestService_Test_4() {
- Service latestVersionService = serviceRepo.findOneByModelUUIDOrderByModelVersionDesc("5df8b6de-2083-11e7-93ae-92361f002671");
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002671",latestVersionService.getModelUUID());
- }
+ @Test
+ public void Find_LatestService_Test_4() {
+ Service latestVersionService = serviceRepo
+ .findOneByModelUUIDOrderByModelVersionDesc("5df8b6de-2083-11e7-93ae-92361f002671");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002671", latestVersionService.getModelUUID());
+ }
- @Test
- public void Find_LatestService_Test_5() {
- Service latestVersionService = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
- assertEquals("5df8b6de-2083-11e7-93ae-92361f002675",latestVersionService.getModelUUID());
- }
+ @Test
+ public void Find_LatestService_Test_5() {
+ Service latestVersionService = serviceRepo
+ .findFirstByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002675", latestVersionService.getModelUUID());
+ }
+
+
+ @Test
+ public void findByModelNameOrderByModelVersionDesc_ValidModelName_ExpectedOutput() {
+ Service latestVersionService = serviceRepo.findByModelNameOrderByModelVersionDesc("PNF_routing_service");
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002676", latestVersionService.getModelUUID());
+ }
+
+ @Test
+ public void findByModelInvariantUUIDOrderByModelVersionDesc_ValidInvariantUuid_ExpectedOutput() {
+ List<Service> services = serviceRepo
+ .findByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002676");
+ assertEquals("One PNF service found", 1, services.size());
+ assertEquals("5df8b6de-2083-11e7-93ae-92361f002676", services.get(0).getModelUUID());
+ }
}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java
new file mode 100644
index 0000000000..c5e95fcfbc
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfCustomizationRepositoryTest.java
@@ -0,0 +1,62 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.data.repository;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.exceptions.NoEntityFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+public class PnfCustomizationRepositoryTest extends BaseTest {
+
+ @Autowired
+ private PnfCustomizationRepository pnfCustomizationRepository;
+
+ @Test
+ public void findById_ValidUuid_ExpectedOutput() throws Exception {
+ PnfResourceCustomization pnfResourceCustomization = pnfCustomizationRepository
+ .findById("68dc9a92-214c-11e7-93ae-92361f002680")
+ .orElseThrow(() -> new NoEntityFoundException("Cannot Find Operation"));
+ checkPnfResourceCustomization(pnfResourceCustomization);
+ }
+
+ private void checkPnfResourceCustomization(PnfResourceCustomization pnfResourceCustomization) {
+ assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName());
+ assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName());
+ assertEquals("blueprintVersion", "1.0.0", pnfResourceCustomization.getBlueprintVersion());
+ PnfResource pnfResource = pnfResourceCustomization.getPnfResources();
+ assertNotNull(pnfResource);
+
+ assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
+ assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
+ pnfResource.getModelInvariantUUID());
+ assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
+ assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
+ }
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfResourceRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfResourceRepositoryTest.java
new file mode 100644
index 0000000000..4dde3b25df
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/PnfResourceRepositoryTest.java
@@ -0,0 +1,50 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.data.repository;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.PnfResource;
+import org.onap.so.db.catalog.exceptions.NoEntityFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class PnfResourceRepositoryTest extends BaseTest {
+
+ @Autowired
+ private PnfResourceRepository pnfResourceRepository;
+
+ @Test
+ public void findResourceById_validUuid_expectedOutput() throws Exception {
+
+ PnfResource pnfResource = pnfResourceRepository.findById("ff2ae348-214a-11e7-93ae-92361f002680")
+ .orElseThrow(() -> new NoEntityFoundException("Cannot Find Entity"));
+ checkPnfResource(pnfResource);
+ }
+
+ private void checkPnfResource(PnfResource pnfResource) {
+ assertEquals("PNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002680", pnfResource.getModelUUID());
+ assertEquals("PNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002680",
+ pnfResource.getModelInvariantUUID());
+ assertEquals("PNFResource modelVersion", "1.0", pnfResource.getModelVersion());
+ assertEquals("PNFResource orchestration mode", "", pnfResource.getOrchestrationMode());
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java
new file mode 100644
index 0000000000..8e2e1e0446
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepositoryTest.java
@@ -0,0 +1,78 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.data.repository;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+
+import org.junit.Test;
+import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+
+public class VnfCustomizationRepositoryTest extends BaseTest {
+
+ @Autowired
+ private VnfCustomizationRepository vnfCustomizationRepository;
+
+ @Test
+ public void findByModelCustomizationUUID_ValidUuid_ExpectedOutput() throws Exception {
+ List<VnfResourceCustomization> vnfCustomizationList = vnfCustomizationRepository
+ .findByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
+ assertFalse(CollectionUtils.isEmpty(vnfCustomizationList));
+ assertEquals("output contains one entity", 1, vnfCustomizationList.size());
+
+ checkVnfResourceCustomization(vnfCustomizationList.get(0));
+ }
+
+ @Test
+ public void findOneByModelCustomizationUUID_ValidUuid_ExpectedOutput() throws Exception {
+ VnfResourceCustomization vnfResourceCustomization = vnfCustomizationRepository
+ .findOneByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
+ checkVnfResourceCustomization(vnfResourceCustomization);
+ }
+
+ @Test
+ public void findByModelInstanceNameAndVnfResources_ValidNameAndUuid_ExpectedOutput() throws Exception {
+ VnfResourceCustomization vnfResourceCustomization = vnfCustomizationRepository
+ .findByModelInstanceNameAndVnfResources("vSAMP10a 1", "ff2ae348-214a-11e7-93ae-92361f002671");
+ checkVnfResourceCustomization(vnfResourceCustomization);
+ }
+
+ private void checkVnfResourceCustomization(VnfResourceCustomization vnfResourceCustomization) {
+ assertEquals("modelInstanceName", "vSAMP10a 1", vnfResourceCustomization.getModelInstanceName());
+ assertEquals("blueprintName", "test_configuration_restconf", vnfResourceCustomization.getBlueprintName());
+ assertEquals("blueprintVersion", "1.0.0", vnfResourceCustomization.getBlueprintVersion());
+ VnfResource vnfResource = vnfResourceCustomization.getVnfResources();
+ assertNotNull(vnfResource);
+
+ assertEquals("VNFResource modelUUID", "ff2ae348-214a-11e7-93ae-92361f002671", vnfResource.getModelUUID());
+ assertEquals("VNFResource modelInvariantUUID", "2fff5b20-214b-11e7-93ae-92361f002671",
+ vnfResource.getModelInvariantUUID());
+ assertEquals("VNFResource modelVersion", "1.0", vnfResource.getModelVersion());
+ assertEquals("VNFResource orchestration mode", "HEAT", vnfResource.getOrchestrationMode());
+ }
+}
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index 14834ea963..a59137d023 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -44,9 +44,8 @@ insert into heat_environment(artifact_uuid, name, version, description, body, ar
insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values
('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null);
-insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values
-('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null);
-
+insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design, cds_blueprint_name, cds_blueprint_version) values
+('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null, "test_configuration_restconf", "1.0.0");
insert into vf_module(model_uuid, model_invariant_uuid, model_version, model_name, description, is_base, heat_template_artifact_uuid, vol_heat_template_artifact_uuid, creation_timestamp, vnf_resource_model_uuid) values
@@ -759,3 +758,15 @@ VALUES ( '1',
'testPolicyName',
'2018-07-17 14:05:08',
'c59a41ca-9b3b-11e8-98d0-529269fb1459');
+
+insert into service(model_uuid, model_name, model_invariant_uuid, model_version, description, creation_timestamp, tosca_csar_artifact_uuid, service_type, service_role, environment_context, workload_context) values
+('5df8b6de-2083-11e7-93ae-92361f002676', 'PNF_routing_service', '9647dfc4-2083-11e7-93ae-92361f002676', '1.0', 'PNF service', '2019-03-08 12:00:29', null, 'NA', 'NA', 'Luna', 'Oxygen');
+
+insert into pnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, model_invariant_uuid, model_version, model_name, tosca_node_type) values
+('', 'PNF routing', '2019-03-08 12:00:28', 'ff2ae348-214a-11e7-93ae-92361f002680', '2fff5b20-214b-11e7-93ae-92361f002680', '1.0', 'PNF resource', null);
+
+insert into pnf_resource_customization(model_customization_uuid, model_instance_name, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, pnf_resource_model_uuid, multi_stage_design, cds_blueprint_name, cds_blueprint_version) values
+('68dc9a92-214c-11e7-93ae-92361f002680', 'PNF routing', 'routing', 'routing', 'routing', 'routing', '2019-03-08 12:00:29', 'ff2ae348-214a-11e7-93ae-92361f002680', null, "test_configuration_restconf", "1.0.0");
+
+insert into pnf_resource_customization_to_service(service_model_uuid, resource_model_customization_uuid) values
+('5df8b6de-2083-11e7-93ae-92361f002676', '68dc9a92-214c-11e7-93ae-92361f002680'); \ No newline at end of file
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index d20a9adb7e..6bd9baee80 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -437,6 +437,8 @@ create table `vnf_resource_customization` (
`vnf_resource_model_uuid` varchar(200) not null,
`multi_stage_design` varchar(20) default null,
`resource_input` varchar(20000) default null,
+ `cds_blueprint_name` varchar(200) default null,
+ `cds_blueprint_version` varchar(20) default null,
primary key (`model_customization_uuid`),
key `fk_vnf_resource_customization__vnf_resource1_idx` (`vnf_resource_model_uuid`),
constraint `fk_vnf_resource_customization__vnf_resource1` foreign key (`vnf_resource_model_uuid`) references `vnf_resource` (`model_uuid`) on delete cascade on update cascade
@@ -946,3 +948,41 @@ CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`)
ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource` (
+ `ORCHESTRATION_MODE` varchar(20) NOT NULL DEFAULT 'HEAT',
+ `DESCRIPTION` varchar(1200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `MODEL_UUID` varchar(200) NOT NULL,
+ `MODEL_INVARIANT_UUID` varchar(200) DEFAULT NULL,
+ `MODEL_VERSION` varchar(20) NOT NULL,
+ `MODEL_NAME` varchar(200) DEFAULT NULL,
+ `TOSCA_NODE_TYPE` varchar(200) DEFAULT NULL,
+ `RESOURCE_CATEGORY` varchar(200) DEFAULT NULL,
+ `RESOURCE_SUB_CATEGORY` varchar(200) DEFAULT NULL,
+ PRIMARY KEY (`MODEL_UUID`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource_customization` (
+ `MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` varchar(200) NOT NULL,
+ `NF_TYPE` varchar(200) DEFAULT NULL,
+ `NF_ROLE` varchar(200) DEFAULT NULL,
+ `NF_FUNCTION` varchar(200) DEFAULT NULL,
+ `NF_NAMING_CODE` varchar(200) DEFAULT NULL,
+ `CREATION_TIMESTAMP` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `PNF_RESOURCE_MODEL_UUID` varchar(200) NOT NULL,
+ `MULTI_STAGE_DESIGN` varchar(20) DEFAULT NULL,
+ `RESOURCE_INPUT` varchar(2000) DEFAULT NULL,
+ `CDS_BLUEPRINT_NAME` varchar(200) DEFAULT NULL,
+ `CDS_BLUEPRINT_VERSION` varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`),
+ KEY `fk_pnf_resource_customization__pnf_resource1_idx` (`PNF_RESOURCE_MODEL_UUID`),
+ CONSTRAINT `fk_pnf_resource_customization__pnf_resource1` FOREIGN KEY (`PNF_RESOURCE_MODEL_UUID`) REFERENCES `pnf_resource` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+CREATE TABLE IF NOT EXISTS `pnf_resource_customization_to_service` (
+ `SERVICE_MODEL_UUID` varchar(200) NOT NULL,
+ `RESOURCE_MODEL_CUSTOMIZATION_UUID` varchar(200) NOT NULL,
+ PRIMARY KEY (`SERVICE_MODEL_UUID`,`RESOURCE_MODEL_CUSTOMIZATION_UUID`)
+)ENGINE=InnoDB DEFAULT CHARSET=latin1; \ No newline at end of file