From 88c47a23b9428188ff5dd0b46941f8856465376b Mon Sep 17 00:00:00 2001 From: eeginux Date: Wed, 3 Apr 2019 14:28:09 +0000 Subject: PNF WF post instantiation configuration Add PNF ipv4/v6 address for config Deploy Add Integration test for CreateVcpeResCustService_simplified.bpmn Modify the PnfEventReadyDmaapClient to avoid one more running thread Refactor the so-bpmn-infrastructure-flows test resources Modify the CreateVcpeResCustService_simplified.bpmn Add ConfigurePnfResource.bpmn Add Delegates Issue-ID: SO-1506 Change-Id: Iffb69d1441ef0b485ee8cd3fb5da5f1a35279a95 Signed-off-by: eeginux --- .../org/onap/so/db/catalog/client/CatalogDbClient.java | 11 ++++++++++- .../data/repository/PnfCustomizationRepository.java | 14 ++++++++++++++ .../data/repository/PnfCustomizationRepositoryTest.java | 9 +++++++++ mso-catalog-db/src/test/resources/application-test.yaml | 1 - 4 files changed, 33 insertions(+), 2 deletions(-) (limited to 'mso-catalog-db') 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 28b77cde79..df1c947bde 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 @@ -175,7 +175,7 @@ public class CatalogDbClient { private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep"; private String findByClliAndCloudVersion = "/findByClliAndCloudVersion"; private String findServiceByServiceInstanceId = "/findServiceByServiceInstanceId"; - + private String findPnfResourceCustomizationByModelUuid = "/findPnfResourceCustomizationByModelUuid"; private String serviceURI; private String vfModuleURI; @@ -288,6 +288,9 @@ public class CatalogDbClient { findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep; findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion; + findPnfResourceCustomizationByModelUuid = + endpoint + PNF_RESOURCE_CUSTOMIZATION + SEARCH + findPnfResourceCustomizationByModelUuid; + serviceURI = endpoint + SERVICE + URI_SEPARATOR; vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR; vnfResourceURI = endpoint + VNF_RESOURCE + URI_SEPARATOR; @@ -458,6 +461,12 @@ public class CatalogDbClient { return pnfResourceCustomization; } + public List getPnfResourceCustomizationByModelUuid(String modelUuid) { + return this.getMultipleResources(pnfResourceCustomizationClient, getUri( + UriBuilder.fromUri(findPnfResourceCustomizationByModelUuid).queryParam("SERVICE_MODEL_UUID", modelUuid) + .build().toString())); + } + public CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomizationByID(String modelCustomizationUUID) { CollectionNetworkResourceCustomization collectionNetworkResourceCustomization = this.getSingleResource(collectionNetworkResourceCustomizationClient,getUri(UriBuilder 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 index 7527a79842..f64311a561 100644 --- 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 @@ -19,11 +19,25 @@ package org.onap.so.db.catalog.data.repository; +import java.util.List; 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.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "pnfResourceCustomization", path = "pnfResourceCustomization") public interface PnfCustomizationRepository extends JpaRepository { + /** + * Used to fetch the @{link PnfResourceCustomization} by the Model UUID. + * + * This operation is required by {@link org.onap.so.db.catalog.client.CatalogDbClient} to provide PnfResourceCustomization based on model UUID without projection. + * + * @param serviceModelUuid model UUID + * @return List of PnfResourceCustomization + */ + @Query(value = "select b.* from pnf_resource_customization_to_service a join pnf_resource_customization b where a.RESOURCE_MODEL_CUSTOMIZATION_UUID = b.MODEL_CUSTOMIZATION_UUID and a.SERVICE_MODEL_UUID = ?1", nativeQuery = true) + List findPnfResourceCustomizationByModelUuid( + @Param("SERVICE_MODEL_UUID") String serviceModelUuid); } \ No newline at end of file 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 index 4ba344c845..0eec84f4c3 100644 --- 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 @@ -23,6 +23,7 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; +import java.util.List; import org.junit.Test; import org.onap.so.db.catalog.BaseTest; import org.onap.so.db.catalog.beans.PnfResource; @@ -43,6 +44,14 @@ public class PnfCustomizationRepositoryTest extends BaseTest { checkPnfResourceCustomization(pnfResourceCustomization); } + @Test + public void findPnfResourceCustomizationByModelUuid_ValidServiceUuidAndCustomizationUuid_ExpectedOutput() { + List pnfResourceCustomizationList = pnfCustomizationRepository + .findPnfResourceCustomizationByModelUuid("5df8b6de-2083-11e7-93ae-92361f002676"); + assertEquals("Found the matching resource entity", 1, pnfResourceCustomizationList.size()); + checkPnfResourceCustomization(pnfResourceCustomizationList.get(0)); + } + private void checkPnfResourceCustomization(PnfResourceCustomization pnfResourceCustomization) { assertEquals("modelInstanceName", "PNF routing", pnfResourceCustomization.getModelInstanceName()); assertEquals("blueprintName", "test_configuration_restconf", pnfResourceCustomization.getBlueprintName()); diff --git a/mso-catalog-db/src/test/resources/application-test.yaml b/mso-catalog-db/src/test/resources/application-test.yaml index 5d04aa49be..fe44397493 100644 --- a/mso-catalog-db/src/test/resources/application-test.yaml +++ b/mso-catalog-db/src/test/resources/application-test.yaml @@ -51,7 +51,6 @@ server: tomcat: max-threads: 50 - #Actuator management: endpoints: -- cgit 1.2.3-korg