diff options
author | Guangrong Fu <fu.guangrong@zte.com.cn> | 2018-09-14 14:26:22 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2018-09-14 14:26:22 +0000 |
commit | 9774086248a9902895fe347b4b9a0ac63e0bbf84 (patch) | |
tree | c9c3dcf643e7e1622f6ff4a4c6a0d58e3f53c1c2 /rules/ccvpn-rule.drl | |
parent | 3a9ad3ee712a697f1693cab61e22085dc5506bce (diff) | |
parent | d959be5b9801e86f8c32311ba36622601a3bf7d2 (diff) |
Merge "Fixed CCVPN closed loop integration issue"
Diffstat (limited to 'rules/ccvpn-rule.drl')
-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 |