Managing Data Sources
You can manage data sources using APIs. Data sources can be added, updated, deleted, enabled, or disabled using APIs.
Data Sources URL Prefix
/data-sources/
Data sources are grouped on the basis of the data source type. URL Prefix corresponding to data sources types are listed in this table.
Data Source Type | URL Prefix |
---|---|
VCenterDataSource | /data-sources/vcenters |
NSXVManagerDataSource | /data-sources/nsxv-managers |
NSXTManagerDataSource | /data-sources/nsxt-managers |
CiscoSwitchDataSource | /data-sources/cisco-switches |
CiscoSwitchDataSource | /data-sources/cisco-aci |
AristaSwitchDataSource | /data-sources/arista-switches |
DellSwitchDataSource | /data-sources/dell-switches |
BrocadeSwitchDataSource | /data-sources/brocade-switches |
JuniperSwitchDataSource | /data-sources/juniper-switches |
UCSManagerDataSource | /data-sources/ucs-managers |
HPOneViewDataSource | /data-sources/hpov-managers |
HPVCManagerDataSource | /data-sources/hpvc-managers |
CheckpointFirewallDataSource | /data-sources/checkpoint-firewalls |
PanFirewallDataSource | /data-sources/panorama-firewalls |
KubernetesDataSource | /data-sources/kubernetes-clusters |
PolicyManagerDataSource | /data-sources/vmc-nsxmanagers |
PKSDataSource | /data-sources/pks |
ServiceNowDataSource | /data-sources/servicenow-instances |
List Data Sources
Prerequisites
- Get the data source URL for the data source type. For more information, see Table 3-1: DataSourceType to URL Prefix.
Procedure
- Make a GET request to the URL corresponding to the data source type.
Request GET https://operations-for-networks.example.com/api/ni/data-sources/vcenters Response Body { "results": [ { "entity_id": "10000:902:627340223", "entity_type": "VCenterDataSource" }, { "entity_id": "10000:902:993642840", "entity_type": "VCenterDataSource" }, { "entity_id": "10000:902:738162743", "entity_type": "VCenterDataSource" }, { "entity_id": "10000:902:627340998", "entity_type": "VCenterDataSource" }, { "entity_id": "10000:902:390269772", "entity_type": "VCenterDataSource" } ], "total_count": 5 }
Fetch Data Source Details
Prerequisites
- Get the data source URL for the data source type. For more information, see Table 3-1: DataSourceType to URL Prefix.
- Get entity ID using thelistcommand.
Procedure
- Make a GET request for the specific data source entity ID.For example:
Request GET https://operations-for-networks.example.com/api/ni/data-sources/vcenters/10000:902:627340223 Repsonse Body { "entity_id": "10000:902:993642895", "entity_type": "VCenterDataSource", "ip": "10.197.17.68", "proxy_id": "10000:901:1586035958", "nickname": "aa", "enabled": true, "notes": "ecmp lab aa", "credentials": { "username": "administrator@vsphere.local", "password": "" } }
Update Data Source Credentials
Prerequisites
- Get the data source URL for the data source type. For more information, see Table 3-1: DataSourceType to URL Prefix.
- Get entity ID using thelistcommand.
Procedure
- Make a GET request for the specific data source entity ID.
- Make a PUT request with request body after changing the credentials in the response retrieved in step 1.For example:
Request PUT https://operations-for-networks.example.com/api/ni/data-sources/vcenters/10000:902:627340223 Request Body { "entity_id": "10000:902:993642895", "entity_type": "VCenterDataSource", "ip": "10.197.17.68", "proxy_id": "10000:901:1586035958", "nickname": "aa", "enabled": true, "notes": "ecmp lab aa", "credentials": { "username": "newuser", "password": "newpassword" } } Response Body { "entity_id": "10000:902:993642895", "entity_type": "VCenterDataSource", "ip": "10.197.17.68", "proxy_id": "10000:901:1586035958", "nickname": "aa", "enabled": true, "notes": "ecmp lab aa", "credentials": { "username": "newuser", "password": "" } }
Enable a Data Source
Prerequisites
- Get the data source URL for the data source type. For more information, see Table 3-1: DataSourceType to URL Prefix.
- Get entity_id from thelistcommand.
Procedure
- To enable a data source, make a POST request.For example:
Request POST https://operations-for-networks.example.com/api/ni/data-sources/vcenters/10000:902:627340223/enable Repsonse 200 OK
Disable a Data Source
Prerequisites
- Get the data source URL for the data source type. For more information, see Table 3-1: DataSourceType to URL Prefix.
- Get entity_id from thelistcommand.
Procedure
- To disable a data source, make a POST request.For example:
Request POST https://operations-for-networks.example.com/api/ni/data-sources/vcenters/10000:902:627340223/disable Repsonse 200 OK
Add a Data Source
Prerequisites
- Get the data source URL for the data source type. For more information, see Table 3-1: DataSourceType to URL Prefix.
- You must have IP Address or the FQDN of the data source and its credentials.
Procedure
- Get the proxy id for adding data sources using the infra/nodes APIs.
- Make a POST request conforming to the API specification. For example, to add a vCenter data source:
Request GET Request POST https://operations-for-networks.example.com/api/ni/data-sources/vcenters/ Request Body { "ip": "10.197.17.68", "fqdn": "", "proxy_id": "10000:901:1586035958", "nickname": "aa", "enabled": true, "notes": "ecmp lab aa", "credentials": { "username": "administrator@vsphere.local", "password": "password"} } Response Body { "entity_id": "10000:902:993642895", "entity_type": "VCenterDataSource", "ip": "10.197.17.68", "proxy_id": "10000:901:1586035958", "nickname": "aa", "enabled": true, "notes": "ecmp lab aa", "credentials": { "username": "administrator@vsphere.local", "password": "" } }
Delete a Data Source
Prerequisites
- Get the data source URL for the data source type. For more information, see Table 3-1: DataSourceType to URL Prefix.
- Get entity_id from thelistcommand.
Procedure
- Make a DELETE request for the specific entity_id.
Request DELETE https://operations-for-networks.example.com/api/ni/data-sources/vcenters/10000:902:627340223/ Response 204 No Content
Configure SNMP on a Switch Data Source
Prerequisites
- Get the switch data source URL for the data source type. For more information, see Table 3-1: DataSourceType to URL Prefix.
- Get entity_id from thelistcommand.
Procedure
- Make a PUT request conforming to the API specification.
Request PUT https://operations-for-networks.example.com/api/ni/data-sources/cisco-switches/10000:903:627340223 Request Body { "snmp_enabled": true, "snmp_version": "v3", "config_snmp_3": { "username": "nilesh", "authentication_type": "SHA", "authentication_password": "authentication_password", "privacy_type": "NO_PRIV" } Response Body { "snmp_enabled": true, "snmp_version": "v3", "config_snmp_3": { "username": "nilesh", "authentication_type": "SHA", "privacy_type": "NO_PRIV" }
Bulk Edit Data Sources
Description
- This endpoint allows users to submit a request for bulk operations on data sources. Bulk operations enable users to perform multiple operations simultaneously, streamlining the process and improving efficiency.
- Users can perform enable, disable, edit and delete opertaions on data sources in bulk using this API.
Prerequisites
- Get entity_id of data sources from thelistcommand.
Procedure
- Make a POST request conforming to the API specification.
- Response provides a uniquerequest_id, which serves as an identifier to track the progress of the operation. To monitor the status of the bulk operation, you can utilize theGet Bulk Operation DetailsAPI by passing the receivedrequest_idas a parameter.
Request POST https://operations-for-networks.example.com/api/ni/data-sources/bulk 1. Request Body for bulk ENABLE { "action_type": "ENABLE", "data_sources": [ { "entity_id": "10071:907:4230117030541228376" }, { "entity_id": "10071:907:8650548508942367585" } ] } Response Body { "request_id": "195d283e-30ff-4eef-865b-629851eff7" } 2. Request Body for bulk DISABLE { "action_type": "DISABLE", "data_sources": [ { "entity_id": "10071:907:4230117030541228376" }, { "entity_id": "10071:907:8650548508942367585" } ] } Response Body { "request_id": "195d283e-30ff-4eef-865b-629851effbb7" } 3. Request body for bulk UPDATE a) Bulk update username and password { "action_type": "UPDATE", "data_sources": [ { "entity_id": "10071:907:4230117030541228376", "fields": [ { "key": "USER", "value": "username" }, { "key": "PWD", "value": "pwd" } ] }, { "entity_id": "10071:907:8650548508942367585", "fields": [ { "key": "USER", "value": "username" }, { "key": "PWD", "value": "pwd" } ] } ] } Note: fields of datasources should be same Response body { "request_id": "993f42b1-010b-4811-8873-6bb3bebb90d7" } b) Request body to bulk update SNMP credentials { "action_type": "UPDATE", "data_sources": [ { "entity_id": "10071:907:4230117030541228376", "fields": [ { "key": "snmp_metric_enabled", "value": "true" }, { "key": "snmp_version", "value": "_2c" }, { "key": "snmp_community", "value": "community_string" } ] } ] } c) Other fields which can be used in bulk update * snmp_version, allowed values are _2c or _3 * snmp_username * context_name * authentication_type, allowed values are MD5 or SHA * authentication_password * privacy_type, allowed values are DES, AES128, AES192, AES256, _3DES * privacy_password * configPollingInterval * configPollingIntervalType * notes 4. Request body for bulk DELETE { "action_type": "DELETE", "data_sources": [ { "entity_id": "10071:907:4230117030541228376" }, { "entity_id": "10071:907:8650548508942367585" } ] } Response body { "request_id": "993f42b1-010b-4811-8873-6bb0d7" }
Get Bulk Operation Details
Description
This endpoint allows users to retrieve details of a specific bulk operation by providing the request_id. The request_id is a unique identifier assigned to each submitted bulk operation request. The request_id is received when user submits a bulk enable, disable, update or delete operation on datasources.
Procedure
- Make a GET request conforming to the API specification.
Request GET https://operations-for-networks.example.com/api/ni/data-sources/bulk/view-details/31094378-2261-4046-b02d-7a7851a88c99 Response { "total_count": 2, "success_count": 2, "failed_count": 0, "successful_data_sources": [ "GENERICSWITCH_DELLOS10_10.79.221.185", "GENERICSWITCH_DELLOS10_10.79.221.183" ], "failed_data_sources": [] }