Absent Member.. Sam_Fowler Absent Member..
Absent Member..

SLM Groovy Rule

Hi All,


I'm trying to implement an SLM Groovy Business Rule, but I'm having some issues, I'm wondering if anyone can shed some light on this:


Using the Availability KPI, this business rule is intended to calculate the product of the Child CIs KPI value. However, during testing to see if I can return the KPI value of the CIs I get the following error in the Bambino log:


MERQ-120920: Can not calculate KPI since its CalculationRule was not found.


The Business Rule was created by cloning the API Group and Sibling rule in the repository and amending the class path to point to the groovy file, as stated in the docs.


My current groovy script is set to list the child KPIs and print out their value in the debug log, so I can see if any are returned before I start writing the calculation logic (also set the kpi value to 100 - just for good measure)


I noticed, if I just had a groovy script to set kpi.value = 100; it works without issue, but when calculating child KPIs, it causes issues.


Below are the contents of SamTestRuleSAI_8.groovy:


import com.hp.am.platform.processing.ble.groovy.rulefwk.simplifiedRule.wrapper.ci.CI

import com.hp.am.platform.processing.ble.groovy.rulefwk.simplifiedRule.wrapper.hi.HI

import com.hp.am.platform.processing.ble.groovy.rulefwk.simplifiedRule.wrapper.kpi.KPI

import com.hp.am.platform.processing.ble.groovy.rulefwk.simplifiedRule.wrapper.kpiType.KpiType;

import com.hp.am.platform.processing.ble.groovy.rulefwk.simplifiedRule.wrapper.kpiType.KpiTypeFactory;

import com.hp.am.platform.processing.ble.groovy.rulefwk.simplifiedRule.wrapper.status.Status;

import com.hp.am.platform.processing.ble.groovy.rulefwk.simplifiedRule.wrapper.calcUtils.Utils;

import com.mercury.am.rules.groovy.slm.simplifiedRule.groupAndSiblingRule.SlmGroovyGroupAndSiblingRule;


* Template file for the API Group And Sibling Rule, which implements the GroupAndSiblingCalculator interface.


* For more information refer to the Rules API documentation.


* NOTE: In the next line, change the "SlmGroupAndSiblingTemplate" class name.


public class SamTestRuleSAI_8 extends SlmGroovyGroupAndSiblingRule {


     * Implementation of the GroupAndSiblingCalculator interface method.

     * For more information refer to the method documentation in the GroupAndSiblingCalculator interface.



            public void calculateKPI(CI ci, KPI kpi) {

        // Write the method implementation here.

            List kpiList = ci.getAllChildrenKPIs()

            kpiList.each {KPI childKPI ->

            logger.debug("Sam Test Rule (IGNORE): Child KPI List = " + childKPI.value;}

            kpi.value = 100;






If you require any more info and/or further clarification, please ask.


Thanks in advance.




The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.