From 03f54a0b7de599e0a012ff6d35d0e74e20ca36c2 Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Sun, 1 Sep 2019 16:24:41 +0300 Subject: add getNewestModelVersionByInvariant to controller and service Also add testGetActiveNetworkList UT Issue-ID: VID-378 Signed-off-by: Eylon Malin Change-Id: I97c2ae029272aba915d5f9699bccff0eb9d49329 Signed-off-by: Eylon Malin --- .../src/main/java/org/onap/vid/controller/AaiController2.java | 7 +++++++ vid-app-common/src/main/java/org/onap/vid/services/AaiService.java | 3 +++ .../src/main/java/org/onap/vid/services/AaiServiceImpl.java | 5 +++++ 3 files changed, 15 insertions(+) (limited to 'vid-app-common/src/main/java/org/onap') diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java index d7d2f85db..e0d211c24 100644 --- a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java +++ b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java @@ -24,6 +24,7 @@ import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.onap.vid.aai.AaiClientInterface; import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse; +import org.onap.vid.aai.model.ModelVer; import org.onap.vid.aai.model.Permissions; import org.onap.vid.model.aaiTree.Network; import org.onap.vid.model.aaiTree.RelatedVnf; @@ -116,4 +117,10 @@ public class AaiController2 extends VidRestrictedBaseController { .filter(network -> StringUtils.equalsIgnoreCase(network.getOrchStatus(), "active")) .collect(Collectors.toList()); } + + @RequestMapping(value = "/aai_get_newest_model_version_by_invariant/{invariantId}", + method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) + public ModelVer getNewestModelVersionByInvariant(@PathVariable("invariantId") String invariantId) { + return aaiService.getNewestModelVersionByInvariantId(invariantId); + } } diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiService.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiService.java index 31fbe65d8..bc26b5eb0 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/AaiService.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiService.java @@ -32,6 +32,7 @@ import org.onap.vid.aai.model.AaiGetInstanceGroupsByCloudRegion; import org.onap.vid.aai.model.AaiGetOperationalEnvironments.OperationalEnvironmentList; import org.onap.vid.aai.model.AaiGetPnfs.Pnf; import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse; +import org.onap.vid.aai.model.ModelVer; import org.onap.vid.aai.model.PortDetailsTranslator; import org.onap.vid.asdc.beans.Service; import org.onap.vid.model.SubscriberList; @@ -99,4 +100,6 @@ public interface AaiService { List getVpnListByVpnType(String vpnType); List getL3NetworksByCloudRegion(String cloudRegionId, String tenantId, String networkRole); + + ModelVer getNewestModelVersionByInvariantId(String modelInvariantId); } diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java index b50dcc3b5..b6404fa68 100644 --- a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java +++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java @@ -702,4 +702,9 @@ public class AaiServiceImpl implements AaiService { return "{\"start\":\"/cloud-infrastructure/cloud-regions/cloud-region/" + cloudOwner + "/" + cloudRegionId + "\"," + "\"query\":\"query/l3-networks-by-cloud-region?tenantId=" + tenantId + networkRolePart + "\"}"; } + + @Override + public ModelVer getNewestModelVersionByInvariantId(String modelInvariantId){ + return aaiClient.getLatestVersionByInvariantId(modelInvariantId); + } } -- cgit 1.2.3-korg