To import an IPAM package using the IaaS API, you reserve enough space for the package then you make multiple PATCH requests to import smaller pieces of the package. After importing all the pieces, you use a POST request to upload the file onto the server.
For more information about the TUS RFC protocol, see https://github.com/tus/tus-resumable-upload-protocol/blob/main/protocol.md.
This procedure shows how to import your IPAM package using the integrations IPAM APIs. Then you complete the integration using the Automation Assembler UI or the integrations API.
Prerequisites
- Verify that all general prerequisites and prerequisites for the Automation Assembler IaaS API have been satisfied. See Prerequisites for API Use Case Examples.
- Verify that you know the size of the package that you want to upload. If the package is large, divide it into smaller packages. The following example divides the large package into smaller packages that are each 9000000 bytes in size.
split -b 9000000 <your_package>.zip <your_package>.zip_split
- If using the API to complete the IPAM integration with a cloud account, verify that you have the following parameters for your cloud account:
- privateKeyId used to create your cloud account.
- privateKey used to create your cloud account.
- hostName used to create your cloud account.
- faasProviderEndpointID is your cloud account ID.
Procedure
Example: Import an IPAM Package
This example shows how to import an Infoblox IPAM package with a total size of 73342782 bytes. To import incrementally using smaller packages, you divide the larger package into smaller packages. This example assumes that you have divded the package into multiple smaller packages each 9000000 bytes in size.
After importing the IPAM package, you create an integration with a cloud account using the the Automation Assembler UI or the integrations endpoint in the IaaS API. This example shows how to integrate the uploaded IPAM package with a cloud account that has the following parameters:
- faasProviderEndpointId: "f46337e9-e0c2-4ada-9244-766a8e54da48"
- hostName: "infoblox.sof-mbu.eng.mycompany.com"
- privateKey: "Password!23"
- privateKeyId: "[email protected]"
Assign variables.
$ url='https://api.mgmt.cloud.vmware.com'
$ api_version='2021-07-15'
Reserve space for the package.
$ curl -X POST \ "$url/iaas/api/integrations-ipam/package-import?apiVersion=$api_version" \ -H "Authorization: Bearer $access_token" \ -H "Upload-Length: 73342782" \ -H "Tus-Resumable: 1.0.0" | jq "."
Examine the response to get the location ID.
status: 201 body: empty headers: {location:/iaas/api/integrations-ipam/package-import/8a81db06-f27f-4ccb-a7c5-960c35107ed6, ...}
Assign the location ID variable.
$ location_id='8a81db06-f27f-4ccb-a7c5-960c35107ed6'
Import the first package with a content length of 9000000 bytes and a zero upload offset value.
$ curl -X PATCH \ "$url/iaas/api/integrations-ipam/package-import/$location_id/?apiVersion=$api_version" \ -H "Authorization: Bearer $access_token" \ -H "Content-Length: 9000000" \ -H "Tus-Resumable: 1.0.0" \ -H "Content-Type: application/offset+octet-stream" \ -H "Upload-Offset: 0" | jq "."
Examine the header in the response to get the upload offset value.
status: 204 body: empty headers: {upload-offset:9000000, ...}
Import the next package.
$ curl -X PATCH \ "$url/iaas/api/integrations-ipam/package-import/$location_id/?apiVersion=$api_version" \ -H "Authorization: Bearer $access_token" \ -H "Content-Length: 9000000" \ -H "Tus-Resumable: 1.0.0" \ -H "Content-Type: "application/offset+octet-stream" \ -H "Upload-Offset: 9000000" | jq "."
Examine the header in the response again to get the next upload offset value.
status: 204 body: empty headers: {upload-offset:18000000, ...}
Import the next package.
$ curl -X PATCH \ "$url/iaas/api/integrations-ipam/package-import/$location_id/?apiVersion=$api_version" \ -H "Authorization: Bearer $access_token" \ -H "Content-Length: 9000000" \ -H "Tus-Resumable: 1.0.0" \ -H "Content-Type: "application/offset+octet-stream" \ -H "Upload-Offset: 18000000" | jq "."
Repeat the process to get the upload offset value from the header response and use that value to import the next package.
After importing the final small package, upload the complete package.
$ curl -X POST \ "$url/iaas/api/integrations-ipam/package-import?apiVersion=$api_version" \ -H "Authorization: Bearer $access_token" \ -H "Tus-Resumable: 1.0.0" \ -d '{ "bundleId":"$location_id", "option" : "OVERWRITE" } | jq "."
A successful response includes the provider ID, provider name, and the provider version
{ "providerId": "86801580-9042-49b6-879d-5a7361d33519", "providerName": "Infoblox", "providerVersion": "1.6" "logoIcon":"iVBORw...", ...
To create an IPAM integration using the Automation Assembler UI, select . On the New Integration page that appears, select Manage IPAM Providers and choose the package with the Provider name Infoblox
and Provider version 1.6
.
To create an IPAM integration using the API, assign the provider ID variable.
$ provider_id = "86801580-9042-49b6-879d-5a7361d33519"
Create the integration.
$ curl -X POST \ "$url/iaas/api/integrations?apiVersion=$api_version" \ -H "Authorization: Bearer $access_token" \ -H "Content-Type: application/json" \ -d '{ "integrationProperties": { "providerId" : "'$provider_id'", "faasProviderEndpointId": "f46337e9-e0c2-4ada-9244-766a8e54da48", "privateKeyId": "[email protected]", "privateKey": "Password!23", "hostName": "infoblox.sof-mbu.eng.mycompany.com", "dcId": "onprem" }, "customProperties": {"isExternal": "true"}, "integrationType": "ipam", "associatedCloudAccountIds": [], "associatedMobilityCloudAccountIds": {}, "privateKey": "Password!23", "privateKeyId": "[email protected]" } | jq "."
Examine the response.
{ "progress": 0, "status": "INPROGRESS", "name": "Integration creation/update", "id": "117ff057-9e26-4f0c-ae7b-eb9fcc1c15cc", "selfLink": "/iaas/api/request-tracker/117ff057-9e26-4f0c-ae7b-eb9fcc1c15cc" }
Assign the selfLink variable.
$ selfLink_id='117ff057-9e26-4f0c-ae7b-eb9fcc1c15cc'
Use the selfLink for tracking.
$ curl -X GET -H 'Content-Type: application/json' -H "Authorization: Bearer $access_token" "$url/iaas/api/request-tracker/$selfLink_id?apiVersion=$api_version" | jq "."
The integration is complete when the response includes "status": "FINISHED"
.
{ "progress": 100, "status": "FINISHED", "resources": [ "/iaas/api/integrations/9df2b0a8-2ce6-4465-bf39-04290965da9e" ], "name": "Integration creation/update", "id": "117ff057-9e26-4f0c-ae7b-eb9fcc1c15cc", "selfLink": "/iaas/api/request-tracker/117ff057-9e26-4f0c-ae7b-eb9fcc1c15cc" }