This document will focus on how to access any node in the AAI database using path defined in aai_schema_v11.xsd .
AAIService component of CCSDK allows DG to access the node through the "key" and resource parameters of the request API.
<save
plugin=
"org.onap.ccsdk.sli.adaptors.aai.AAIService"
resource=
"generic-vnf"
key=
"generic-vnf.vnf-id = $service-configuration-operation-input.ucpe-vms-service-information.vnf-list.vnf-information[0].vnf-id"
The DG node requires the developer to specify, among others, values of plugin, resource and key arguments.
The plugin argument should be set to "org.onap.ccsdk.sli.adaptors.aai.AAIService"
. Please note that the initial version of ONAP was using openecomp instead of onap. If you come accross plugin name using openecomp, please repalce it with the current version.
The resource is the name of the data type as defined in aai_schema_v11.xsd document defined by AAI Team.
The key string contains key-value pairs allowing us to uniquely identify the instance of type defined by resource.
When looking at the XSD document, please notice that the first data member definition represents the identifier, in the example above, the identifier for esr-ems type is ems-id. That id is then used in creating path.
AAIService uses a construct that I would like to call Fully Qualified Object Identifier, or FQOID that is made of resource type name and resource identifier.
In this example, that identifier will be esr-ems.ems-id.
To write the request key string user needs to use format: "{FQOID} = 'value'" or "{FQOID} = $some.variable.pointing.to.data.in.SvcLogicContext.memory.id".
When the resource node is located deeper in the tree structure, user needs to provide FQOIDs for all nodes in the path.
Let's take more complicated example of path In this case I would like to look at paths containing l-interface and lag-interface. There are paths defined by AAI API that contain both of these resources. For this exercise I will narrow down paths by focusing on paths that start with generic-vnf and end with l3-interface-ipv6-address-list. There are 2 paths like that. They are:
/aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address} /aai/v11/network/generic-vnfs/generic-vnf/{vnf-id}/lag-interfaces/lag-interface/{interface-name}/l-interfaces/l-interface/{interface-name}/vlans/vlan/{vlan-interface}/l3-interface-ipv6-address-list/{l3-interface-ipv6-address}
These 2 paths differ by one element, which is vlan.
To uniquely identify first path we need following list of FQOIDs:
- generic-vnf.vnf-id
- lag-interface.interface-name
- l-interface.interface-name
- l3-interface-ipv6-address-list.3-interface-ipv6-address
To uniquely identify second path we need to add FQOID for vlan, so the list of FQOIDs will be:
- generic-vnf.vnf-id
- lag-interface.interface-name
- l-interface.interface-name
- vlan.vlan-interface
- l3-interface-ipv6-address-list.3-interface-ipv6-address
So the final request key string for first path will be:
<get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-interface-ipv6-address-list" key="generic-vnf.vnf-id = $tmp.val1 AND lag-interface.interface-name = $tmp.val2 AND l-interface.interface-name = $tmp.val3 AND l3-interface-ipv6-address-list.3-interface-ipv6-address = $tmp.val4" ...