API Gateway: Error Handling MigrateIn Command
search cancel

API Gateway: Error Handling MigrateIn Command

book

Article ID: 202663

calendar_today

Updated On:

Products

CA API Gateway

Issue/Introduction

The goal is to migrate properties from the source server to target server. With the service ID and restman command, the bundle is being passed using the migrateIn command. Below is the error: 

sudo -u <user> ./GatewayMigrationUtility.sh restman -z sourceSSGcommon.properties --method GET --path '1.0/bundle' --query 'clusterProperty=<CWP_ID>' --response L1_bundle --trustCertificate --trustHostname -p 443
 
Success
 
sudo -u <user> ./GatewayMigrationUtility.sh migrateIn --host TARGET_SERVER -u admin --plaintextPassword password --bundle L1_bundle --encryptionPassphrase @file:encrypt.txt --results results.xml --destFolder /bundles --trustCertificate --trustHostname -p 443
 
sudo -u <user> ./GatewayMigrationUtility.sh migrateIn --host TARGET_SERVER -u admin --plaintextPassword password --bundle L1_bundle --encryptionPassphrase @file:encrypt.txt --results results.xml --destFolder /bundles --trustCertificate --trustHostname -p 443
Warning: TLS hostname verification has been disabled
Warning: TLS server certificate check has been disabled
Running.........................................
Execution failed.

Environment

API Gateway: 9.4

Cause

When you use the restman command to export a service/policy/CWP, the response file is in an XML format. When trying to import that file, the payload is rejected because there are extraneous XML tags that are not needed to create a new property.

Also, if you are using the restman command to perform an export, use the restman command to perform the import.

Resolution

Remove the extraneous XML tags from the payload (response file). For a cluster wide property, you only need the following tags:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<l7:ClusterProperty xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
    <l7:Name>NAME_OF_CWP</l7:Name>
    <l7:Value>VALUE_OF_CWP</l7:Value>
</l7:ClusterProperty>

Use the POST method to create the new CWP on the target:

./GatewayMigrationUtility.sh restman --argFile common.prop --method POST --path '1.0/clusterProperties' --request CWP.xml --response response.xml --trustCertificate

Alternatively, you can use the PUT method to create the new CWP with the same ID used on the source:

./GatewayMigrationUtility.sh restman --argFile common.prop --method PUT --path '1.0/clusterProperties/<CWP_ID>' --request CWP.xml --response response.xml --trustCertificate

These commands should be executed by a user with Administrator privileges within the Policy Manager.