Uploaded image for project: 'Active and Available Inventory'
  1. Active and Available Inventory
  2. AAI-2457

Inconsistent error messages when getting AAI resources

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Low Low
    • Honolulu Release
    • Dublin Release
    • None

      This CCVPN test data contains site-resources and generic-vnfs objects, amongst other things.

      Calling AAI-Resources to get one specific site-resource shows that it is related to one generic-vnf:

      GET /aai/v16/network/site-resources/site-resource/123454321?depth=1
      {
        "site-resource-id": "123454321",
        "site-resource-name": "cmcc-site",
        "description": "site-desc",
        "type": "some-type",
        "role": "dsvpn-hub",
        "generated-site-id": "123",
        "operational-status": "created",
        "resource-version": "1557838602996",
        "relationship-list": {
          "relationship": [
            {
              "related-to": "generic-vnf",
              "relationship-label": "org.onap.relationships.inventory.PartOf",
              "related-link": "/aai/v16/network/generic-vnfs/generic-vnf/64473cf2-93d3-403b-92f2-88f0ddf56b7a",
              "relationship-data": [
                {
                  "relationship-key": "generic-vnf.vnf-id",
                  "relationship-value": "64473cf2-93d3-403b-92f2-88f0ddf56b7a"
                }
              ],
              "related-to-property": [
                {
                  "property-key": "generic-vnf.vnf-name"
                }
              ]
            }
          ]
        }
      }
      

      Making the call to the /related-to/ endpoint with depth=0 shows that there is only one object:

      GET /aai/v16/network/site-resources/site-resource/123454321/related-to/generic-vnfs?depth=0
      {
        "generic-vnf": [
          {
            "vnf-id": "64473cf2-93d3-403b-92f2-88f0ddf56b7a",
            "vnf-type": "some vnf-type",
            "orchestration-status": "Active",
            "in-maint": false,
            "is-closed-loop-disabled": false,
            "resource-version": "1557739192142",
            "relationship-list": {
              "relationship": [
                {
                  "related-to": "site-resource",
                  "relationship-label": "org.onap.relationships.inventory.PartOf",
                  "related-link": "/aai/v16/network/site-resources/site-resource/12345",
                  "relationship-data": [
                    {
                      "relationship-key": "site-resource.site-resource-id",
                      "relationship-value": "12345"
                    }
                  ],
                  "related-to-property": [
                    {
                      "property-key": "site-resource.site-resource-name",
                      "property-value": "hkg-site"
                    }
                  ]
                },
                {
                  "related-to": "site-resource",
                  "relationship-label": "org.onap.relationships.inventory.PartOf",
                  "related-link": "/aai/v16/network/site-resources/site-resource/123454321",
                  "relationship-data": [
                    {
                      "relationship-key": "site-resource.site-resource-id",
                      "relationship-value": "123454321"
                    }
                  ],
                  "related-to-property": [
                    {
                      "property-key": "site-resource.site-resource-name",
                      "property-value": "cmcc-site"
                    }
                  ]
                },
                {
                  "related-to": "service-instance",
                  "relationship-label": "org.onap.relationships.inventory.ComposedOf",
                  "related-link": "/aai/v16/business/customers/customer/DemoTest9/service-subscriptions/service-subscription/service-ccvpn/service-instances/service-instance/1144",
                  "relationship-data": [
                    {
                      "relationship-key": "customer.global-customer-id",
                      "relationship-value": "DemoTest9"
                    },
                    {
                      "relationship-key": "service-subscription.service-type",
                      "relationship-value": "service-ccvpn"
                    },
                    {
                      "relationship-key": "service-instance.service-instance-id",
                      "relationship-value": "1144"
                    }
                  ],
                  "related-to-property": [
                    {
                      "property-key": "service-instance.service-instance-name",
                      "property-value": "1144"
                    }
                  ]
                },
                {
                  "related-to": "device",
                  "relationship-label": "org.onap.relationships.inventory.Uses",
                  "related-link": "/aai/v16/network/devices/device/c1e142a1-093f-4339-92e2-d02d55879ab6",
                  "relationship-data": [
                    {
                      "relationship-key": "device.device-id",
                      "relationship-value": "c1e142a1-093f-4339-92e2-d02d55879ab6"
                    }
                  ],
                  "related-to-property": [
                    {
                      "property-key": "device.device-name",
                      "property-value": "cmcc-device-8"
                    }
                  ]
                }
              ]
            }
          }
        ]
      }
      

      Making the call to GET the generic-vnf with depth=1 also confirms one object:

      GET /aai/v16/network/generic-vnfs/generic-vnf/64473cf2-93d3-403b-92f2-88f0ddf56b7a?depth=1
      {
        "vnf-id": "64473cf2-93d3-403b-92f2-88f0ddf56b7a",
        "vnf-type": "some vnf-type",
        "orchestration-status": "Active",
        "in-maint": false,
        "is-closed-loop-disabled": false,
        "resource-version": "1557739192142",
        "relationship-list": {
          "relationship": [
            {
              "related-to": "site-resource",
              "relationship-label": "org.onap.relationships.inventory.PartOf",
              "related-link": "/aai/v16/network/site-resources/site-resource/12345",
              "relationship-data": [
                {
                  "relationship-key": "site-resource.site-resource-id",
                  "relationship-value": "12345"
                }
              ],
              "related-to-property": [
                {
                  "property-key": "site-resource.site-resource-name",
                  "property-value": "hkg-site"
                }
              ]
            },
            {
              "related-to": "site-resource",
              "relationship-label": "org.onap.relationships.inventory.PartOf",
              "related-link": "/aai/v16/network/site-resources/site-resource/123454321",
              "relationship-data": [
                {
                  "relationship-key": "site-resource.site-resource-id",
                  "relationship-value": "123454321"
                }
              ],
              "related-to-property": [
                {
                  "property-key": "site-resource.site-resource-name",
                  "property-value": "cmcc-site"
                }
              ]
            },
            {
              "related-to": "service-instance",
              "relationship-label": "org.onap.relationships.inventory.ComposedOf",
              "related-link": "/aai/v16/business/customers/customer/DemoTest9/service-subscriptions/service-subscription/service-ccvpn/service-instances/service-instance/1144",
              "relationship-data": [
                {
                  "relationship-key": "customer.global-customer-id",
                  "relationship-value": "DemoTest9"
                },
                {
                  "relationship-key": "service-subscription.service-type",
                  "relationship-value": "service-ccvpn"
                },
                {
                  "relationship-key": "service-instance.service-instance-id",
                  "relationship-value": "1144"
                }
              ],
              "related-to-property": [
                {
                  "property-key": "service-instance.service-instance-name",
                  "property-value": "1144"
                }
              ]
            },
            {
              "related-to": "device",
              "relationship-label": "org.onap.relationships.inventory.Uses",
              "related-link": "/aai/v16/network/devices/device/c1e142a1-093f-4339-92e2-d02d55879ab6",
              "relationship-data": [
                {
                  "relationship-key": "device.device-id",
                  "relationship-value": "c1e142a1-093f-4339-92e2-d02d55879ab6"
                }
              ],
              "related-to-property": [
                {
                  "property-key": "device.device-name",
                  "property-value": "cmcc-device-8"
                }
              ]
            }
          ]
        }
      }
      

      However, modifying the call to the /related-to/ endpoint with depth=1 returns an unexpected error:

      GET /aai/v16/network/site-resources/site-resource/123454321/related-to/generic-vnfs?depth=1
      
      < HTTP/1.1 403 Forbidden
      < Date: Tue, 21 May 2019 01:38:50 GMT
      < Content-Type: application/json
      < X-AAI-TXID: 0-aai-resources-190521-01:38:50:255-39191
      < Content-Length: 298
      < Strict-Transport-Security: max-age=16000000; includeSubDomains; preload;
      {
        "requestError": {
          "policyException": {
            "messageId": "POL3300",
            "text": "Unauthorized (msg=%1) (ec=%2)",
            "variables": [
              "Too many objects would be returned by this request, please refine your request and retry",
              "ERR.5.1.3303",
              "GET",
              "network/site-resources/site-resource/123454321/related-to/generic-vnfs"
            ]
          }
        }
      }
      

      The code that limits the number of objects returned seems to be mistakenly applied in this case.

      Also, regarding the message itself, the HTTP error code is 403 Forbidden, but the text of the message is "Unauthorized", which is usually associated with HTTP error code 401. The error code would be correct in that the "too many objects" response is forbidden, but the text is incorrect since the request is properly authorized.

            Unassigned Unassigned
            keong keong
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: