diff options
author | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2019-05-17 10:16:07 +0530 |
---|---|---|
committer | subhash kumar singh <subhash.kumar.singh@huawei.com> | 2019-05-19 18:12:35 +0530 |
commit | 9c2559ce31cbd3610c097a0ba351473395e6389f (patch) | |
tree | 6abed6e8946ecad978974bfaba7da9cdfd65cb36 /adapters/mso-catalog-db-adapter/src/main/java | |
parent | 24ad9609469cb7325c629e1efcdeec494bfecd7c (diff) |
Recipe retrieval for groups
Recipe retrieval for groups.
Change-Id: I2ba68777f3655ebc7794b75d357253022fe7739b
Issue-ID: SO-1393
Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'adapters/mso-catalog-db-adapter/src/main/java')
2 files changed, 18 insertions, 2 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java index c15b0d9df1..facdd2f4ca 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryGroups.java @@ -77,9 +77,9 @@ public class QueryGroups extends CatalogQuery { if (instanceGroup != null) { put(valueMap, "MODEL_NAME", instanceGroup.getModelName()); - put(valueMap, "MODEL_UUID", instanceGroup.getModelInvariantUUID()); + put(valueMap, "MODEL_UUID", instanceGroup.getModelUUID()); put(valueMap, "MODEL_INVARIANT_ID", instanceGroup.getModelInvariantUUID()); - put(valueMap, "MODEL_VERSION", instanceGroup.getModelUUID()); + put(valueMap, "MODEL_VERSION", instanceGroup.getModelVersion()); } String subItem = new QueryVnfcs(vnfcCustomizationNull ? null : o.getVnfcCustomizations()).JSON2(true, true); diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java index 589f119337..f2e0762a79 100644 --- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java +++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java @@ -48,6 +48,7 @@ import org.onap.so.adapters.catalogdb.catalogrest.QueryServiceVnfs; import org.onap.so.adapters.catalogdb.catalogrest.QueryVfModule; import org.onap.so.db.catalog.beans.AllottedResource; import org.onap.so.db.catalog.beans.AllottedResourceCustomization; +import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkResource; import org.onap.so.db.catalog.beans.NetworkResourceCustomization; import org.onap.so.db.catalog.beans.Recipe; @@ -55,11 +56,13 @@ import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.beans.ToscaCsar; import org.onap.so.db.catalog.beans.VfModule; import org.onap.so.db.catalog.beans.VfModuleCustomization; +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.data.repository.AllottedResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; import org.onap.so.db.catalog.data.repository.ArRecipeRepository; +import org.onap.so.db.catalog.data.repository.InstanceGroupRepository; import org.onap.so.db.catalog.data.repository.NetworkRecipeRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.NetworkResourceRepository; @@ -120,6 +123,9 @@ public class CatalogDbAdapterRest { @Autowired private AllottedResourceRepository arResourceRepo; + @Autowired + private InstanceGroupRepository instanceGroupRepository; + private static final String NO_MATCHING_PARAMETERS = "no matching parameters"; public Response respond(String version, int respStatus, boolean isArray, CatalogQuery qryResp) { @@ -536,6 +542,16 @@ public class CatalogDbAdapterRest { arResource.getModelVersion()); } } + + if (null == recipe) { + InstanceGroup grpResource = instanceGroupRepository.findByModelUUID(rmUuid); + if (grpResource != null) { + recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndActionAndVersionStr( + grpResource.getModelName(), action, grpResource.getModelVersion()); + } + + } + if (recipe != null) { QueryResourceRecipe resourceRecipe = new QueryResourceRecipe(recipe); entity = resourceRecipe.JSON2(false, false); |