diff options
Diffstat (limited to 'mso-catalog-db')
8 files changed, 52 insertions, 4 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java index d831d1ebd2..1fd254f254 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationAction.java @@ -30,6 +30,8 @@ public enum OrchestrationAction { CREATE("Create"), DELETE("Delete"), UPDATE("Update"), + ADD_MEMBERS("AddMembers"), + REMOVE_MEMBERS("RemoveMembers"), CUSTOM("Custom"); private final String name; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java index 64eff56f97..6d5c0fd9a8 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ResourceType.java @@ -28,6 +28,7 @@ public enum ResourceType { NETWORK("Network"), NETWORK_COLLECTION("NetworkCollection"), CONFIGURATION("Configuration"), + INSTANCE_GROUP("InstanceGroup"), NO_VALIDATE("NoValidate"); private final String name; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/Service.java index e0b783fd9e..428736eddc 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 @@ -123,9 +123,8 @@ public class Service implements Serializable { @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) + @OneToMany(cascade = CascadeType.ALL, mappedBy = "service") @MapKey(name = "action") - @JoinColumn(name = "SERVICE_MODEL_UUID") private Map<String, ServiceRecipe> recipes; @ManyToOne(cascade = CascadeType.ALL) diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java index d063ea4809..79b27e7deb 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ServiceRecipe.java @@ -23,9 +23,13 @@ package org.onap.so.db.catalog.beans; import java.io.Serializable; import java.util.Date; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.Id; +import javax.persistence.JoinColumn; +import javax.persistence.ManyToOne; import javax.persistence.PrePersist; import javax.persistence.Table; import javax.persistence.Temporal; @@ -74,6 +78,11 @@ public class ServiceRecipe implements Serializable, Recipe { @Column(name = "CREATION_TIMESTAMP", updatable = false) @Temporal(TemporalType.TIMESTAMP) private Date created; + + @BusinessKey + @ManyToOne(cascade = CascadeType.ALL) + @JoinColumn(name = "SERVICE_MODEL_UUID", referencedColumnName = "MODEL_UUID",insertable = false, updatable = false) + private Service service; @PrePersist protected void onCreate() { @@ -177,6 +186,14 @@ public class ServiceRecipe implements Serializable, Recipe { public void setServiceTimeoutInterim(Integer serviceTimeoutInterim) { this.serviceTimeoutInterim = serviceTimeoutInterim; } + + public Service getService() { + return service; + } + + public void setService(Service service) { + this.service = service; + } public Date getCreated() { return created; diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java index f5e9b5f560..7ce657c5c7 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java @@ -213,6 +213,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable this.configurationResource = configurationResource; } + @LinkedResource public CvnfcCustomization getCvnfcCustomization() { return cvnfcCustomization; } 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 b79ffedf83..9b888cb2ed 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 @@ -53,6 +53,7 @@ import org.onap.so.db.catalog.beans.VnfComponentsRecipe; import org.onap.so.db.catalog.beans.VnfRecipe; import org.onap.so.db.catalog.beans.VnfResource; import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.catalog.beans.macro.NorthBoundRequest; import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; @@ -231,6 +232,8 @@ public class CatalogDbClient { private final Client<ControllerSelectionReference> controllerSelectionReferenceClient; + private final Client<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationClient; + private final Client<PnfResource> pnfResourceClient; private final Client<PnfResourceCustomization> pnfResourceCustomizationClient; @@ -359,6 +362,7 @@ public class CatalogDbClient { cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class); controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class); externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class); + vnfVfmoduleCvnfcConfigurationCustomizationClient = clientFactory.create(VnfVfmoduleCvnfcConfigurationCustomization.class); pnfResourceClient = clientFactory.create(PnfResource.class); pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class); } @@ -408,6 +412,7 @@ public class CatalogDbClient { cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class); controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class); externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class); + vnfVfmoduleCvnfcConfigurationCustomizationClient = clientFactory.create(VnfVfmoduleCvnfcConfigurationCustomization.class); pnfResourceClient = clientFactory.create(PnfResource.class); pnfResourceCustomizationClient = clientFactory.create(PnfResourceCustomization.class); } @@ -784,4 +789,12 @@ public class CatalogDbClient { .queryParam("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build().toString())); } + public VnfVfmoduleCvnfcConfigurationCustomization getVnfVfmoduleCvnfcConfigurationCustomizationByVnfCustomizationUuidAndVfModuleCustomizationUuidAndCvnfcCustomizationUuid(String vnfCustomizationUuid, + String vfModuleCustomizationUuid, String cvnfcCustomizationUuid) { + return this.getSingleResource(vnfVfmoduleCvnfcConfigurationCustomizationClient, getUri(UriBuilder + .fromUri(endpoint + "/vnfVfmoduleCvnfcConfigurationCustomization/search/findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization") + .queryParam("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID", vnfCustomizationUuid) + .queryParam("VF_MODULE_MODEL_CUSTOMIZATION_UUID", vfModuleCustomizationUuid) + .queryParam("CVNFC_MODEL_CUSTOMIZATION_UUID", cvnfcCustomizationUuid).build().toString())); + } } diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java index f936933485..aad75a15be 100644 --- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java +++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java @@ -24,9 +24,17 @@ import java.util.List; import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "vnfVfmoduleCvnfcConfigurationCustomization", path = "vnfVfmoduleCvnfcConfigurationCustomization") public interface VnfVfmoduleCvnfcConfigurationCustomizationRepository extends JpaRepository<VnfVfmoduleCvnfcConfigurationCustomization, Integer> { List<VnfVfmoduleCvnfcConfigurationCustomization> findByModelCustomizationUUID(String modelCustomizationUUID); + + @Query(value = "SELECT * FROM vnf_vfmodule_cvnfc_configuration_customization WHERE VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID = ?1 AND VF_MODULE_MODEL_CUSTOMIZATION_UUID = ?2 AND CVNFC_MODEL_CUSTOMIZATION_UUID = ?3", nativeQuery = true) + VnfVfmoduleCvnfcConfigurationCustomization findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization ( + @Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomizationUuid, + @Param("VF_MODULE_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomizationUuid, + @Param("CVNFC_MODEL_CUSTOMIZATION_UUID") String cvnfcCustomizationUuid); }
\ No newline at end of file diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java index 6f0e3020b1..a953fc8a3c 100644 --- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java +++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java @@ -81,7 +81,7 @@ public class VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest extends Ba vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource); CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization(); - cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); + cvnfcCustomization.setModelCustomizationUUID("0c3a8b76-3f5b-11e9-b210-d663bd873d93"); VfModuleCustomization vfModuleCustomization = new VfModuleCustomization(); vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459"); @@ -122,5 +122,12 @@ public class VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest extends Ba if(foundVnfVfmoduleCvnfcConfigurationCustomization == null) fail("should not be null"); + + VnfVfmoduleCvnfcConfigurationCustomization foundOneVnfVfmoduleCvnfcConfigurationCustomization = + vnfVfmoduleCvnfcConfigurationCustomizationRepository.findOneByVnfResourceCustomizationAndVfModuleCustomizationAndCvnfcCustomization("cf9f6efc-9f14-11e8-98d0-529269fb1459", "cf9f6efc-9f14-11e8-98d0-529269fb1459", "0c3a8b76-3f5b-11e9-b210-d663bd873d93"); + + if(foundOneVnfVfmoduleCvnfcConfigurationCustomization == null) + fail("should not be null"); + Assert.assertTrue(foundOneVnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equalsIgnoreCase("testConfigurationFunction")); } -} +}
\ No newline at end of file |