diff options
-rw-r--r-- | rules/ccvpn-rule.drl | 35 |
1 files 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<String, Object> getAdditionalResourceInfo(String networkId, String pnfName, String ifName, String status) { - AaiQuery4Ccvpn aai = AaiQuery4Ccvpn.newInstance(); - JSONArray instances = aai.getServiceInstances(networkId, pnfName, ifName, status); - - Map<String, Object> ret = new HashMap<String, Object>(); - - 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<String, Object> ret = new HashMap<String, Object>(); + 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 |