Thanks Prashant!
I had to use the resource-version in order for the PATCH to work on AAI.
The AAI API documentation needs to be updated with that info. I have left a 
note in Wiki at https://wiki.onap.org/display/DW/AAI+API.

curl -X PATCH \
  
https://<IP>:<PORT>/aai/v8/business/customers/customer/Desjardins/service-subscriptions/service-subscription/SDWAN/service-instances/service-instance/8128c8ee-13f5-4f0b-9cf5-7932e32664fc
 \
  -H 'authorization: Basic QUFJOkFBSQ==' \
  -H 'cache-control: no-cache' \
  -H 'content-type: application/merge-patch+json' \
  -H 'postman-token: 42f70ace-f2db-a3a9-6f80-e46a65f5fa92' \
  -H 'x-fromappid: RASHMI' \
  -d '{
    "service-instance-id": "8128c8ee-13f5-4f0b-9cf5-7932e32664fc",
    "service-instance-location-id": "siteId",
    "resource-version": "1502393371",
    "metadata" : {
      "metadatum": [
                {
                      "metaname":"test1",
                      "metaval":"testtest"
                  },
                  {
                        "metaname":"test2",
                      "metaval":"testtest"
                  }
            ]
    }
}'

Thanks,
Rashmi

From: Prashant Kumar <[email protected]>
Date: Monday, August 14, 2017 at 2:24 AM
To: "Pujar, Rashmi" <[email protected]>, "FORSYTH, JAMES" <[email protected]>, 
"ROSE, DANIEL V" <[email protected]>, "[email protected]" 
<[email protected]>
Subject: RE: [AAI] PATCH request in AAI

Hi,
Don’t you need resource-version for Patch?
Can you please try with resource-version.

Thanks,
Prashant





From: [email protected] 
[mailto:[email protected]] On Behalf Of Pujar, Rashmi
Sent: Saturday, August 12, 2017 1:37 AM
To: FORSYTH, JAMES <[email protected]>; ROSE, DANIEL V <[email protected]>; 
[email protected]
Subject: Re: [onap-discuss] [AAI] PATCH request in AAI

Hi Jimmy,

I get the same 412 with just the “service-instance-location-id” in the PATCH 
request.

PATCH 
/aai/v8/business/customers/customer/Desjardins/service-subscriptions/service-subscription/SDWAN/service-instances/service-instance/8128c8ee-13f5-4f0b-9cf5-7932e32664fc
 HTTP/1.1
Host: <ip>:<port>
Authorization: Basic QUFJOkFBSQ==
X-FromAppId: RASHMI
Content-Type: application/merge-patch+json
Accept: application/json
Cache-Control: no-cache
Postman-Token: c18a2090-9f55-48f9-f8c1-ebbaa6f26918

{
    "service-instance-id": "8128c8ee-13f5-4f0b-9cf5-7932e32664fc",
    "service-instance-location-id": "siteId"
}

Thanks,
Rashmi

From: "FORSYTH, JAMES" <[email protected]<mailto:[email protected]>>
Date: Friday, August 11, 2017 at 3:59 PM
To: "Pujar, Rashmi" <[email protected]<mailto:[email protected]>>, "ROSE, 
DANIEL V" <[email protected]<mailto:[email protected]>>, 
"[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: RE: [AAI] PATCH request in AAI

Hi, Rashmi,

Can you try issuing the PATCH for the service-instance without the child 
metadata?

Thanks,
jimmy

From: 
[email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Pujar, Rashmi
Sent: Friday, August 11, 2017 3:56 PM
To: ROSE, DANIEL V <[email protected]<mailto:[email protected]>>; 
[email protected]<mailto:[email protected]>
Subject: Re: [onap-discuss] [AAI] PATCH request in AAI

Hi Daniel,

I get an empty response with a 412 status. So not much info there about what 
would be the error.
Those are the only logs I see:

aaiadmin@aai-service-3204211426-bjlq5:/opt/app/aai/logs/rest$ tail -f *
2017-08-11T19:52:54.284+0000|2017-08-11T19:52:54.284+0000|f12c6fa7-f00f-463c-ab67-7234a2d796c2||||interceptIn|TEST|AAI||COMPLETE|0|Success||INFO||10.42.14.160|0|aai-service-3204211426-bjlq5||AAILogJAXRSInInterceptor||||||||co=aairest::Missing
 requestID. Assigned 
f12c6fa7-f00f-463c-ab67-7234a2d796c2=true:HbaseTxId=0-AutomaticallyOverwritten-20170811-19:52:54:284-71274|
2017-08-11T19:52:54.296+0000|2017-08-11T19:52:54.296+0000|f12c6fa7-f00f-463c-ab67-7234a2d796c2||||interceptOut|TEST|AAI||COMPLETE|0|Success||INFO||10.42.14.160|0|aai-service-3204211426-bjlq5||AAILogJAXRSOutInterceptor$LoggingCallback||||||||co=aairest:|

==> audit.log.2017-08-10 <==
2017-08-11T19:52:54.284+0000|2017-08-11T19:52:54.296+0000|f12c6fa7-f00f-463c-ab67-7234a2d796c2||||REST
 PATCH 
https://<AAI_IP>:<PORT>/aai/v8/business/customers/customer/Desjardins/service-subscriptions/service-subscription/SDWAN/service-instances/service-instance/8128c8ee-13f5-4f0b-9cf5-7932e32664fc<https://urldefense.proofpoint.com/v2/url?u=https-3A__-253CAAI-5FIP-253E-3A-253CPORT-253E_aai_v8_business_customers_customer_Desjardins_service-2Dsubscriptions_service-2Dsubscription_SDWAN_service-2Dinstances_service-2Dinstance_8128c8ee-2D13f5-2D4f0b-2D9cf5-2D7932e32664fc&d=DwQGaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=Oej6QUk5p2KdqNEWySpOHA&m=okOIrdBEdi5ZFrimVqu4V7Gl0ES8EVbdgnhFMFPxGEA&s=YINtZCMVcoVrxaPdfply_5T3pj1c_e82q26kotdJa-Q&e=>|TEST|ERROR||||INFO||10.42.14.160|12|aai-service-3204211426-bjlq5||AAILogJAXRSOutInterceptor$LoggingCallback|||||||co=aairest::HTTP
 Response Code=412|

Thanks,
Rashmi

From: "ROSE, DANIEL V" <[email protected]<mailto:[email protected]>>
Date: Friday, August 11, 2017 at 3:51 PM
To: "Pujar, Rashmi" <[email protected]<mailto:[email protected]>>, 
"[email protected]<mailto:[email protected]>" 
<[email protected]<mailto:[email protected]>>
Subject: RE: [AAI] PATCH request in AAI

Can you post the full response from the patch? The body should have more 
details.

I believe that error means the resource versions didn’t match.



Daniel Rose
ECOMP / ONAP
com.att.ecomp
732-420-7308

From: 
[email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Pujar, Rashmi
Sent: Friday, August 11, 2017 3:43 PM
To: [email protected]<mailto:[email protected]>
Subject: [onap-discuss] [AAI] PATCH request in AAI

Hello AAI devs!

I see that AAI supports PATCH requests [1]. I want to update the 
“service-instance-location-id” and “metadata” fields in a specific 
service-instance. However, I get a 412: Pre-requisite failed as response. Below 
is my PATCH request to AAI.
Are there any constraints on the type of attribute that are modifiable? If yes 
is there documentation or some reference in code to get to know that info.

PATCH 
/aai/v8/business/customers/customer/Desjardins/service-subscriptions/service-subscription/SDWAN/service-instances/service-instance/8128c8ee-13f5-4f0b-9cf5-7932e32664fc
 HTTP/1.1
Host: <AAI_IP>:<8443>
Authorization: Basic QUFJOkFBSQ==
X-FromAppId: TEST
Content-Type: application/merge-patch+json
Accept: application/json
Cache-Control: no-cache
Postman-Token: fa51808d-2544-87aa-cb89-1d6842671e3d

{
   "service-instance-id":"8128c8ee-13f5-4f0b-9cf5-7932e32664fc",
   "service-instance-location-id":"siteId",
   "metadata":{
      "metadatum":[
         {
            "metaname":"test1",
            "metaname":"testtest"
         },
         {
            "metaname":"test2",
            "metaname":"testtest"
         }
      ]
   }
}


Thanks,
Rashmi

[1]: 
https://wiki.onap.org/display/DW/AAI+API?preview=/1015849/1017043/AAIRESTAPI_8.pdf<https://urldefense.proofpoint.com/v2/url?u=https-3A__wiki.onap.org_display_DW_AAI-2BAPI-3Fpreview-3D_1015849_1017043_AAIRESTAPI-5F8.pdf&d=DwMGaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=2wwdGZ3YcpSivQ2Kio028A&m=P3tQKwJirDdc9zMbuHLPchgz6XOuJ3Arpvu-05mxDWM&s=MTQ9ffX46qFEx0wQkQwCzQY2HG5TQyTuG_Jf21iTjDI&e=>

This message and the information contained herein is proprietary and 
confidential and subject to the Amdocs policy statement, you may review at 
https://www.amdocs.com/about/email-disclaimer
Amdocs Development Centre India Private Limited having CIN: 
U72200PN2004PTC0188320 converted into Amdocs Development Centre India LLP (A 
limited liability partner­ship with LLP Identification Number: AAI-6901 
effective 28th Feb 2017)
_______________________________________________
onap-discuss mailing list
[email protected]
https://lists.onap.org/mailman/listinfo/onap-discuss

Reply via email to