Wednesday, 29 August 2018

Migrate Integration Cloud Service (ICS) Integrations to Integration Cloud (OIC)

This article is written to show how to migrate ICS artifacts including Integrations, Connections, Lookups, packages, libraries etc. to OIC. Since, ICS /OIC provides the export and import feature but this is limited to single integration at a time. What about, if there are 100's of integration which are there in the ICS and wanted to migrate all integrations once.

To do so, there is Clone utility which is provided for bulk export all the integrations, connections, packages, libraries and other artifacts from ICS to OIC. This clone utility is the set of REST APIs in ICS / OIC. ICS provides REST APIs to bulk export ICS artifacts and OIC provides REST APIs to import these exported artifacts.

Prerequisites:
  • Oracle Cloud Storage Container with create / update permissions
  • Existing ICS service with Admin role access to the service
  • OIC service with Admin role access to the service
  • A feature flag has to be enabled on OIC to enable clone utility. To turn on the feature flag, open a Service Request with Oracle support
Artifacts, which can be exported using the Clone Utility:
  • Integrations
  • Connections including credentials
  • Lookups
  • Libararies
  • Certificates
  • Packages
Note: Agent groups can not be exported, this need to be created manually

Below is the pictorial representation, which will give a high level, thought on how migration works


Let me explain the diagram in more detail
  • Execute the export API to export ICS artifacts
  • The first steps will create the archive file automatically and save into Oracle Storage Cloud container
  • Execute the Import API which will import the archive file from Oracle Storage Cloud container into OIC instance
  • Once archive file imported successfully, ICS artifacts will be imported into OIC
Let's execute the step one by one and achieve the migration

Step-1: Create Oracle Storage Container

Let's create the container if not exist already. Before we create a container let's identify the Storage URL which will be used in the next step to save the exported archive file. To see the Storage URL, login into the Oracle Cloud my services and navigate to the Dashboard. Click on the Storage Classic (if not found, customized the dashboard screen using Customize Dashboard tile)


Note the value of REST Endpoint (Permanent) which will be used while running the import/export API. This is the storage URL.


Storage URL will be in the below format

 https://Storage-<unique_identifier>.us.storage.oraclecloud.com/v1/Storage-<unique_identifier>

Now, create the storage container
  • Login to my services
  • Click on the Storage Classic from left Menu
  • Click on Create Container button. Enter Name (ankur) and Click Create button

A container will be created with the name "ankur"

Step-2: Export ICS artifacts

ICS provides an API which will be used to export the ICS artifacts. Below are the API details which will be used to export

Request

URL:

https://ICSServer:port/icsapis/v2/clonepod/exportArtifacts

HTTP Verb: POST

Header:

Authorization: Basic <ICS username:password>

Body

{
                "storageInfo":   {
                                "storageUrl":" https://Storage-URL",
                                "storageUser":"Storage_UserName",
                                "storagePassword":" Storage_Password"
                }
}

Note: Storage URL will be constructed by appending the container name (ankur) which we created in the previous step with the Storage-URL which we noted from the value of REST Endpoint (Permanent). 

For example:

https://Storage-<unique_identifier>.us.storage.oraclecloud.com/v1/Storage-<unique_identifier>/ankur

Below will be the response of the API upon successful

Response

{
    "archiveFilename": "archive_Local_Suite_Instance-a3279de9-af56-49e6-978b-7194af719e8a.zip",
    "jobID": "a3279de9-af56-49e6-978b-7194af719e8a",
    "location": "https://storage.us.storage.oraclecloud.com/v1/Storage-storage/ankur",
    "status": "Starting"
}


Note the archiveFileName response parameter, this is the archive file which will be saved into the storage container and will be used while importing the artifacts into OIC

Sample curl command

curl -X POST https://ICSURL:PORT/icsapis/v2/clonepod/exportArtifacts  -H 'authorization: Basic sddewwsdGSDWweweGFjdC5jb206R2VucGFjdEAxMjM0NQ=='  -H 'content-type: application/json'   -d '{"storageInfo":{"storageUrl":"https://storage.us.storage.oraclecloud.com/v1/Storage-storage/ankur","storageUser":"example@gmail.com","storagePassword":"example@1234"}}'

To check the export status, use below GET API

https://ICSServer/icsapis/v2/clonepod/exportStatus

Either "RUNNING" or "COMPLETED" status will be fetched from the above API. In the worst case, we may see the status as "Failed" in case the job fails. Download the diagnostic logs from ICS and see the Admin server logs to diagnose the issue.

Once the job is completed, the archive file can be seen in the storage container by clicking on the container (ankur)


Step-3: Import artifacts into OIC

Once the archive file generated successfully, the archive file can be imported into OIC via the REST API "https://OICSserver/ic/api/common/v1/importServiceInstanceArchive"

The import API has three different parameters either can be used to import and activate the integration

Parameter
Value
Description
importActivateMode
ImportActivate
All integrations/flows are imported and after successfully importing the integrations/flows are activated
importOnly
ImportActivate
All integrations/flows are only imported but not activated
activateOnly
ImportActivate
Can be used if the ImportOnly mode was used and all integrations/flows need to be activated

Request

URL:

https://OICSserver/ic/api/common/v1/importServiceInstanceArchive

HTTP Verb: POST

Header:

Authorization: Basic <OIC username:password>

Body:

{
                "archiveFile":" archive_Local_Suite_Instance-a3279de9-af56-49e6-978b-7194af719e8a.zip",
                "importActivateMode":"ImportActivate",
                "storageInfo":
                {
                                "storageUrl":"https://storage.us.storage.oraclecloud.com/v1/Storage-storage/ankur",
                                "storageUser":"example@gmail.com",
                                "storagePassword":"example@1234"

                }
}

Response

{
                "jobId":"5123",
                "status":"NOT_STARTED"
}

Sample curl command of an import API

curl -X POST https://oicinstance/ic/api/common/v1/importServiceInstanceArchive -H 'authorization: Basic sddsds121xdsddtYWlsLmNvbTpXZWxjb21lQDEyMzQ=' -d '{
"archiveFile":"archive_Local_Suite_Instance-ee041ff3-7659-4d2c-80e4-fbe47377448e.zip","importActivateMode":"ImportActivate","storageInfo":{"storageUrl":"https://storage.us.storage.oraclecloud.com/v1/Storage-storage/ankur","storageUser":"example@gmail.com","storagePassword":"example@1234"}}'

Use the jobId response parameter to check the status of the import job. Use below GET API to check the import status

https://OICServer/ic/api/common/v1/importServiceInstanceArchive/<JOBID>

Once the job is completed, login into OIC instance and sees the artifacts should be imported successfully.

No comments:

Post a Comment