Saryu Shah | d181180 | 2017-11-14 00:09:29 +0000 | [diff] [blame] | 1 | |
| 2 | .. This work is licensed under a Creative Commons Attribution 4.0 International License. |
| 3 | .. http://creativecommons.org/licenses/by/4.0 |
| 4 | |
| 5 | **************************** |
| 6 | Verifying/Modifying AAI Data |
| 7 | **************************** |
| 8 | |
| 9 | .. contents:: |
| 10 | :depth: 3 |
| 11 | |
| 12 | This page highlights key commands used by Policy to look at and modify A&AI data for testing purposes. Please refer to the A&AI REST API Documentation for more details. |
| 13 | |
| 14 | Checking Current Data |
| 15 | ^^^^^^^^^^^^^^^^^^^^^ |
| 16 | |
| 17 | To get all the vnfs that are in AAI |
| 18 | ----------------------------------- |
| 19 | |
| 20 | Use this command if you want to get all the vnf's that are provisioned in A&AI. This is useful if you want to find a couple vnf's you can later query. |
| 21 | |
| 22 | .. code-block:: bash |
| 23 | |
| 24 | curl --silent -k -u "<userName>:<password>" --header "X-FromAppId: <fromApp>" --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TransactionId: <requestID>" -X GET https://aai.api.simpledemo.openecomp.org:8443/aai/v11/network/generic-vnfs | python -m json.tool |
| 25 | |
| 26 | To get a specific vnf |
| 27 | --------------------- |
| 28 | |
| 29 | If you have a **vnf-id**, this command returns the details related to the specific vnf id you are querying. Policy primarily does this query if the onset has a vnf id but not the isClosedLoopDisabled field. |
| 30 | |
| 31 | .. code-block:: bash |
| 32 | |
| 33 | curl --silent -k -u "<userName>:<password>" --header "X-FromAppId: <fromApp>" --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TransactionId: <requestID>" -X GET https://aai.api.simpledemo.openecomp.org:8443/aai/v11/network/generic-vnfs/generic-vnf/<vnfID> | python -m json.tool |
| 34 | |
| 35 | If you have a **vnf-name**, this command returns the details related to the specific vnf name you are querying. Policy primarily does this query if the onset has a vnf name but no vnf id. |
| 36 | |
| 37 | .. code-block:: bash |
| 38 | |
| 39 | curl --silent -k -u "<userName>:<password>" --header "X-FromAppId: <fromApp>" --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TransactionId: <requestID>" -X GET https://aai.api.simpledemo.openecomp.org:8443/aai/v11/network/generic-vnfs/generic-vnf?vnf-name=<vnfName> | python -m json.tool |
| 40 | |
| 41 | To find all the vservers |
| 42 | ------------------------ |
| 43 | |
| 44 | Follow these steps to get all of the vservers. This is useful to get a couple of vservers to query later, either manually or through a closed loop. |
| 45 | |
| 46 | **Step 1:** Execute the following: |
| 47 | |
| 48 | .. code-block:: bash |
| 49 | |
| 50 | curl --silent -k -u "<userName>:<password>" --header "X-FromAppId: <fromApp>" --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TransactionId: <requestID>" -X GET https://aai.api.simpledemo.openecomp.org:8443/aai/v11/cloud-infrastructure/cloud-regions | python -m json.tool |
| 51 | |
| 52 | Take note of all the cloud-owner/cloud-region combinations. In this example, there are 3 combinations: Skynet/CL-MR1, AMIST/AMCR1, and Rackspace/DFW. |
| 53 | |
| 54 | .. image:: modAAI_getCloudRegions.png |
| 55 | |
| 56 | **Step 2:** Invoke the following command for each combination: |
| 57 | |
| 58 | .. code-block:: bash |
| 59 | |
| 60 | curl --silent -k -u "<userName>:<password>" --header "X-FromAppId: <fromApp>" --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TransactionId: <requestID>" -X GET https://aai.api.simpledemo.openecomp.org:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/<cloudOwner>/<cloudRegion>?depth=all | python -m json.tool |
| 61 | |
| 62 | .. image:: modAAI_getAllVserver.PNG |
| 63 | |
| 64 | To get a specific vserver |
| 65 | ------------------------- |
| 66 | |
| 67 | Use this command to get the details of a specific vserver based on its vserver name. |
| 68 | |
| 69 | .. code-block:: bash |
| 70 | |
| 71 | curl --silent -k -u "<userName>:<password>" --header "X-FromAppId: <fromApp>" --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TransactionId: <requestID>" -X GET https://aai.api.simpledemo.openecomp.org:8443/aai/v11/nodes/vservers?vserver-name=<vserverName> | python -m json.tool |
| 72 | |
| 73 | .. image:: modAAI_getByVserverName.PNG |
| 74 | |
| 75 | Named-Queries |
| 76 | ------------- |
| 77 | |
| 78 | These commands are used to get more information than can be obtained in a single other query. They require more data to be sent in the query, but return information on the related instances of a given vnf or vserver, as well as the information about the vnf/vserver itself. |
| 79 | |
| 80 | **For vFW:** |
| 81 | |
| 82 | .. code-block:: bash |
| 83 | |
| 84 | curl --silent -k -u "<userName>:<password>" --header "X-FromAppId: <fromApp>" --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TransactionId: <requestID>" -d "{\"query-parameters\": { \"named-query\": { \"named-query-uuid\": \"a93ac487-409c-4e8c-9e5f-334ae8f99087\" } }, \"instance-filters\":{\"instance-filter\":[ {\"generic-vnf\": { \"vnf-id\": \"<vnfID>\"}}]}}" -X POST https://aai.api.simpledemo.openecomp.org:8443/aai/search/named-query | python -m json.tool |
| 85 | |
| 86 | .. image:: modAAI_namedQueryVnfId.PNG |
| 87 | |
| 88 | **For vDNS:** |
| 89 | |
| 90 | .. code-block:: bash |
| 91 | |
| 92 | curl --silent -k -u "<userName>:<password>" --header "X-FromAppId: <fromApp>" --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TransactionId: <requestID>" -d "{\"query-parameters\": { \"named-query\": { \"named-query-uuid\": \"4ff56a54-9e3f-46b7-a337-07a1d3c6b469\" } }, \"instance-filters\":{\"instance-filter\":[ {\"vserver\": { \"vserver-name\": \"<vnfID>\"}}]}}" -X POST https://aai.api.simpledemo.openecomp.org:8443/aai/search/named-query | python -m json.tool |
| 93 | |
| 94 | Adding Data to A&AI |
| 95 | ^^^^^^^^^^^^^^^^^^^ |
| 96 | |
| 97 | Generic-Vnf |
| 98 | ----------- |
| 99 | |
| 100 | .. code-block:: bash |
| 101 | |
| 102 | curl --silent -k -u "<username>:<password>" --header "X-FromAppId: POLICY" --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TransactionId: 8611ece5-5786-4e71-b72f-e87ef44029da" -X PUT -H "Content-Type: application/json" --data @addVnf.txt https://aai.api.simpledemo.openecomp.org:8443/aai/v11/network/generic-vnfs/generic-vnf/<vnfID> | python -m json.tool |
| 103 | |
| 104 | The addVNF.txt file is just the data you would like to add. At minimum, the vnf-id, vnf-name, vnf-type and is-closed-loop-disabled fields need to be filled out, and the vnf-id needs to match the one you choose in the url of the curl command. |
| 105 | |
| 106 | Vserver |
| 107 | ------- |
| 108 | |
| 109 | .. code-block:: bash |
| 110 | |
| 111 | curl --silent -k -u "<username>:<password>" --header "X-FromAppId: POLICY" --header "Content-Type: application/json" --header "Accept: application/json" --header "X-TransactionId: 8611ece5-5786-4e71-b72f-e87ef44029da" -X PUT -H "Content-Type: application/json" --data @addVserver.txt https://aai.api.simpledemo.openecomp.org:8443/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/<cloud-owner>/<cloud-region-id>/tenants/tenant/<tenant-id>/vservers/vserver/<vserver-id> |
| 112 | |
| 113 | The addVserver.txt file is the vserver object you would like to add. It needs values for vserver-id, vserver-name, vserver-selflink, in-maint, and is-close-loop-disabled at minimum. The values of <cloud-owner>, <cloud-region-id>, and <tenants> depends on the values already in Rackspace, see the section above under finding all Vservers. |
| 114 | |
| 115 | Named Queries |
| 116 | ------------- |
| 117 | |
| 118 | The data for the named queries is based off of the data in the relationship-list field for both vservers and vnfs. |
| 119 | |
| 120 | End of Document |
| 121 | |
| 122 | .. SSNote: Wiki page ref. https://wiki.onap.org/pages/viewpage.action?pageId=16005849#Verifying/ModifyingAAIData |
| 123 | |
| 124 | |