From d959be5b9801e86f8c32311ba36622601a3bf7d2 Mon Sep 17 00:00:00 2001 From: Vidyashree Rama Date: Wed, 12 Sep 2018 17:53:17 +0530 Subject: Fixed CCVPN closed loop integration issue 1.Service instance will be single instance not list of instances Issue-ID: HOLMES-166 Change-Id: Ia69d5966ab759909d77c224bc5eff1edfa40cba9 Signed-off-by: Vidyashree Rama --- rules/ccvpn-rule.drl | 35 ++++++++++++----------------------- 1 file changed, 12 insertions(+), 23 deletions(-) diff --git a/rules/ccvpn-rule.drl b/rules/ccvpn-rule.drl index e006dbb..1f2d82d 100644 --- a/rules/ccvpn-rule.drl +++ b/rules/ccvpn-rule.drl @@ -75,28 +75,17 @@ function void updateAaiTpStatus(String networkId, String pnfName, String ifName, } function Map getAdditionalResourceInfo(String networkId, String pnfName, String ifName, String status) { - AaiQuery4Ccvpn aai = AaiQuery4Ccvpn.newInstance(); - JSONArray instances = aai.getServiceInstances(networkId, pnfName, ifName, status); - - Map ret = new HashMap(); - - StringBuilder sbn = new StringBuilder(); - StringBuilder sbi = new StringBuilder(); - for(int i = 0; i < instances.size(); ++i) { - JSONObject o = instances.getJSONObject(i); - String name = o.getString("service-instance-name"); - String id = o.getString("service-instance-id"); - ret.put(id + ".input-parameters", o.getString("input-parameters")); - sbn.append(name).append(","); - sbi.append(id).append(","); - } - ret.put("service-instance.service-instance-name", sbn.substring(0, sbn.length() -1).toString()); - ret.put("service-instance.service-instance-id", sbi.substring(0, sbi.length() -1).toString()); - ret.put("vserver.vserver-name", "TBD"); - ret.put("globalSubscriberId", instances.getJSONObject(0).getString("globalSubscriberId")); - ret.put("serviceType", instances.getJSONObject(0).getString("serviceType")); - - return ret; + AaiQuery4Ccvpn aai = AaiQuery4Ccvpn.newInstance(); + JSONObject instance = aai.getServiceInstance(networkId, pnfName, ifName, status); + + Map ret = new HashMap(); + ret.put("service-instance.service-instance-id", instance.getString("service-instance-id")); + ret.put("vserver.vserver-name", "TBD"); + ret.put("globalSubscriberId", instance.getString("globalSubscriberId")); + ret.put("serviceType", instance.getString("serviceType")); + ret.put("network-information.network-id", networkId); + + return ret; } function PolicyMsg createPolicyMsg(VesAlarm alarm) { @@ -181,4 +170,4 @@ rule "Clear Alarms" retract($a); } -end \ No newline at end of file +end -- cgit 1.2.3-korg