.. contents:: :depth: 3 .. .. This work is licensed under a Creative Commons Attribution 4.0 International License. .. http://creativecommons.org/licenses/by/4.0 AAI Generic Query Implementation Notes Overview ======== The Generic Query mechanism allows to search for certain nodes of “include” node types at a specified “depth” from the from a particular start node of type “start-node-type” identified by specifying its “key” values. The Generic Query is implemented using the GET method with the following URL that takes 4 query params: .. code-block:: /aai//search/generic-query Ex. /aai/v16/search/generic-query Please look for other AAI documentation for what version to use in which environment/release. **key** - multiple values that together specify the params to select a unique start node. For example for selecting a customer we would specify .. code-block:: key=customer.global-customer-id:ma9181-203-customerid&key=service-subscription.service-type:example-service-type **start-node-type** - node type of the start node. For example start-node-type=service-instance **include** - multiple values of the node types that need to be returned as part of the query-result. For example .. code-block:: include=vce&include=port-group **depth** – look for include node types within a certain depth from the start-node-type The queries return a search-results object back which includes a list of result-data which contains the node-type and a link for each resource that was found. Requirements ============ * At depth=0, only the start node is returned, include is not needed * At any depth > 0 and <= 6, If start-node-type is in the include – that should also be returned * The depth has a max value of 6 – an error will be returned if a value higher than 6 is used * A special node type of “all” can be specified for include when all nodes under the start node are to be searched for * If a start-node cannot be found based on the key a HTTP response code of 404 Node not found error is returned * If no nodes can be found that meet the search criteria a HTTP response code of 200 with an empty list is returned * The search results can be asked to be returned in json or xml based on the ACCEPT header. For 1504, the queries are expected to be used by MSO and therefore will use an ACCEPT header of application/xml. Supported Queries ================= Search customer and service-subscription by service instance id .. code-block:: URL: /aai/v16/search/generic-query?key=service-instance.service-instance-id:testserviceinstance&start-node-type=service-instance&include=customer&include=service-subscription&include=service-instance&depth=2 Search result: .. code-block:: xml customer https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/ service-subscription https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/ service-instance https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/ Search the VCE and its port groups and cvlan tags given the service instance id. .. code-block:: URL: /aai/v16/search/generic-query?key=service-instance.service-instance-id:arnoldave&start-node-type=service-instance&include=vce&include=port-group&include=cvlan-tag&depth=3 Search result: .. code-block:: xml cvlan-tag https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/333/ cvlan-tag https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/333/ cvlan-tag https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/111/ port-group https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/ vce https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/ cvlan-tag https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/222/ port-group https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/ Customer GET based on tenant id .. code-block:: URL: /aai/v16/search/generic-query?key=tenant.tenant-id:examplepizzatenant&start-node-type=tenant&include=tenant&include=customer&include=service-subscription&depth=2 Search Result: .. code-block:: xml customer https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/ service-subscription https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/ tenant https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/exampletenant/ Search the tenant given a customer and service subscription. .. code-block:: URL: /aai/v16/search/generic-query?key=customer.global-customer-id:example-customer&key=service-subscription.service-type:example-service-type&start-node-type=service-subscription&include=tenant&include=service-subscription&depth=1 Search Result: .. code-block:: service-subscription https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/ tenant https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/ For a service Instance - get its resource-link given the service-instance-id .. code-block:: URL: /aai/v16/search/generic-query?key=service-instance.service-instance-id:exampleservice&start-node-type=service-instance&depth=0 Search Result: .. code-block:: xml service-instance https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/ Get service-instance and service-subscription from vce .. code-block:: URL: /aai/v16/search/generic-query?key=vce.vnf-id:examplevce&start-node-type=vce&include=service-instance&include=service-subscription&depth=2 Search Result: .. code-block:: xml service-instance https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/ service-subscription https://aai.onap:8443/aai/v16/business/customers/customer/examplecustomer/service-subscriptions/service-subscription/ptplgamma/ Get all the nodes for a customer .. code-block:: URL: /aai/v16/search/generic-query?key=customer.global-customer-id:examplecustomer&start-node-type=customer&include=all&depth=6 Search Result: .. code-block:: xml service-capability https://aai.onap:8443/aai/v16/service-design-and-creation/service-capabilities/service-capability/ptplgamma/ptplbrocade-vce/ vserver https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/vservers/vserver/ccwvm1/ cvlan-tag https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/333/ oam-network https://aai.onap:8443/aai/v16/cloud-infrastructure/oam-networks/oam-network/examplentwk/ cvlan-tag https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/333/ dvs-switch https://aai.onap:8443/aai/v16/cloud-infrastructure/dvs-switches/dvs-switch/dvsswitch-id1/ cvlan-tag https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/cvlan-tags/cvlan-tag/111/ customer https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/ service-subscription https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/ port-group https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc1/ tenant https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/ service-instance https://aai.onap:8443/aai/v16/business/customers/customer/globalexample/service-subscriptions/service-subscription/ptplgamma/service-instances/service-instance/arnoldave/ pserver https://aai.onap:8443/aai/v16/cloud-infrastructure/pservers/pserver/ptpnj101snd/ availability-zone https://aai.onap:8443/aai/v16/cloud-infrastructure/availability-zones/availability-zone/ptplaz1/ vce https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/ image https://aai.onap:8443/aai/v16/cloud-infrastructure/images/image/valueOfImageId/ cvlan-tag https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/cvlan-tags/cvlan-tag/222/ port-group https://aai.onap:8443/aai/v16/network/vces/vce/examplevce/port-groups/port-group/exampleifc2/ ipaddress https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/vservers/vserver/ccwvm1/ipaddresses/ipaddress/10.10.10.5/guid of port or interface/ flavor https://aai.onap:8443/aai/v16/cloud-infrastructure/flavors/flavor/valueOfFlavorId/ ipaddress https://aai.onap:8443/aai/v16/cloud-infrastructure/tenants/tenant/examplepizzatenant/vservers/vserver/ccwvm1/ipaddresses/ipaddress/10.10.10.4/guid of port or interface/ complex https://aai.onap:8443/aai/v16/cloud-infrastructure/complexes/complex/PTPLNJ08742/