PropGen - The Ruleset Plug-in

Program ID

MTPipeline.PropGenProcessor.1

Description

The RuleSet plug-in is a powerful and rapid way of evaluating conditions and one or more actions. The conditions are based on session variables, and the actions set properties in the session. In a billing pipeline, rulesets are often used to determine an applicable rate or discount.

Every ruleset must contain a default action. Even if a pipeline is not configured to use the default action, the Ruleset plug-in does not function properly without it. If no other rules apply or exist, the default actions are used. If you need to set properties in the session that are not part of the metered data, it may be useful to use a ruleset with only a default action. Note that the RuleSet plug-in evaluates every applicable action set, and that you must have one or more actions.

The formats for the syntax of the default actions follow:

<configdata>
  <default_actions>
  <action>
  </action>
  <action>
  </action>
  </default_actions>

or

<configdata>
  <actions>
    <action>
    </action>
    <action>
    </action>
  <actions>

<configdata>
  <action>
  </action>
 

or

<configdata>
  <default_actions>
    <action>
    </action>  </default_actions>

In the following sample configuration information, the default action sets the DiscountRate property to 3 and the DiscountRateType to percent:

<configdata>
  <action>
    <prop_name>DiscountRate</prop_name>
    <prop_value ptype="decimal">3<prop_value>
  </action>
  <action>
    <prop_name>DiscountRateType</prop_name>
    <prop_value>percent</prop_value>
  </action>
</configdata>

To determine what actions to apply, a ruleset uses conditions. Default actions have an empty list of conditions. Ruleset conditions are logically ANDed together to determine a Boolean result. For example:

If (( Condition1 And Condition2 And &ldots; ConditionN)
  then
    Evaluate Action 1)
Elseif ((Condition1 And Condition2 And &ldots; ConditionN)
  then
    Evaluate Action 2)
Elseif evaluate default actions

The ruleset is read from top to bottom. It stops on the first condition set where all conditions are true. If you want to evaluate all the condition sets, use multiple ruleset files. A mechanism to perform this action will be provided in the future.

All string conditions are evaluated using comparison that is not case sensitive. The following values are supported in the <condition> tag:

Required Input Properties

N/A

Required Output Properties

N/A

Additional Configuration Tags

N/A

Configuration Example

In the following sample configuration information, the Ruleset plug-in checks whether the session properties meet the conditions in each <constraint> of each <constraint_set>. If there is more than one constraint in a set, the session properties must meet the conditions of each constraint to meet the conditions for the set. If all the constraints for a set are not met, the plug-in compares the session properties against the constraints of the next set. If a session property meets all the constraints of a set, its value is set and the Pipeline server runs the next plug-in in the stage. If a session property meets none of the conditions in the sets, the default actions occur and the Pipeline server runs the next plug-in in the stage.

<configdata>
  <!-- This is the default action -->
  <action>
    <prop_name>Product_ID</prop_name>
    <prop_value>PRODUCT0</prop_value>
  </action>
  <constraint_set>
    <action>
      <prop_name>Product_ID</prop_name>
      <prop_value>PRODUCT1</prop_value>
    </action>
    <constraint>
      <prop_name>Service_ID</prop_name>
      <condition>equal</condition>
      <prop_value ptype="INTEGER">1</prop_value>
    </constraint>
    <constraint>
    <prop_name>Tariff</prop_name>
    <condition>equal</condition>
    <prop_value>IBM</prop_value>
    </constraint>
  </constraint_set>
  <constraint_set>
    <action>
      <prop_name>Product_ID</prop_name>
      <prop_value>PRODUCT2</prop_value>
    </action>
    <constraint>
      <prop_name>Service_ID</prop_name>
      <condition>equal</condition>
      <prop_value ptype="INTEGER">2</prop_value>
    </constraint>
    <constraint>
      <prop_name>Tariff</prop_name>
      <condition>equal</condition>
      <prop_value>MCI</prop_value>
    </constraint>
  </constraint_set>
</configdata>