Open APIs

 View Only
  • 1.  TMF652 Resource Order Management API - how to create and set relations in one order

    TM Forum Member
    Posted Oct 02, 2022 09:16
    Hi,
    I have a question about how to use TMF652 to create resources and set up relationships between newly created resources. Let's say we are creating resource A, resource B, and resource C. In addition, we want to set two attributes on resource C - termination1 to the id of resource A and termination2 to the id of resource A. Is it possible to define such an operation as one resource order? Or is there a need for two resource orders - first for resource creation and second for setting relations?

    ------------------------------
    Paul Stanek
    Suntech S.A.
    ------------------------------


  • 2.  RE: TMF652 Resource Order Management API - how to create and set relations in one order

    TM Forum Member
    Posted Oct 02, 2022 09:34
    Hi Paul
    It's a good question.
    I would say that it is an implementation decision. You can represent the relationship structure within a single resource order using temporary IDs as input to the API POST operation (but this will need you to extend the model to add temporary IDs, or override the POST so that it can accept IDs as input).
    Interested to hear what other community members have to say on this.

    ------------------------------
    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: TMF652 Resource Order Management API - how to create and set relations in one order

    TM Forum Member
    Posted Oct 02, 2022 10:13
    Thanks a lot for your answer.
    I was thinking about using named relation for this (with self-reference to the posted resource order), but I don't know if such a trick as self-reference is a good solution. Such resource order would be look like this:
    {
      "name": "Create and set realtions",
      "orderItem": [
        {
          "id": "item1",
          "action": "add",
          "resource": {
            "name": "ResourceA",
            "resourceSpecification": {
              "id": "e362d12b54f2",
              "href": "host/ResourceCatalog/resourceSpecification/e362d12b54f2",
              "name": "ResoruceType-1"
            }
          }
        },
        {
          "id": "item2",
          "action": "add",
          "resource": {
            "name": "ResourceB",
            "resourceSpecification": {
              "id": "e362d12b54f2",
              "href": "host/ResourceCatalog/resourceSpecification/e362d12b54f2",
              "name": "ResoruceType-1"
            }
          }
        },
        {
          "id": "item3",
          "action": "add",
          "resource": {
            "name": "ResourceC",
            "resourceSpecification": {
              "id": "8888888",
              "href": "host/ResourceCatalog/resourceSpecification/88888",
              "name": "ResourceType-2"
            },
            "orderItemRelationship": [
              {
                "orderItem": {
                  "itemId": "item1"
                  //we do not provide resourceOrderId, which means self-reference
                },
                "relationshipType": "rt_Termination1"
              },
              {
                "orderItem": {
                  "itemId": "item2"
                  //we do not provide resourceOrderId, which means self-reference
                },
                "relationshipType": "rt_Termination2"
              }
            ]
          }
        }
      ]
    }​


    ------------------------------
    Paul Stanek
    Suntech S.A.
    ------------------------------



  • 4.  RE: TMF652 Resource Order Management API - how to create and set relations in one order

    TM Forum Member
    Posted Oct 03, 2022 04:25
    The Configuration and Profile ABE (in Common) and the Resource Configuration ABE are designed to address issues like this. The trick with this is that an entity may play the role of a Configuration Specification allowing attributes to be discovered.

    We need a Configuration API, which would make a Configuration (also referred to as a Profile) a first class (addressable) entity.  It has been on my TODO list for a couple years now to work on such a proposal. 


    ------------------------------
    Vance Shipley
    SigScale
    ------------------------------



  • 5.  RE: TMF652 Resource Order Management API - how to create and set relations in one order

    TM Forum Member
    Posted Oct 04, 2022 07:41
    @Vance Shipley thanks a lot for your answer.
    I dug into ​the documentation of Configuration and Profile ABE and Resource Configuration ABE but I still don't get how they should be used for such a case. I wonder if that is possible to use the Configuration entity as a value (without the need for Configuration API)? And if the answer is yes, can you provide a simple example of such use? It will be very helpful.

    ------------------------------
    Paul Stanek
    Suntech S.A.
    ------------------------------



  • 6.  RE: TMF652 Resource Order Management API - how to create and set relations in one order

    TM Forum Member
    Posted Oct 05, 2022 03:42
    Hi,

    Jumping in to understand why I don't see any problem!

    I suppose the question is generic and could apply to any API or type of integration.
    On the principle that entities in the payload should have unique name. what are the benefit of using temporary Id? A single payload ought to be enough. doing it sequencely with multiple paypload doesn't guaranty each payload was processed correctly (I guess someone could say that with an event driven architecture, each payload successfully processed could broadcast a success message that could trigger the next payload).
    What I don't understand is why this is a API "concern". I believe it's only an implementation question: Your server-side code must be designed to read and process the payload correctly and create data in a given order (all resources first, then relationships) so it can resolve foreign key/relationship thanks to unique entity name (and yes, the server-side code could use temp id if that what it takes).
    That's how I've seen integration done for decades. For instance, in the old days of CSV "flat" files, the PL/SQL code reads the file, insert data in tables, nice and tidy and resolve foreign keys.

    ------------------------------
    Kind regards,

    Matthieu Hattab
    Lyse Platform
    ------------------------------



  • 7.  RE: TMF652 Resource Order Management API - how to create and set relations in one order

    TM Forum Member
    Posted Oct 05, 2022 10:04
    Thanks, @Matthieu Hattab for jumping in!​​​
    Yes, the question is indeed generic, especially as a pattern for all TMF Order type API. So if I understand correctly your proposal is to use temporalIds? But for example in Resource Inventory we don't have such attribute on the Resource level (on the level of abstract entity). And how to recognize during relation setting that we are using temporalId? I can only think of using some kind of prefix (like TMPID or something). In this case, my sample would look like this:
    {
      "name": "Create and set realtions",
      "orderItem": [
        {
          "id": "item1",
          "action": "add",
          "resource": {
            "name": "ResourceA",
            "id": "TMPID-ec61167d-150a-4bb6-9225-3a310a0bd86b",
            "resourceSpecification": {
              "id": "e362d12b54f2",
              "href": "host/ResourceCatalog/resourceSpecification/e362d12b54f2",
              "name": "ResoruceType-1"
            }
          }
        },
        {
          "id": "item2",
          "action": "add",
          "resource": {
            "name": "ResourceB",
            "id": "TMPID-34544d9d-8f7d-4e67-8769-87b56923b841",
            "resourceSpecification": {
              "id": "e362d12b54f2",
              "href": "host/ResourceCatalog/resourceSpecification/e362d12b54f2",
              "name": "ResoruceType-1"
            }
          }
        },
        {
          "id": "item3",
          "action": "add",
          "resource": {
            "name": "ResourceC",
            "termination1": { //ResourceRef
              "id": "TMPID-34544d9d-8f7d-4e67-8769-87b56923b841"
            },
            "termination2": { //ResourceRef
              "id": "TMPID-ec61167d-150a-4bb6-9225-3a310a0bd86b"
            }, 
            "resourceSpecification": {
              "id": "8888888",
              "href": "host/ResourceCatalog/resourceSpecification/88888",
              "name": "ResourceType-2"
            }
          }
        }
      ]
    }​

    This will be the best approach for me. But the question is whether this approach is TMF compliant.



    ------------------------------
    Paul Stanek
    Suntech S.A.
    ------------------------------