Hi Christina

thanks for your answer.
I gave a try to the 2 options you mention

with the simplified nodes enpoint  
/nodes/service-instances/service-instance/{service-instance-id}, I am able to 
get vnf-id(s) corresponding to a given instance_id

my_aai.get_vnfid_from_instance_id("598c6345-c162-4330-97f3-017d65108883")
{'service-instance-id': '598c6345-c162-4330-97f3-017d65108883', 
'service-instance-name': 'test_ubuntu16_9JGB5Y', 'environment-context': 'null', 
'workload-context': 'Production', 'model-invariant-id': 
'd64b343d-7768-4960-ba62-6e5921cc84d5', 'model-version-id': 
'29e8a1b3-e467-4b30-b04b-313c762396b5', 'resource-version': '1539174443770', 
'orchestration-status': 'Active', 'relationship-list': {'relationship': 
[{'related-to': 'project', 'relationship-label': 
'org.onap.relationships.inventory.Uses', 'related-link': 
'/aai/v13/business/projects/project/Project-generic', 'relationship-data': 
[{'relationship-key': 'project.project-name', 'relationship-value': 
'Project-generic'}]}, {'related-to': 'generic-vnf', 'relationship-label': 
'org.onap.relationships.inventory.ComposedOf', 'related-link': 
'/aai/v13/network/generic-vnfs/generic-vnf/c4161e30-cf6d-41cd-be32-0e5c4c9e97d6',
 'relationship-data': [{'relationship-key': 'generic-vnf.vnf-id', 
'relationship-value': 'c4161e30-cf6d-41cd-be32-0e5c4c9e97d6'}], 
'related-to-property': [{'property-key': 'generic-vnf.vnf-name', 
'property-value': 'ubuntu16-vnf-instance-ubuntu16_VF_0_9JGB5Y'}]}, 
{'related-to': 'owning-entity', 'relationship-label': 
'org.onap.relationships.inventory.BelongsTo', 'related-link': 
'/aai/v13/business/owning-entities/owning-entity/6b5b6b70-4e9a-4f6f-8b7b-cbd7cf990c6e',
 'relationship-data': [{'relationship-key': 'owning-entity.owning-entity-id', 
'relationship-value': '6b5b6b70-4e9a-4f6f-8b7b-cbd7cf990c6e'}]}]}}

But I do not get the vfmodule_id(s) associated with the VNFs, I can use 
/network/generic-vnfs/generic-vnf/{vnf-id}/vf-modules" for that
my_aai.get_vfmoduleid_from_vnf_id("c4161e30-cf6d-41cd-be32-0e5c4c9e97d6")
{'vf-module': [{'vf-module-id': 'b437e6ec-3635-4bf2-8484-e5d2e08298a3', 
'vf-module-name': 'ubuntu16-vfmodule-instance-ubuntu16_VF_0_9JGB5Y', 
'heat-stack-id': 
'ubuntu16-vfmodule-instance-ubuntu16_VF_0_9JGB5Y/77d16792-b885-4181-88f7-5c1d974110e3',
 'orchestration-status': 'active', 'is-base-vf-module': True, 
'resource-version': '1539174548239', 'model-invariant-id': 
'd56786a2-4eab-4fc9-a1d5-11e93ed30d54', 'model-version-id': 
'ef2827ab-7ed1-4f5e-b7b0-01bc54fe73ab', 'model-customization-id': 
'1e130ab8-9f77-434d-a545-1e572bc49b44', 'module-index': 0}]}

with the full service service instance URI 
/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}
I got the same answer than with the simplified node enpoint

>>> my_aai.get_infos_from_instance_id("generic", "ubuntu16", 
>>> "598c6345-c162-4330-97f3-017d65108883")
{'service-instance-id': '598c6345-c162-4330-97f3-017d65108883', 
'service-instance-name': 'test_ubuntu16_9JGB5Y', 'environment-context': 'null', 
'workload-context': 'Production', 'model-invariant-id': 
'd64b343d-7768-4960-ba62-6e5921cc84d5', 'model-version-id': 
'29e8a1b3-e467-4b30-b04b-313c762396b5', 'resource-version': '1539174443770', 
'orchestration-status': 'Active', 'relationship-list': {'relationship': 
[{'related-to': 'project', 'relationship-label': 
'org.onap.relationships.inventory.Uses', 'related-link': 
'/aai/v13/business/projects/project/Project-generic', 'relationship-data': 
[{'relationship-key': 'project.project-name', 'relationship-value': 
'Project-generic'}]}, {'related-to': 'generic-vnf', 'relationship-label': 
'org.onap.relationships.inventory.ComposedOf', 'related-link': 
'/aai/v13/network/generic-vnfs/generic-vnf/c4161e30-cf6d-41cd-be32-0e5c4c9e97d6',
 'relationship-data': [{'relationship-key': 'generic-vnf.vnf-id', 
'relationship-value': 'c4161e30-cf6d-41cd-be32-0e5c4c9e97d6'}], 
'related-to-property': [{'property-key': 'generic-vnf.vnf-name', 
'property-value': 'ubuntu16-vnf-instance-ubuntu16_VF_0_9JGB5Y'}]}, 
{'related-to': 'owning-entity', 'relationship-label': 
'org.onap.relationships.inventory.BelongsTo', 'related-link': 
'/aai/v13/business/owning-entities/owning-entity/6b5b6b70-4e9a-4f6f-8b7b-cbd7cf990c6e',
 'relationship-data': [{'relationship-key': 'owning-entity.owning-entity-id', 
'relationship-value': '6b5b6b70-4e9a-4f6f-8b7b-cbd7cf990c6e'}]}]}}

Basically I was looking for a request, which from the service_instance_id would 
have given me back all the vnf_id(s) and vfmodule_id(s) associated with the 
service_instance_id.
I can do it in 2 steps but I am pretty sure it is possible to do it in 1.

regarding the custom query,

the 500 was due to json format error
{"requestError":{"serviceException":{"messageId":"SVC3002","text":"Error 
writing output performing %1 on %2 (msg=%3) 
(ec=%4)","variables":["GET","v13/query","Internal 
Error:com.google.gson.JsonSyntaxException: 
com.google.gson.stream.MalformedJsonException: Expected value at line 1 column 
13 path $.start[0]","ERR.5.4.4000"]}}

I am using the same headers than for the other requests
the url of the query is 
https://aai.api.sparky.simpledemo.onap.org:30233/aai/v13/query?format=simple
initially I set a payload to
data = {"start" : ["business/generic-vnfs?service-instance-id="+ instance_id"],
                "query" : "query/vfModule-fromServiceInstance"}
to perform the PUT request

The query part is OK as vfModule-fromServiceInstance is well defined in the doc.
my understanding is that the start part is wrong, it does not correspond to 
something available in the graph

I tried to change the value of the payload but was not able to get something 
else than a 400 from the server.

curl -X PUT -i -k -H "accept:application/json" -H 
"content-type:application/json" -H "x-fromappid:AAI" -H 
"x-transactionid:0a3f6713-ba96-4971-a6f8-c2da85a3176e" -H "authorization:Basic 
QUFJOkFBSQ==" -H "cache-control:no-cache" -d @data.json 
https://aai.api.sparky.simpledemo.onap.org:30233/aai/v13/query?format=simple
HTTP/1.1 400 Bad Request
Date: Wed, 17 Oct 2018 15:10:08 GMT
Content-Type: application/json
X-AAI-TXID: 2-aai-traversal-181017-15:10:08:609-30401
Content-Length: 211
Strict-Transport-Security: max-age=16000000; includeSubDomains; preload;

{"requestError":{"serviceException":{"messageId":"SVC3014","text":"Query 
payload is invalid %1 (msg=%2) 
(ec=%3)","variables":["query/vfModule-fromServiceInstance","Query payload is 
invalid %1","ERR.5.6.3014"]}}}

with data.json

{"start" : ["network/598c6345-c162-4330-97f3-017d65108883"],
 "query" : "query/vfModule-fromServiceInstance"}

Do you have an example of a curl custom query?

Morgan



Le lundi 15 octobre 2018 à 14:30 +0000, MONTELEONE, CHRISTINA a écrit :
Hi Morgan,
The documentation you are pointing to is actually from SDN-C, not A&AI, and 
applies specifically to their A&AI interface implementation (AAIService). Here 
is the A&AI API documentation wiki page for Beijing: 
https://wiki.onap.org/display/DW/AAI+REST+API+Documentation+-+Beijing. There is 
a 
AAICustomQueries.pdf<https://wiki.onap.org/download/attachments/28378171/AAICustomQueries.pdf?version=1&modificationDate=1533310532000&api=v2>
 embedded there.

Your start parameter needs to result in a service-instance being retrieved from 
the graph. To do this you can either use the full service instance URI (with 
values filled in) 
/business/customers/customer/{global-customer-id}/service-subscriptions/service-subscription/{service-type}/service-instances/service-instance/{service-instance-id}
 OR you can use the simplified nodes endpoint 
/nodes/service-instances/service-instance/{service-instance-id}

However, I would have expected A&AI to send you a 404 error for providing a bad 
start URI, not a 500. Can you send the full details of your request and 
response?


Thank you,
Christina Monteleone
Sr. Member of Technical Staff
ECOMP System Engineering | A&AI
732.420.3639

From: [email protected] [mailto:[email protected]] On 
Behalf Of Morgan Richomme
Sent: Monday, October 15, 2018 8:22 AM
To: [email protected]
Subject: [onap-discuss] [A&AI] [Beijing] Custom query on A&AI

Hi

I am trying to perform a custom query (vfModule-fromServiceInstance) on A&AI on 
the Orange Openlab (Beijing 2.0.0-ONAP).
The questy seems available since Beijing.
I had a look at 
https://wiki.onap.org/display/DW/AAIService+Custom+Query<https://urldefense.proofpoint.com/v2/url?u=https-3A__wiki.onap.org_display_DW_AAIService-2BCustom-2BQuery&d=DwMGaQ&c=LFYZ-o9_HUMeMTSQicvjIg&r=t8s2YNlnG2yo7J9I1GiEXSPq9sOqHXMlvH5Fj_icwHY&m=hebNYiJpmWl0-K-N8dn7EDvOhSJRaEkhLtVOjYzDsKw&s=6YAwd1DHpPDaxXEQwtL9ymHhZs1NQHmlGo-AvKjgk-4&e=>
 (Please note that the 2 links in the page are internal ATT links)

I have a doubt on the request format and especially on the start parameter.
I did not find example in the documentation.

url = AAI_URL + "/aai/v11/query?format=simple"
start = "business/generic-vnfs?service-instance-id="+ instance_id
data = {"start" : start,
"query" : "query/vfModule-fromServiceInstance"}
response = requests.put(url,
headers=AAI_HEADERS,
proxies=PROXY,
verify=False,
data=data)

I got a 500 from the A&AI without details.

Where can we fin logs to troubleshoot?

Regards

Morgan

_________________________________________________________________________________________________________________________



Ce message et ses pieces jointes peuvent contenir des informations 
confidentielles ou privilegiees et ne doivent donc

pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce 
message par erreur, veuillez le signaler

a l'expediteur et le detruire ainsi que les pieces jointes. Les messages 
electroniques etant susceptibles d'alteration,

Orange decline toute responsabilite si ce message a ete altere, deforme ou 
falsifie. Merci.



This message and its attachments may contain confidential or privileged 
information that may be protected by law;

they should not be distributed, used or copied without authorisation.

If you have received this email in error, please notify the sender and delete 
this message and its attachments.

As emails may be altered, Orange is not liable for messages that have been 
modified, changed or falsified.

Thank you.


_________________________________________________________________________________________________________________________

Ce message et ses pieces jointes peuvent contenir des informations 
confidentielles ou privilegiees et ne doivent donc
pas etre diffuses, exploites ou copies sans autorisation. Si vous avez recu ce 
message par erreur, veuillez le signaler
a l'expediteur et le detruire ainsi que les pieces jointes. Les messages 
electroniques etant susceptibles d'alteration,
Orange decline toute responsabilite si ce message a ete altere, deforme ou 
falsifie. Merci.

This message and its attachments may contain confidential or privileged 
information that may be protected by law;
they should not be distributed, used or copied without authorisation.
If you have received this email in error, please notify the sender and delete 
this message and its attachments.
As emails may be altered, Orange is not liable for messages that have been 
modified, changed or falsified.
Thank you.


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#13105): https://lists.onap.org/g/onap-discuss/message/13105
Mute This Topic: https://lists.onap.org/mt/27328605/21656
Group Owner: [email protected]
Unsubscribe: https://lists.onap.org/g/onap-discuss/unsub  
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to