- try {
- JsonObject vpnBindingInfo = getVpnBindingInfo(networkId, pnfName, ifName, status);
- if (vpnBindingInfo == null) {
- log.warn(String.format("VPN binding information is missing from AAI. " +
- "Method: [getServiceInstance], params: [networkId - %s, pnfName - %s, " +
- "ifName - %s, status - %s].", networkId, pnfName, ifName, status));
- return EMPTY_JSON;
- }
- String vpnBindingId = extractValueFromJsonArray(vpnBindingInfo.get("relationship-data").getAsJsonArray(),
- "vpn-binding.vpn-id");
- JsonObject connectivityInfo = getConnectivityInfo(vpnBindingId);
- if (connectivityInfo == null) {
- log.warn(String.format("Connectivity information is missing from AAI. " +
- "Method: [getServiceInstance], params: [networkId - %s, pnfName - %s, " +
- "ifName - %s, status - %s].", networkId, pnfName, ifName, status));
- return EMPTY_JSON;
- }
- String connectivityId = extractValueFromJsonArray(connectivityInfo.get("relationship-data").getAsJsonArray(),
- "connectivity.connectivity-id");
- JsonObject serviceInstanceInfo = getServiceInstanceByConn(connectivityId);
- if (serviceInstanceInfo == null) {
- log.warn(String.format("Service instance information is missing from AAI. " +
- "Method: [getServiceInstance], params: [networkId - %s, pnfName - %s, " +
- "ifName - %s, status - %s].", networkId, pnfName, ifName, status));
- return EMPTY_JSON;
- }
- String serviceInstancePath = serviceInstanceInfo.get("related-link").getAsString();
-
- Response response = get(getHostAddr(), getPath(serviceInstancePath));
- JsonObject instance = JsonParser.parseString(response.readEntity(String.class)).getAsJsonObject();
-
- String[] params = new String[2];
- Pattern pattern = Pattern.compile("/aai/v\\d+/business/customers/customer/(.+)" +
- "/service-subscriptions/service-subscription/(.+)" +
- "/service-instances/service-instance/(.+)");
- Matcher matcher = pattern.matcher(serviceInstancePath);
- if (matcher.find()) {
- params[0] = matcher.group(1);
- params[1] = matcher.group(2);
- }
- instance.addProperty("globalSubscriberId", params[0]);
- instance.addProperty("serviceType", params[1]);
- return instance;
- } catch (CorrelationException e) {
- throw new RuntimeException(e.getMessage(), e);
+ JsonObject vpnBindingInfo = getVpnBindingInfo(networkId, pnfName, ifName, status);
+ if (vpnBindingInfo == null) {
+ log.warn(String.format("VPN binding information is missing from AAI. " +
+ "Method: [getServiceInstance], params: [networkId - %s, pnfName - %s, " +
+ "ifName - %s, status - %s].", networkId, pnfName, ifName, status));
+ return EMPTY_JSON;
+ }
+ String vpnBindingId = extractValueFromJsonArray(vpnBindingInfo.get("relationship-data").getAsJsonArray(),
+ "vpn-binding.vpn-id");
+ JsonObject connectivityInfo = getConnectivityInfo(vpnBindingId);
+ if (connectivityInfo == null) {
+ log.warn(String.format("Connectivity information is missing from AAI. " +
+ "Method: [getServiceInstance], params: [networkId - %s, pnfName - %s, " +
+ "ifName - %s, status - %s].", networkId, pnfName, ifName, status));
+ return EMPTY_JSON;
+ }
+ String connectivityId = extractValueFromJsonArray(connectivityInfo.get("relationship-data").getAsJsonArray(),
+ "connectivity.connectivity-id");
+ JsonObject serviceInstanceInfo = getServiceInstanceByConn(connectivityId);
+ if (serviceInstanceInfo == null) {
+ log.warn(String.format("Service instance information is missing from AAI. " +
+ "Method: [getServiceInstance], params: [networkId - %s, pnfName - %s, " +
+ "ifName - %s, status - %s].", networkId, pnfName, ifName, status));
+ return EMPTY_JSON;