This document will focus on providing additional explanations on how to access any node in the AAI database using path defined in aai_schema_v11.xsd .
Please read section "How to select right resource for AAIService" in the parent document first.
AAIService component of CCSDK allows DG to access the node through the "key" and resource parameters of the request API.
...
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:
Code Block | ||
---|---|---|
| ||
/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:
Code Block | ||
---|---|---|
| ||
<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"
... |
The final request key for the second path that includes vlan, will be:
Code Block | ||
---|---|---|
| ||
<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 vlan.vlan-interface = $tmp.val4 AND l3-interface-ipv6-address-list.3-interface-ipv6-address = $tmp.val5"
... |
Note: Please note that the structure of the request key requires use of spaces around equal sign to properly parse the string. Same applies to AND keyword.
Restrictions when working with AAI data:
AAIService requires user to work one node at the time. That means that for l3-interface-ipv6-address-list node in this example, each parent node must exist. That means that prior to adding l3-interface-ipv6-address-list node, all parent or intermediate nodes starting with generic-vnf down to an immediate parent of l3-interface-ipv6-address-list must exist.