summaryrefslogtreecommitdiffstats
path: root/vid-app-common
diff options
context:
space:
mode:
authorEylon Malin <eylon.malin@intl.att.com>2019-08-06 19:23:29 +0300
committerEylon Malin <eylon.malin@intl.att.com>2019-08-06 19:23:29 +0300
commit4e965d4d4f40e17841e329d0cff938b029aed89a (patch)
tree5874ba2a6853224bf020278f147a2babd9b136db /vid-app-common
parentb3568581e94345f0753b060158273c57892686dd (diff)
add endpoints for getVpnList and getActiveNetworkList
Issue-ID: VID-378 Signed-off-by: Eylon Malin <eylon.malin@intl.att.com> Change-Id: Iede126556df337b1ab70dd76c9452f4b51e11376
Diffstat (limited to 'vid-app-common')
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java21
1 files changed, 21 insertions, 0 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 19187e0fc..d7d2f85db 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,10 +20,14 @@
package org.onap.vid.controller;
+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.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.roles.RoleProvider;
import org.onap.vid.services.AaiService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -94,5 +98,22 @@ public class AaiController2 extends VidRestrictedBaseController {
return aaiService.searchGroupMembers(globalCustomerId, serviceType, invariantId, groupType, groupRole);
}
+ @RequestMapping(value = "/aai_get_vpn_list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public List<VpnBinding> getVpnList() {
+ return aaiService.getVpnListByVpnType("SERVICE-INFRASTRUCTURE");
+ }
+ @RequestMapping(value = "/aai_get_active_networks",
+ method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public List<Network> getActiveNetworkList(
+ @RequestParam("cloudRegion") String cloudRegion,
+ @RequestParam("tenantId") String tenantId,
+ @RequestParam(value = "networkRole", required = false) String networkRole) {
+ return aaiService.getL3NetworksByCloudRegion(cloudRegion, tenantId, networkRole)
+ .stream()
+ .filter(Network::isBoundToVpn)
+ .filter(network -> StringUtils.isNotEmpty(network.getInstanceName()))
+ .filter(network -> StringUtils.equalsIgnoreCase(network.getOrchStatus(), "active"))
+ .collect(Collectors.toList());
+ }
}