summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml5
-rw-r--r--rules/ccvpn-rule.drl15
-rw-r--r--rules/ccvpn2-rule.drl17
-rw-r--r--rules/mdons-rule.drl8
-rw-r--r--rules/volte-rule.drl8
5 files changed, 28 insertions, 25 deletions
diff --git a/pom.xml b/pom.xml
index f0935b7..43be3b0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -373,6 +373,11 @@
<version>${jersey.version}</version>
</dependency>
<dependency>
+ <groupId>org.glassfish.jersey.ext</groupId>
+ <artifactId>jersey-entity-filtering</artifactId>
+ <version>${jersey.version}</version>
+ </dependency>
+ <dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>${jersey.version}</version>
diff --git a/rules/ccvpn-rule.drl b/rules/ccvpn-rule.drl
index 2778ad1..bbde4e9 100644
--- a/rules/ccvpn-rule.drl
+++ b/rules/ccvpn-rule.drl
@@ -9,10 +9,9 @@ import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.common.dmaap.entity.PolicyMsg;
import org.onap.holmes.common.dmaap.DmaapService;
import org.onap.holmes.common.utils.DroolsLog;
-import org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder;
+import org.onap.holmes.common.utils.SpringContextUtil;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
+import com.google.gson.JsonObject;
import java.util.List;
import java.util.Map;
@@ -76,13 +75,13 @@ 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();
- JSONObject instance = aai.getServiceInstance(networkId, pnfName, ifName, status);
+ 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("service-instance.service-instance-id", instance.get("service-instance-id").getAsString());
ret.put("vserver.vserver-name", "TBD");
- ret.put("globalSubscriberId", instance.getString("globalSubscriberId"));
- ret.put("serviceType", instance.getString("serviceType"));
+ ret.put("globalSubscriberId", instance.get("globalSubscriberId").getAsString());
+ ret.put("serviceType", instance.get("serviceType").getAsString());
ret.put("network-information.network-id", networkId);
return ret;
@@ -142,7 +141,7 @@ rule "Set Up Correlation"
// If any of the alarms have been marked as root, a policy message has ever been created and sent. Do NOT send it again.
if ($a.getRootFlag() != 1 && $b.getRootFlag() != 1) {
PolicyMsg msg = createPolicyMsg($a);
- DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);
+ DmaapService dmaapService = SpringContextUtil.getBean(DmaapService.class);
dmaapService.publishPolicyMsg(msg, "dcae_cl_out");
updateAaiLinkStatus(getLogicLink($a), status);
}
diff --git a/rules/ccvpn2-rule.drl b/rules/ccvpn2-rule.drl
index 0d34932..54fa8a2 100644
--- a/rules/ccvpn2-rule.drl
+++ b/rules/ccvpn2-rule.drl
@@ -9,10 +9,9 @@ dialect "java"
import org.onap.holmes.common.dmaap.entity.PolicyMsg;
import org.onap.holmes.common.dmaap.DmaapService;
import org.onap.holmes.common.utils.DroolsLog;
- import org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder;
+ import org.onap.holmes.common.utils.SpringContextUtil;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
+ import com.google.gson.JsonObject;
import java.util.List;
import java.util.Map;
@@ -32,17 +31,17 @@ dialect "java"
function Map<String, Object> getAdditionalResourceInfo(VesAlarm a, String bandwidth) {
AaiQuery4Ccvpn2 aai = AaiQuery4Ccvpn2.newInstance();
- JSONObject instance = aai.getServiceInstance(getAdditionalField(a, "siteService"));
+ JsonObject instance = aai.getServiceInstance(getAdditionalField(a, "siteService"));
Map<String, Object> ret = new HashMap<String, Object>();
- ret.put("service-instance.service-instance-id", instance.getString("service-instance-id"));
+ ret.put("service-instance.service-instance-id", instance.get("service-instance-id").getAsString());
ret.put("vserver.vserver-name", "TBD");
- ret.put("globalSubscriberId", instance.getString("globalSubscriberId"));
- ret.put("serviceType", instance.getString("serviceType"));
+ ret.put("globalSubscriberId", instance.get("globalSubscriberId").getAsString());
+ ret.put("serviceType", instance.get("serviceType").getAsString());
ret.put("vserver.is-closed-loop-disabled", "false");
ret.put("vserver.prov-status", "ACTIVE");
ret.put("bandwidth", bandwidth);
ret.put("bandwidth-change-time", getAdditionalField(a, "timestamp"));
- ret.put("vnfId", instance.getString("vnfId"));
+ ret.put("vnfId", instance.get("vnfId").getAsString());
return ret;
}
@@ -75,7 +74,7 @@ dialect "java"
bandwidth = "10000";
}
PolicyMsg msg = createPolicyMsg($a, bandwidth);
- DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);
+ DmaapService dmaapService = SpringContextUtil.getBean(DmaapService.class);
dmaapService.publishPolicyMsg(msg, "dcae_cl_out");
$a.setRootFlag(1);
end
diff --git a/rules/mdons-rule.drl b/rules/mdons-rule.drl
index 4b7dc01..9f4d6ed 100644
--- a/rules/mdons-rule.drl
+++ b/rules/mdons-rule.drl
@@ -8,7 +8,7 @@ import org.onap.holmes.common.exception.CorrelationException;
import org.onap.holmes.common.dmaap.entity.PolicyMsg;
import org.onap.holmes.common.dmaap.DmaapService;
import org.onap.holmes.common.utils.DroolsLog;
-import org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder;
+import org.onap.holmes.common.utils.SpringContextUtil;
import org.onap.holmes.common.dmaap.store.UniqueRequestIdCache;
@@ -51,7 +51,7 @@ function PolicyMsg createPolicyMsg(VesAlarm alarm, String serviceInstanceId, Str
m.setTarget("vserver.vserver-name");
m.setAai(getAaiObjectPolicy(serviceName, serviceInstanceId));
- ServiceLocatorHolder.getLocator().getService(UniqueRequestIdCache.class).put(alarm.getEventId(), m.getRequestID());
+ SpringContextUtil.getBean(UniqueRequestIdCache.class).put(alarm.getEventId(), m.getRequestID());
return m;
}
@@ -74,7 +74,7 @@ rule "Process Alarms MSA"
Map<String, String> map = processAlarm($a.getSourceId() + "-XPDR1");
for(Map.Entry<String,String> entry : map.entrySet()){
PolicyMsg msg = createPolicyMsg($a, entry.getKey(), entry.getValue());
- DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);
+ DmaapService dmaapService = SpringContextUtil.getBean(DmaapService.class);
dmaapService.publishPolicyMsg(msg, "dcae_cl_out");
DroolsLog.printInfo("Published to policy=" + msg.toString());
@@ -94,7 +94,7 @@ rule "Process Alarms TAPI"
Map<String, String> map = processAlarm($a.getEventId());
for(Map.Entry<String,String> entry : map.entrySet()){
PolicyMsg msg = createPolicyMsg($a, entry.getKey(), entry.getValue());
- DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);
+ DmaapService dmaapService = SpringContextUtil.getBean(DmaapService.class);
dmaapService.publishPolicyMsg(msg, "dcae_cl_out");
DroolsLog.printInfo("Published to policy=" + msg.toString());
diff --git a/rules/volte-rule.drl b/rules/volte-rule.drl
index 5d6e56e..f800518 100644
--- a/rules/volte-rule.drl
+++ b/rules/volte-rule.drl
@@ -4,7 +4,7 @@ import org.onap.holmes.common.dmaap.DmaapService;
import org.onap.holmes.common.api.stat.VesAlarm;
import org.onap.holmes.common.aai.CorrelationUtil;
import org.onap.holmes.common.dmaap.entity.PolicyMsg;
-import org.onap.holmes.common.dropwizard.ioc.utils.ServiceLocatorHolder;
+import org.onap.holmes.common.utils.SpringContextUtil;
import org.onap.holmes.common.utils.DroolsLog;
@@ -36,7 +36,7 @@ no-loop true
$child : VesAlarm(eventId != $eventId, parentId == $eventId)
then
DroolsLog.printInfo("Root alarm: ID=" + $root.getEventId() + ", Event Name=" + $root.getEventName());
- DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);
+ DmaapService dmaapService = SpringContextUtil.getBean(DmaapService.class);
PolicyMsg policyMsg = dmaapService.getPolicyMsg($root, $child, "org.onap.holmes.droolsRule");
dmaapService.publishPolicyMsg(policyMsg, "dcae_cl_out");
$root.setRootFlag(1);
@@ -53,7 +53,7 @@ no-loop true
eventName in ("Fault_MultiCloud_VMFailure"))
then
DroolsLog.printInfo("New alarm: ID=" + $root.getEventId() + ", Event Name=" + $root.getEventName());
- DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);
+ DmaapService dmaapService = SpringContextUtil.getBean(DmaapService.class);
PolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, "org.onap.holmes.droolsRule");
dmaapService.publishPolicyMsg(policyMsg, "dcae_cl_out");
$root.setRootFlag(1);
@@ -67,7 +67,7 @@ no-loop true
$root : VesAlarm(alarmIsCleared == 1, rootFlag == 1)
then
DroolsLog.printInfo("Alarm cleared: ID=" + $root.getEventId() + ", Event Name=" + $root.getEventName());
- DmaapService dmaapService = ServiceLocatorHolder.getLocator().getService(DmaapService.class);
+ DmaapService dmaapService = SpringContextUtil.getBean(DmaapService.class);
PolicyMsg policyMsg = dmaapService.getPolicyMsg($root, null, "org.onap.holmes.droolsRule");
dmaapService.publishPolicyMsg(policyMsg, "dcae_cl_out");
retract($root);