Open APIs

 View Only
  • 1.  Is it possible to use two or more VARIABLEs in a PolicyStatement (PolicyCondition)?

    TM Forum Member
    Posted Jun 29, 2023 10:40
    Edited by Anton Tsapko Jun 29, 2023 10:47
    Hello everyone,
     
    working on a price policy administration / policy authoring system that stores ProductOfferings and price models, I ask myself if it is possible to use two variables in a policyStatement with TMF as following:
     
    IF total_sum_of_SUB-Bundle1 < total_sum_of_SUB-Bundle2 INCLUDE INTO BUDNLE CALCULATION total_sum_of_SUB-Bundle3
    .
    So in this example a price policy with variables is used where they are matched against each other: the total_sum_of_SUB-Bundle3 should be included into the total calculation of the whole BUDNLE only if total sum of bundle1 is smaller than total sum of bundle 2.
    .
    With bundle structure:
    -BUNDLE
    -SUB-Bundle1
    Product A (usage based pricing)
    Product B (usage based pricing)
    -SUB-Bundle2
    Product X (usage based pricing)
    Prodcut Y (usage based pricing)
    -SUB-Bundle3
    Product F (flat rate pricng)
    Product G (flat rate pricng)
    .
    I read GB922_Product_v22.5.pdf (pages 86++) and GB922_Common_v22.5.pdf (pages 556++) and lurked into the to be released soon TMF723-Policy_Management-v5.0.0.oas.yaml. It appears to me that a PolicyConditionStatement in PolicyConfition always has only one variable as shown in the following pic and it is impossible to use more than one variable.
    .
    Am I correct in assuming that it is impossible to use two or more variables and thus not possible to model more complex rules as the example shown above?
    If it is not possible to use two variables, how would I go about implementing a pricing policy like shown above using TMF?
    .
    Best Regards
    Anton



    ------------------------------
    Anton Tsapko
    conology
    ------------------------------



  • 2.  RE: Is it possible to use two or more VARIABLEs in a PolicyStatement (PolicyCondition)?

    TM Forum Member
    Posted Jul 02, 2023 01:27

    Hi Anton

    Probably you would create a statement for each variable, and then combine the statements. I would suggest to check with @Ivan Sokol who is the lead for the new Policy API.

    Hope it helps



    ------------------------------
    Jonathan Goldberg
    Amdocs Management Limited
    Any opinions and statements made by me on this forum are purely personal, and do not necessarily reflect the position of the TM Forum or my employer.
    ------------------------------



  • 3.  RE: Is it possible to use two or more VARIABLEs in a PolicyStatement (PolicyCondition)?

    TM Forum Member
    Posted Jul 02, 2023 10:36
    Edited by Anton Tsapko Jul 02, 2023 10:56

    @Jonathan Goldberg , I am glad you replied. 

    My first thought was the same - to create a nested statement for each variable. But as I understand the definitions, the "grammar" chosen at the moment does not allow policyStatements to have nested policyStatements, only variables and values (literals). Just as it does not allow two variables to be used within one policyStatement. So the grammar only allows simple logic like: [anyOf, allOf, oneOf, none: policyCondition1, policyCondition2]. Unfortunatly "Value" in a policyStatement cannot point to another "policyStatement" or condition for nesting. This is an important limitation.

    • policyStatement1Variable1 [total_sum_bundle1] Operator [<] ValueX  [10.000]
    • policyStatement2Variable2 [total_sum_bundle2] Operator [<] ValueY [5.000]

    .
    Not possible:

    • somePolicyStatement: Variable1 [total_sum_bundle1] Operator [<]  policyStatement2

    .

    What would be proper way to reach @Ivan Sokol ? Would that be by E-Mail or rather using this forum?

    Best Regards

    Anton



    ------------------------------
    Anton Tsapko
    conology
    ------------------------------



  • 4.  RE: Is it possible to use two or more VARIABLEs in a PolicyStatement (PolicyCondition)?

    TM Forum Member
    Posted Jul 04, 2023 05:00
    Edited by Ivan Sokol Jul 04, 2023 05:35

    There wa sa mixup related to sequence of replies, full answer below


    ------------------------------
    Ivan Sokol
    Hrvatski Telekom d.d.
    ------------------------------



  • 5.  RE: Is it possible to use two or more VARIABLEs in a PolicyStatement (PolicyCondition)?

    TM Forum Member
    Posted Jul 04, 2023 05:02
    Edited by Ivan Sokol Jul 04, 2023 05:34

    Hi Anton,

    let me reply to you by refereeing to TMF723 swagger, as that is for me most accurate documentation.


    First, one PolicyCondition can be atomic or composite. If it is composite, it needs to have condition list populated together with conditionCombinationLogic property. This is how you combine multiple conditions.

    If condition is atomic, then statement property must be populated. PolicyStatement can be PolicyExpression or PolicyOperator. PolicyOperator defines variables (1 or many) in argument map


    There you can name your arguments as you see fit. For example, you can name your operation „greaterThan" and then in argument property you put 2 arguments: „left" and „right". Then those arguments would point to the PolicyVariable where you can define from where „left" and „right" arguments are resolved.

    To answer your question, one PolicyStatement can have many arguments depending on a statement type

    Also, to reply to this

    Not possible:

    • somePolicyStatement: Variable1 [total_sum_bundle1] Operator [<]  policyStatement2

    Correct, this is not possible in this manner, as SID model didn't envisioned it like this. But it is possible if you involve PolicyActions like this:

    • you first execute Policy (not Statement, but Policy) that contains policyStatement2. Then you set named variable by using PolicyAction on that Policy.
    • then you execute second Policy that contains somePolicyStatement and refers to named variable set in first step
    • you combine these 2 policies in PolicySet, so that they are executed sequentially 

    Kind Regards

    Ivan Sokol



    ------------------------------
    Ivan Sokol
    Hrvatski Telekom d.d.
    ------------------------------



  • 6.  RE: Is it possible to use two or more VARIABLEs in a PolicyStatement (PolicyCondition)?

    TM Forum Member
    Posted Jul 04, 2023 09:03

    Hi @Ivan Sokol

    I am glad you have seen this post and replied. I am trying to solve this puzzle for several days now. 

    So yes, in my case I have an atomic policyStatement and I need to use the PolicyOperator. It appears to me that my swagger file, which I got from https://www.tmforum.org/oda/open-apis/table/pre-production , is old or it misses an update.

    It does not show a possiblity to create more than one PolicyVariable. It also does not have an attribute called "argument".

    .

    I would highly appreciate if you would send me the updated version of the swagger file maybe by email to anton.tsapko [at] conology.net or any other means you like.

    Kind regads from Germany

    Anton



    ------------------------------
    Anton Tsapko
    conology
    ------------------------------



  • 7.  RE: Is it possible to use two or more VARIABLEs in a PolicyStatement (PolicyCondition)?

    TM Forum Member
    Posted Jul 17, 2023 09:46
    Edited by Anton Tsapko Jul 27, 2023 09:12

    @Ivan Sokol ,

    I found some time to have a look at the new design and have some questions considering it:
     
    1. How is it possible to know which variable is the "left" and which is the "right one? Since a "*" wildcard is used in the model, I assume I can chose the names on my own behalf. In that case the ordering is only known to me. JSON could return alphabetical order in worst case. Or am I supposed to name them literally "left" and "right". If so, why not design the model that way?
      .
    2. How would a statement look like with one operator and 3 variables then? Should not the model be limited to 2? You write: "PolicyOperator defines variables (1 or many) in argument map".

    Best Regards
    Anton

    P.S. It would be really great the future documentation of the policy management API would contain some examples of price policies administration. ( I could supply some exmaples if needed).



    ------------------------------
    Anton Tsapko
    conology
    ------------------------------



  • 8.  RE: Is it possible to use two or more VARIABLEs in a PolicyStatement (PolicyCondition)?

    TM Forum Member
    Posted Aug 23, 2023 09:53

    Hi,

    this part was changed a bit. Now "argument" field is an array and it can contain as much items as operator needs. For example, "greaterThanOrEqual" PolicyOperator could have structure like this:

    {
      "@type": "PolicyOperatorQueryBoolean",
      "@baseType": "PolicyOperator",
      "operation": "greaterThanOrEqual",
      "argument": [
        {
          "@type": "PolicyVariableDynamic",
          "@baseType": "PolicyVariable",
          "valueType": "integer",
          "resolver": [
            {
              "source": "event",
              "path": "$.event.queryServiceQualification.searchCriteria.service.supportingService[?(@.serviceSpecification.name=='InternetAccess')].serviceCharacteristic[?(@.name=='AvailableDownloadBandwidth')].value"
            }
          ]
        },
        {
          "@type": "PolicyVariableStatic",
          "@baseType": "PolicyVariable",
          "valueType": "integer",
          "value": 100000000
        }
      ]
    }

    This operator compares AvailableDownloadBandwidth variable with number 100 000 000 

    In similar manner other operators could be created.



    ------------------------------
    Ivan Sokol
    Hrvatski Telekom d.d.
    ------------------------------