aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/onap/vid/controller
diff options
context:
space:
mode:
authoras221v <as221v@intl.att.com>2019-09-09 17:56:41 +0300
committerAlexey Sandler <alexey.sandler@intl.att.com>2019-09-12 15:55:52 +0300
commitc4814252e8ef58dde843824d1c4d57ea708a961e (patch)
treeb870ffa4e3fbc4791b87fcbc2815a6dec7f97276 /vid-app-common/src/main/java/org/onap/vid/controller
parent2609cc76f0565466667fff8ae4d0707b94993877 (diff)
Reduce vnf data response from A&AI in change management flows
Issue-ID: VID-596 Signed-off-by: Amir Skalka <as221v@intl.att.com> Change-Id: I4462ef0c2dbc9880d1a0d204f6552e3842aad821 Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/onap/vid/controller')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java31
1 files changed, 26 insertions, 5 deletions
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 e0d211c24..d1f7a97b5 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
@@ -20,7 +20,9 @@
package org.onap.vid.controller;
+import java.util.List;
import java.util.stream.Collectors;
+import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang3.StringUtils;
import org.onap.vid.aai.AaiClientInterface;
import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
@@ -29,15 +31,20 @@ import org.onap.vid.aai.model.Permissions;
import org.onap.vid.model.aaiTree.Network;
import org.onap.vid.model.aaiTree.RelatedVnf;
import org.onap.vid.model.aaiTree.VpnBinding;
+import org.onap.vid.properties.Features;
import org.onap.vid.roles.RoleProvider;
import org.onap.vid.services.AaiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestController;
+import org.togglz.core.manager.FeatureManager;
/**
* Controller to handle a&ai new requests.
@@ -49,12 +56,14 @@ public class AaiController2 extends VidRestrictedBaseController {
private final AaiService aaiService;
private final RoleProvider roleProvider;
private final AaiClientInterface aaiClient;
+ private final FeatureManager featureManager;
@Autowired
- public AaiController2(AaiService aaiService, RoleProvider roleProvider, AaiClientInterface aaiClient) {
+ public AaiController2(AaiService aaiService, RoleProvider roleProvider, AaiClientInterface aaiClient, FeatureManager featureManager) {
this.aaiService = aaiService;
this.roleProvider = roleProvider;
this.aaiClient = aaiClient;
+ this.featureManager = featureManager;
}
@RequestMapping(value = "/aai_get_homing_by_vfmodule/{vnfInstanceId}/{vfModuleId}", method = RequestMethod.GET)
@@ -123,4 +132,16 @@ public class AaiController2 extends VidRestrictedBaseController {
public ModelVer getNewestModelVersionByInvariant(@PathVariable("invariantId") String invariantId) {
return aaiService.getNewestModelVersionByInvariantId(invariantId);
}
+
+ @GetMapping(value = "/get_vnf_data_by_globalid_and_service_type/{globalCustomerId}/{serviceType}")
+ public Object getVnfDataByGlobalIdAndServiceType(
+ @PathVariable("globalCustomerId") String globalCustomerId,
+ @PathVariable("serviceType") String serviceType,
+ @RequestParam(name="nfRole", required = false) String nfRole,
+ @RequestParam(name="cloudRegion", required = false) String cloudRegion) {
+ if (featureManager.isActive(Features.FLAG_FLASH_REDUCED_RESPONSE_CHANGEMG)){
+ return aaiClient.getVnfsByParamsForChangeManagement(globalCustomerId, serviceType, nfRole, cloudRegion).getT();
+ }
+ return aaiService.getVNFData(globalCustomerId, serviceType).getT();
+ }
}