Loading…
Loading…
Discover and synchronize API services from an IBM DataPower Gateway using its REST Management Interface. Learn how the discovery process works and what
The DataPower Management Discovery Service provides a mechanism to automatically discover and catalog services hosted on an IBM DataPower Gateway. It connects to the gateway's REST Management Interface to enumerate configured services, extracts their metadata, and persists this information into the platform's database.
This service solves the problem of keeping the platform's service registry synchronized with the configuration of a DataPower instance. It operates by polling the gateway, identifying all active services, and updating the central s2r_discovered_service table. Services that are added, updated, or removed on the gateway are reflected in the registry after the discovery process runs.
The service is invoked by calling the runDiscovery method with the target gateway instance's identifier. It reads connection credentials from the LbConnectorCredentialService, communicates with the DataPower API, and writes results to the database.
NOTE
This service uses the modern REST Management Interface for discovery. It is distinct from the legacy discovery service that used SSH.
The discovery process follows a precise sequence of steps to query the DataPower Gateway and synchronize its state with the platform's service registry.
sequenceDiagram
participant System as API Publisher
participant DiscoveryService as DataPowerMgmtDiscoveryService
participant CredentialStore as Credential Store
participant DataPower as DataPower Gateway
participant Database
System->>DiscoveryService: runDiscovery(gatewayType, instanceName)
DiscoveryService->>CredentialStore: Load credentials for instance
CredentialStore-->>DiscoveryService: Return host, port, credentials
DiscoveryService->>DataPower: GET /mgmt/domains/config/ (List domains)
DataPower-->>DiscoveryService: List of domain names
loop For each domain
DiscoveryService->>DataPower: GET /mgmt/config/{domain}/{ServiceClass}
DataPower-->>DiscoveryService: List of services for that class
end
DiscoveryService->>DiscoveryService: Process all discovered services
Note right of DiscoveryService: - Generate vendor_service_id<br/>- Resolve frontend/backend endpoints<br/>- Prepare raw_metadata
DiscoveryService->>Database: UPSERT discovered services into s2r_discovered_service
DiscoveryService->>Database: Mark services not seen in this run as inactive
Database-->>DiscoveryService: Confirm persistence
DiscoveryService-->>System: Return DiscoveryResult (counts, errors)The workflow consists of the following steps:
s2r_lb_connector_credentials table.GET /mgmt/domains/config/ request to retrieve a list of all configured application domains.GET /mgmt/config/{domain}/{ClassName}) to get a list of all configured services of that type. The service classes are:
MultiProtocolGatewayWSGatewayXMLFirewallServiceHTTPServiceWebAppFW"domain:className:serviceName".LocalAddress and LocalPort fields of the service configuration, if present. The protocol (http or https a) is inferred based on the service class.MultiProtocolGateway: From the BackendURL field.WSGateway: From the Re<customer>eEndpoint field.s2r_discovered_service table:
gateway_type, instance_name, and vendor_service_id. New services are inserted, and existing services are updated with the latest metadata and last_seen_at timestamp.is_active = false).DiscoveryResult object containing statistics on the number of services discovered, added, updated, and marked inactive, along with a list of any errors encountered.Before running discovery, you must configure the connection details for the target IBM DataPower Gateway instance. The service relies on the LbConnectorCredentialService to provide these details.
IMPORTANT
A credential entry must exist in the s2r_lb_connector_credentials table for the gatewayType and instanceName pair you wish to discover. If an entry is not found, the runDiscovery method will fail.
The following connection parameters are required:
| Field | Type | Default | Required | Description |
|---|---|---|---|---|
host | String | — | Yes | The hostname or IP address of the DataPower Gateway's REST Management Interface. |
port | Integer | 5554 | No | The port for the DataPower REST Management Interface. If not provided, the default of 5554 is used. |
username | String | — | Yes | The username for authenticating to the REST Management Interface. |
password | String | — | Yes | The password for the specified user. |
verifyTls | Boolean | — | Yes | A flag indicating whether to perform TLS certificate validation when connecting to the management host. |
The service exposes a single public method to initiate the discovery process.
runDiscoveryTriggers a full discovery pass for a given DataPower gateway instance.
DiscoveryResult runDiscovery(String gatewayType, String instanceName)
| Name | Type | Description |
|---|---|---|
gatewayType | String | The type of the gateway, used to look up credentials. For this service, it should identify a DataPower instance. |
instanceName | String | The unique name of the gateway instance, used to look up credentials and scope the discovered services. |
A DiscoveryResult object summarizing the outcome of the discovery run.
| Field | Type | Description |
|---|---|---|
totalDiscovered | Integer | The total number of services found on the gateway during this run. |
newlyAdded | Integer | The number of services discovered for the first time and added to the DB. |
updated | Integer | The number of existing services that were updated with new metadata. |
markedInactive | Integer | The number of services previously known but not found in this run. |
durationMs | Long | The total time taken for the discovery run, in milliseconds. |
errors | List<String> | A list of error messages generated during the run. |
LbConnectorCredentialService.NotFoundException: Thrown if credentials for the specified gatewayType and instanceName are not registered in the system.The discovery service writes its findings to the s2r_discovered_service table. The following fields are populated specifically by this service.
| Field | Data Type | Description -| --- | --- | |vendor_service_id| String | The unique identifier for the service within the DataPower instance. Format:"domain:className:serviceName". Example: default:MultiProtocolGateway:MyService. -
| backend_pool_name | String | A logical grouping for the backend, constructed as "domain:className". -|frontend_protocol| String | The inferred frontend protocol. The inference logic is:WSGateway, XMLFirewallService, and WebAppFWdefault tohttps; all others default to http. -
| backend_members | JSONB | A JSON array containing the resolved backend URI. For DataPower, this will be an array with a single object [{"uri": "..."}] if a backend was resolved, or an empty array [] if not. -|raw_metadata| JSONB | The full, unmodified JSON configuration object for the service as returned by the DataPower REST Management Interface. The internalclassName field added by the client is removed before persistence. -
| is_active | Boolean | Set to true if the service was found in the latest discovery run, or false if it was not. -`
NOTE
The resolution of frontend and backend endpoints is performed on a best-effort basis using documented fields in the DataPower REST Management API. The source code indicates that field names like LocalAddress, LocalPort, and Re<customer>eEndpoint are based on public documentation and may require verification in specific customer environments. If a field is not present in the API response for a given service, its corresponding value in the database will be null.
The service logs errors with specific codes to aid in diagnostics.
| Error Code | Condition -` |
|---|---|
| ` | |
S2R-LBC-0401 | DataPower authentication failed. This error occurs when the provided username or password is incorrect. It can happen when initially listing domains or when enumerating services within a specific domain. Verify the credentials configured for the gateway instance. -` |
S2R-LBC-0502 | Generic client or persistence error. This code covers several failure modes:<ul><li>failed to build DataPower REST client: Check the configured host, port, and TLS settings for the gateway.</li><li>DataPower listDomains failed: Indicates a network connectivity issue or an unexpected error from the DataPower management interface when listing domains.</li><li>error enumerating domain '{domain}': A non-auth error occurred while fetching the list of services for a specific domain.</li><li>DB persist error: The discovery process succeeded in fetching data from DataPower, but failed to write the results to the database. Check database connectivity and logs.</li></ul> |
CitrixDiscoveryService.LbConnectorCredentialService.