-
- Response response = get(getHostAddr(), getPath(serviceInstancePath));
- if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
- throw new RuntimeException("Failed to connect to AAI. Cause: "
- + response.getStatusInfo().getReasonPhrase());
- }
- JSONArray instances = getInstances(JSONObject.toJSONString(response.getEntity()));
- for (int i = 0; i < instances.size(); ++i) {
- JSONObject instance = instances.getJSONObject(i);
- Response res = get(getHostAddr(), serviceInstancePath + "/service-instances?service-instance-id="
- + instance.getString("service-instance-id"));
- if (res.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {
- throw new RuntimeException("Failed to connect to AAI. Cause: "
- + response.getStatusInfo().getReasonPhrase());
- }
- String inputParams = JSONObject.parseObject(response.readEntity(String.class)).getString("input-parameters");
- instance.put("input-parameters", inputParams);
- instance.put("globalSubscriberId", params[0]);
- instance.put("serviceType", params[1]);
- }
-
- return instances;
+ instance.put("globalSubscriberId", params[0]);
+ instance.put("serviceType", params[1]);
+ return instance;