Adapter
Adapter for Integration to VMware vCenter
Overview
This adapter is used to integrate the Itential Automation Platform (IAP) with the Vmware_vCenter System. The API that was used to build the adapter for Vmware_vCenter is usually available in the report directory of this adapter. The adapter utilizes the Vmware_vCenter API to provide the integrations that are deemed pertinent to IAP. The ReadMe file is intended to provide information on this adapter it is generated from various other Markdown files.
Details
The VMware vCenter adapter from Itential is used to integrate the Itential Automation Platform (IAP) with VMware vCenter. With this adapter you have the ability to perform operations such as:
- Manage Server Appliance infrastructure in a vSphere environment.
For further technical details on how to install and use this adapter, please click the Technical Documentation tab.
VMware vCenter
Table of Contents
Getting Started
These instructions will help you get a copy of the project on your local machine for development and testing. Reading this section is also helpful for deployments as it provides you with pertinent information on prerequisites and properties.
Helpful Background Information
There is Adapter documentation available on the Itential Documentation Site. This documentation includes information and examples that are helpful for:
Authentication
IAP Service Instance Configuration
Code Files
Endpoint Configuration (Action & Schema)
Mock Data
Adapter Generic Methods
Headers
Security
Linting and Testing
Build an Adapter
Troubleshooting an Adapter
Others will be added over time. Want to build a new adapter? Use the Itential Adapter Builder
Prerequisites
The following is a list of required packages for installation on the system the adapter will run on:
Node.js
npm
Git
The following list of packages are required for Itential opensource adapters or custom adapters that have been built utilizing the Itential Adapter Builder. You can install these packages by running npm install inside the adapter directory.
Package | Description |
---|---|
@itentialopensource/adapter-utils | Runtime library classes for all adapters; includes request handling, connection, authentication throttling, and translation. |
ajv | Required for validation of adapter properties to integrate with Vmware_vCenter. |
axios | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
commander | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
dns-lookup-promise | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
fs-extra | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
mocha | Testing library that is utilized by some of the node scripts that are included with the adapter. |
mocha-param | Testing library that is utilized by some of the node scripts that are included with the adapter. |
mongodb | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
nyc | Testing coverage library that is utilized by some of the node scripts that are included with the adapter. |
ping | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
readline-sync | Utilized by the node script that comes with the adapter; helps to test unit and integration functionality. |
semver | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
winston | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
If you are developing and testing a custom adapter, or have testing capabilities on an Itential opensource adapter, you will need to install these packages as well.
chai
eslint
eslint-config-airbnb-base
eslint-plugin-import
eslint-plugin-json
testdouble
How to Install
- Set up the name space location in your IAP node_modules.
cd /opt/pronghorn/current/node_modules (* could be in a different place)
if the @itentialopensource directory does not exist, create it:
mkdir @itentialopensource
- Clone/unzip/tar the adapter into your IAP environment.
cd \@itentialopensource
git clone git@gitlab.com:\@itentialopensource/adapters/adapter-vmware_vcenter
or
unzip adapter-vmware_vcenter.zip
or
tar -xvf adapter-vmware_vcenter.tar
- Run the adapter install script.
cd adapter-vmware_vcenter
npm install
npm run lint:errors
npm run test
- Restart IAP
systemctl restart pronghorn
Create an adapter service instance configuration in IAP Admin Essentials GUI
Copy the properties from the sampleProperties.json and paste them into the service instance configuration in the inner/second properties field.
Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI
For an easier install of the adapter use npm run adapter:install, it will install the adapter in IAP. Please note that it can be dependent on where the adapter is installed and on the version of IAP so it is subject to fail. If using this, you can replace step 3-5 above with these:
- Install adapter dependencies and check the adapter.
cd adapter-vmware_vcenter
npm run adapter:install
- Restart IAP
systemctl restart pronghorn
- Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI
Testing
Mocha is generally used to test all Itential Opensource Adapters. There are unit tests as well as integration tests performed. Integration tests can generally be run as standalone using mock data and running the adapter in stub mode, or as integrated. When running integrated, every effort is made to prevent environmental failures, however there is still a possibility.
Unit Testing
Unit Testing includes testing basic adapter functionality as well as error conditions that are triggered in the adapter prior to any integration. There are two ways to run unit tests. The prefered method is to use the testRunner script; however, both methods are provided here.
node utils/testRunner --unit
npm run test:unit
npm run test:baseunit
To add new unit tests, edit the test/unit/adapterTestUnit.js
file. The tests that are already in this file should provide guidance for adding additional tests.
Integration Testing - Standalone
Standalone Integration Testing requires mock data to be provided with the entities. If this data is not provided, standalone integration testing will fail. When the adapter is set to run in stub mode (setting the stub property to true), the adapter will run through its code up to the point of making the request. It will then retrieve the mock data and return that as if it had received that data as the response from Vmware_vCenter. It will then translate the data so that the adapter can return the expected response to the rest of the Itential software. Standalone is the default integration test.
Similar to unit testing, there are two ways to run integration tests. Using the testRunner script is better because it prevents you from having to edit the test script; it will also resets information after testing is complete so that credentials are not saved in the file.
node utils/testRunner
answer no at the first prompt
npm run test:integration
To add new integration tests, edit the test/integration/adapterTestIntegration.js
file. The tests that are already in this file should provide guidance for adding additional tests.
Integration Testing
Integration Testing requires connectivity to Vmware_vCenter. By using the testRunner script it prevents you from having to edit the integration test. It also resets the integration test after the test is complete so that credentials are not saved in the file.
Note: These tests have been written as a best effort to make them work in most environments. However, the Adapter Builder often does not have the necessary information that is required to set up valid integration tests. For example, the order of the requests can be very important and data is often required for
creates
andupdates
. Hence, integration tests may have to be enhanced before they will work (integrate) with Vmware_vCenter. Even after tests have been set up properly, it is possible there are environmental constraints that could result in test failures. Some examples of possible environmental issues are customizations that have been made within Vmware_vCenter which change order dependencies or required data.
node utils/testRunner
answer yes at the first prompt
answer all other questions on connectivity and credentials
Test should also be written to clean up after themselves. However, it is important to understand that in some cases this may not be possible. In addition, whenever exceptions occur, test execution may be stopped, which will prevent cleanup actions from running. It is recommended that tests be utilized in dev and test labs only.
Reminder: Do not check in code with actual credentials to systems.
Configuration
This section defines all the properties that are available for the adapter, including detailed information on what each property is for. If you are not using certain capabilities with this adapter, you do not need to define all of the properties. An example of how the properties for this adapter can be used with tests or IAP are provided in the sampleProperties.
Example Properties
"properties": {
"host": "localhost",
"port": 80,
"choosepath": "",
"base_path": "/rest",
"version": "",
"cache_location": "none",
"encode_pathvars": true,
"encode_queryvars": true,
"save_metric": false,
"stub": true,
"protocol": "http",
"authentication": {
"auth_method": "request_token",
"username": "exampleUsername",
"password": "examplePassword",
"token": "",
"token_timeout": 180000,
"token_cache": "local",
"invalid_token_error": 401,
"auth_field": "header.headers.Cookie",
"auth_field_format": "vmware-api-session-id={token}",
"auth_logging": false,
"client_id": "",
"client_secret": "",
"grant_type": "",
"sensitive": [],
"sso": {
"protocol": "",
"host": "",
"port": 0
},
"multiStepAuthCalls": [
{
"name": "",
"requestFields": {},
"responseFields": {},
"successfullResponseCode": 200
}
]
},
"healthcheck": {
"type": "none",
"frequency": 60000,
"query_object": {},
"addlHeaders": {}
},
"throttle": {
"throttle_enabled": false,
"number_pronghorns": 1,
"sync_async": "sync",
"max_in_queue": 1000,
"concurrent_max": 1,
"expire_timeout": 0,
"avg_runtime": 200,
"priorities": [
{
"value": 0,
"percent": 100
}
]
},
"request": {
"number_redirects": 0,
"number_retries": 3,
"limit_retry_error": 0,
"failover_codes": [],
"attempt_timeout": 10000,
"global_request": {
"payload": {},
"uriOptions": {},
"addlHeaders": {},
"authData": {}
},
"healthcheck_on_timeout": false,
"return_raw": false,
"archiving": false,
"return_request": false
},
"proxy": {
"enabled": false,
"host": "",
"port": 1,
"protocol": "http",
"username": "",
"password": ""
},
"ssl": {
"ecdhCurve": "",
"enabled": false,
"accept_invalid_cert": true,
"ca_file": "",
"key_file": "",
"cert_file": "",
"secure_protocol": "",
"ciphers": ""
},
"mongo": {
"host": "",
"port": 0,
"database": "",
"username": "",
"password": "",
"replSet": "",
"db_ssl": {
"enabled": false,
"accept_invalid_cert": false,
"ca_file": "",
"key_file": "",
"cert_file": ""
}
},
"devicebroker": {
"getDevice": [
{
"path": "/get/devices/{id}",
"method": "GET",
"query": {},
"body": {},
"headers": {},
"handleFailure": "ignore",
"requestFields": {
"id": "name"
},
"responseDatakey": "",
"responseFields": {
"name": "host",
"ostype": "os",
"ostypePrefix": "system-",
"ipaddress": "attributes.ipaddr",
"port": "443"
}
}
],
"getDevicesFiltered": [
{
"path": "/get/devices",
"method": "GET",
"pagination": {
"offsetVar": "",
"limitVar": "",
"incrementBy": "limit",
"requestLocation": "query"
},
"query": {},
"body": {},
"headers": {},
"handleFailure": "ignore",
"requestFields": {},
"responseDatakey": "",
"responseFields": {
"name": "host",
"ostype": "os",
"ostypePrefix": "system-",
"ipaddress": "attributes.ipaddr",
"port": "443"
}
}
],
"isAlive": [
{
"path": "/get/devices/{id}/status",
"method": "GET",
"query": {},
"body": {},
"headers": {},
"handleFailure": "ignore",
"requestFields": {
"id": "name"
},
"responseDatakey": "",
"responseFields": {
"status": "status",
"statusValue": "online"
}
}
],
"getConfig": [
{
"path": "/get/devices/{id}/configPart1",
"method": "GET",
"query": {},
"body": {},
"headers": {},
"handleFailure": "ignore",
"requestFields": {
"id": "name"
},
"responseDatakey": "",
"responseFields": {}
}
],
"getCount": [
{
"path": "/get/devices",
"method": "GET",
"query": {},
"body": {},
"headers": {},
"handleFailure": "ignore",
"requestFields": {},
"responseDatakey": "",
"responseFields": {}
}
]
},
"cache": {
"enabled": false,
"entities": [
{
"entityType": "",
"frequency": 1440,
"flushOnFail": false,
"limit": 1000,
"retryAttempts": 5,
"sort": true,
"populate": [
{
"path": "",
"method": "GET",
"pagination": {
"offsetVar": "",
"limitVar": "",
"incrementBy": "limit",
"requestLocation": "query"
},
"query": {},
"body": {},
"headers": {},
"handleFailure": "ignore",
"requestFields": {},
"responseDatakey": "",
"responseFields": {}
}
],
"cachedTasks": [
{
"name": "",
"filterField": "",
"filterLoc": ""
}
]
}
]
}
}
Connection Properties
These base properties are used to connect to Vmware_vCenter upon the adapter initially coming up. It is important to set these properties appropriately.
Property | Description |
---|---|
host | Required. A fully qualified domain name or IP address. |
port | Required. Used to connect to the server. |
base_path | Optional. Used to define part of a path that is consistent for all or most endpoints. It makes the URIs easier to use and maintain but can be overridden on individual calls. An example **base_path** might be `/rest/api`. Default is ``. |
version | Optional. Used to set a global version for action endpoints. This makes it faster to update the adapter when endpoints change. As with the base-path, version can be overridden on individual endpoints. Default is ``. |
cache_location | Optional. Used to define where the adapter cache is located. The cache is used to maintain an entity list to improve performance. Storage locally is lost when the adapter is restarted. Storage in Redis is preserved upon adapter restart. Default is none which means no caching of the entity list. |
encode_pathvars | Optional. Used to tell the adapter to encode path variables or not. The default behavior is to encode them so this property can be used to stop that behavior. |
encode_queryvars | Optional. Used to tell the adapter to encode query parameters or not. The default behavior is to encode them so this property can be used to stop that behavior. |
save_metric | Optional. Used to tell the adapter to save metric information (this does not impact metrics returned on calls). This allows the adapter to gather metrics over time. Metric data can be stored in a database or on the file system. |
stub | Optional. Indicates whether the stub should run instead of making calls to Vmware_vCenter (very useful during basic testing). Default is false (which means connect to Vmware_vCenter). |
protocol | Optional. Notifies the adapter whether to use HTTP or HTTPS. Default is HTTP. |
A connectivity check tells IAP the adapter has loaded successfully.
Authentication Properties
The following properties are used to define the authentication process to Vmware_vCenter.
Note: Depending on the method that is used to authenticate with Vmware_vCenter, you may not need to set all of the authentication properties.
Property | Description |
---|---|
auth_method | Required. Used to define the type of authentication currently supported. Authentication methods currently supported are: `basic user_password`, `static_token`, `request_token`, and `no_authentication`. |
username | Used to authenticate with Vmware_vCenter on every request or when pulling a token that will be used in subsequent requests. |
password | Used to authenticate with Vmware_vCenter on every request or when pulling a token that will be used in subsequent requests. |
token | Defines a static token that can be used on all requests. Only used with `static_token` as an authentication method (auth\_method). |
invalid_token_error | Defines the HTTP error that is received when the token is invalid. Notifies the adapter to pull a new token and retry the request. Default is 401. |
token_timeout | Defines how long a token is valid. Measured in milliseconds. Once a dynamic token is no longer valid, the adapter has to pull a new token. If the token_timeout is set to -1, the adapter will pull a token on every request to Vmware_vCenter. If the timeout_token is 0, the adapter will use the expiration from the token response to determine when the token is no longer valid. |
token_cache | Used to determine where the token should be stored (local memory or in Redis). |
auth_field | Defines the request field the authentication (e.g., token are basic auth credentials) needs to be placed in order for the calls to work. |
auth_field_format | Defines the format of the auth\_field. See examples below. Items enclosed in {} inform the adapter to perofrm an action prior to sending the data. It may be to replace the item with a value or it may be to encode the item. |
auth_logging | Setting this true will add some additional logs but this should only be done when trying to debug an issue as certain credential information may be logged out when this is true. |
client_id | Provide a client id when needed, this is common on some types of OAuth. |
client_secret | Provide a client secret when needed, this is common on some types of OAuth. |
grant_type | Provide a grant type when needed, this is common on some types of OAuth. |
Examples of authentication field format
"{token}"
"Token {token}"
"{username}:{password}"
"Basic {b64}{username}:{password}{/b64}"
Healthcheck Properties
The healthcheck properties defines the API that runs the healthcheck to tell the adapter that it can reach Vmware_vCenter. There are currently three types of healthchecks.
- None - Not recommended. Adapter will not run a healthcheck. Consequently, unable to determine before making a request if the adapter can reach Vmware_vCenter.
- Startup - Adapter will check for connectivity when the adapter initially comes up, but it will not check afterwards.
- Intermittent - Adapter will check connectivity to Vmware_vCenter at a frequency defined in the
frequency
property.
Property | Description |
---|---|
type | Required. The type of health check to run. |
frequency | Required if intermittent. Defines how often the health check should run. Measured in milliseconds. Default is 300000. |
query_object | Query parameters to be added to the adapter healthcheck call. |
Request Properties
The request section defines properties to help handle requests.
Property | Description |
---|---|
number_redirects | Optional. Tells the adapter that the request may be redirected and gives it a maximum number of redirects to allow before returning an error. Default is 0 - no redirects. |
number_retries | Tells the adapter how many times to retry a request that has either aborted or reached a limit error before giving up and returning an error. |
limit_retry_error | Optional. Can be either an integer or an array. Indicates the http error status number to define that no capacity was available and, after waiting a short interval, the adapter can retry the request. If an array is provvided, the array can contain integers or strings. Strings in the array are used to define ranges (e.g. "502-506"). Default is [0]. |
failover_codes | An array of error codes for which the adapter will send back a failover flag to IAP so that the Platform can attempt the action in another adapter. |
attempt_timeout | Optional. Tells how long the adapter should wait before aborting the attempt. On abort, the adapter will do one of two things: 1) return the error; or 2) if **healthcheck\_on\_timeout** is set to true, it will abort the request and run a Healthcheck until it re-establishes connectivity to Vmware_vCenter, and then will re-attempt the request that aborted. Default is 5000 milliseconds. |
global_request | Optional. This is information that the adapter can include in all requests to the other system. This is easier to define and maintain than adding this information in either the code (adapter.js) or the action files. |
global_request -> payload | Optional. Defines any information that should be included on all requests sent to the other system that have a payload/body. |
global_request -> uriOptions | Optional. Defines any information that should be sent as untranslated query options (e.g. page, size) on all requests to the other system. |
global_request -> addlHeaders | Optioonal. Defines any headers that should be sent on all requests to the other system. |
global_request -> authData | Optional. Defines any additional authentication data used to authentice with the other system. This authData needs to be consistent on every request. |
healthcheck_on_timeout | Required. Defines if the adapter should run a health check on timeout. If set to true, the adapter will abort the request and run a health check until it re-establishes connectivity and then it will re-attempt the request. |
return_raw | Optional. Tells the adapter whether the raw response should be returned as well as the IAP response. This is helpful when running integration tests to save mock data. It does add overhead to the response object so it is not ideal from production. |
archiving | Optional flag. Default is false. It archives the request, the results and the various times (wait time, Vmware_vCenter time and overall time) in the `adapterid_results` collection in MongoDB. Although archiving might be desirable, be sure to develop a strategy before enabling this capability. Consider how much to archive and what strategy to use for cleaning up the collection in the database so that it does not become too large, especially if the responses are large. |
return_request | Optional flag. Default is false. Will return the actual request that is made including headers. This should only be used during debugging issues as there could be credentials in the actual request. |
SSL Properties
The SSL section defines the properties utilized for ssl authentication with Vmware_vCenter. SSL can work two different ways: set the accept\_invalid\_certs
flag to true (only recommended for lab environments), or provide a ca\_file
.
Property | Description |
---|---|
enabled | If SSL is required, set to true. |
accept_invalid_certs | Defines if the adapter should accept invalid certificates (only recommended for lab environments). Required if SSL is enabled. Default is false. |
ca_file | Defines the path name to the CA file used for SSL. If SSL is enabled and the accept invalid certifications is false, then ca_file is required. |
key_file | Defines the path name to the Key file used for SSL. The key_file may be needed for some systems but it is not required for SSL. |
cert_file | Defines the path name to the Certificate file used for SSL. The cert_file may be needed for some systems but it is not required for SSL. |
secure_protocol | Defines the protocol (e.g., SSLv3_method) to use on the SSL request. |
ciphers | Required if SSL enabled. Specifies a list of SSL ciphers to use. |
ecdhCurve | During testing on some Node 8 environments, you need to set `ecdhCurve` to auto. If you do not, you will receive PROTO errors when attempting the calls. This is the only usage of this property and to our knowledge it only impacts Node 8 and 9. |
Throttle Properties
The throttle section is used when requests to Vmware_vCenter must be queued (throttled). All of the properties in this section are optional.
Property | Description |
---|---|
throttle_enabled | Default is false. Defines if the adapter should use throttling or not. |
number_pronghorns | Default is 1. Defines if throttling is done in a single Itential instance or whether requests are being throttled across multiple Itential instances (minimum = 1, maximum = 20). Throttling in a single Itential instance uses an in-memory queue so there is less overhead. Throttling across multiple Itential instances requires placing the request and queue information into a shared resource (e.g. database) so that each instance can determine what is running and what is next to run. Throttling across multiple instances requires additional I/O overhead. |
sync-async | This property is not used at the current time (it is for future expansion of the throttling engine). |
max_in_queue | Represents the maximum number of requests the adapter should allow into the queue before rejecting requests (minimum = 1, maximum = 5000). This is not a limit on what the adapter can handle but more about timely responses to requests. The default is currently 1000. |
concurrent_max | Defines the number of requests the adapter can send to Vmware_vCenter at one time (minimum = 1, maximum = 1000). The default is 1 meaning each request must be sent to Vmware_vCenter in a serial manner. |
expire_timeout | Default is 0. Defines a graceful timeout of the request session. After a request has completed, the adapter will wait additional time prior to sending the next request. Measured in milliseconds (minimum = 0, maximum = 60000). |
average_runtime | Represents the approximate average of how long it takes Vmware_vCenter to handle each request. Measured in milliseconds (minimum = 50, maximum = 60000). Default is 200. This metric has performance implications. If the runtime number is set too low, it puts extra burden on the CPU and memory as the requests will continually try to run. If the runtime number is set too high, requests may wait longer than they need to before running. The number does not need to be exact but your throttling strategy depends heavily on this number being within reason. If averages range from 50 to 250 milliseconds you might pick an average run-time somewhere in the middle so that when Vmware_vCenter performance is exceptional you might run a little slower than you might like, but when it is poor you still run efficiently. |
priorities | An array of priorities and how to handle them in relation to the throttle queue. Array of objects that include priority value and percent of queue to put the item ex { value: 1, percent: 10 } |
Proxy Properties
The proxy section defines the properties to utilize when Vmware_vCenter is behind a proxy server.
Property | Description |
---|---|
enabled | Required. Default is false. If Vmware_vCenter is behind a proxy server, set enabled flag to true. |
host | Host information for the proxy server. Required if `enabled` is true. |
port | Port information for the proxy server. Required if `enabled` is true. |
protocol | The protocol (i.e., http, https, etc.) used to connect to the proxy. Default is http. |
username | If there is authentication for the proxy, provide the username here. |
password | If there is authentication for the proxy, provide the password here. |
Mongo Properties
The mongo section defines the properties used to connect to a Mongo database. Mongo can be used for throttling as well as to persist metric data. If not provided, metrics will be stored in the file system.
Property | Description |
---|---|
host | Optional. Host information for the mongo server. |
port | Optional. Port information for the mongo server. |
database | Optional. The database for the adapter to use for its data. |
username | Optional. If credentials are required to access mongo, this is the user to login as. |
password | Optional. If credentials are required to access mongo, this is the password to login with. |
replSet | Optional. If the database is set up to use replica sets, define it here so it can be added to the database connection. |
db_ssl | Optional. Contains information for SSL connectivity to the database. |
db_ssl -> enabled | If SSL is required, set to true. |
db_ssl -> accept_invalid_cert | Defines if the adapter should accept invalid certificates (only recommended for lab environments). Required if SSL is enabled. Default is false. |
db_ssl -> ca_file | Defines the path name to the CA file used for SSL. If SSL is enabled and the accept invalid certifications is false, then ca_file is required. |
db_ssl -> key_file | Defines the path name to the Key file used for SSL. The key_file may be needed for some systems but it is not required for SSL. |
db_ssl -> cert_file | Defines the path name to the Certificate file used for SSL. The cert_file may be needed for some systems but it is not required for SSL. |
Device Broker Properties
The device broker section defines the properties used integrate Vmware_vCenter to the device broker. Each broker call is represented and has an array of calls that can be used to build the response. This describes the calls and then the fields which are available in the calls.
Property | Description |
---|---|
getDevice | The array of calls used to get device details for the broker |
getDevicesFiltered | The array of calls used to get devices for the broker |
isAlive | The array of calls used to get device status for the broker |
getConfig | The array of calls used to get device configuration for the broker |
getCount | The array of calls used to get device configuration for the broker |
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> path | The path, not including the base_path and version, for making this call |
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> method | The rest method for making this call |
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> query | Query object containing and query parameters and their values for this call |
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> body | Body object containing the payload for this call |
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> headers | Header object containing the headers for this call. |
getDevice/getDevicesFiltered/isAlive/getConfig/getCount -> handleFailure | Tells the adapter whether to "fail" or "ignore" failures if they occur. |
isAlive -> statusValue | Tells the adapter what value to look for in the status field to determine if the device is alive. |
getDevice/getDevicesFiltered/isAlive/getConfig -> requestFields | Object containing fields the adapter should send on the request and where it should get the data. The where can be from a response to a getDevicesFiltered or a static value. |
getDevice/getDevicesFiltered/isAlive/getConfig -> responseFields | Object containing fields the adapter should set to send back to iap and where the value should come from in the response or request data. |
Using this Adapter
The adapter.js
file contains the calls the adapter makes available to the rest of the Itential Platform. The API detailed for these calls should be available through JSDOC. The following is a brief summary of the calls.
Generic Adapter Calls
These are adapter methods that IAP or you might use. There are some other methods not shown here that might be used for internal adapter functionality.
Method Signature | Description | Workflow? |
---|---|---|
connect() | This call is run when the Adapter is first loaded by he Itential Platform. It validates the properties have been provided correctly. | No |
healthCheck(callback) | This call ensures that the adapter can communicate with Adapter for VMware vCenter. The actual call that is used is defined in the adapter properties and .system entities action.json file. | No |
refreshProperties(properties) | This call provides the adapter the ability to accept property changes without having to restart the adapter. | No |
encryptProperty(property, technique, callback) | This call will take the provided property and technique, and return the property encrypted with the technique. This allows the property to be used in the adapterProps section for the credential password so that the password does not have to be in clear text. The adapter will decrypt the property as needed for communications with Adapter for VMware vCenter. | No |
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) | This call provides the ability to update the adapter configuration from IAP - includes actions, schema, mockdata and other configurations. | Yes |
iapSuspendAdapter(mode, callback) | This call provides the ability to suspend the adapter and either have requests rejected or put into a queue to be processed after the adapter is resumed. | Yes |
iapUnsuspendAdapter(callback) | This call provides the ability to resume a suspended adapter. Any requests in queue will be processed before new requests. | Yes |
iapGetAdapterQueue(callback) | This call will return the requests that are waiting in the queue if throttling is enabled. | Yes |
iapFindAdapterPath(apiPath, callback) | This call provides the ability to see if a particular API path is supported by the adapter. | Yes |
iapTroubleshootAdapter(props, persistFlag, adapter, callback) | This call can be used to check on the performance of the adapter - it checks connectivity, healthcheck and basic get calls. | Yes |
iapRunAdapterHealthcheck(adapter, callback) | This call will return the results of a healthcheck. | Yes |
iapRunAdapterConnectivity(callback) | This call will return the results of a connectivity check. | Yes |
iapRunAdapterBasicGet(callback) | This call will return the results of running basic get API calls. | Yes |
iapMoveAdapterEntitiesToDB(callback) | This call will push the adapter configuration from the entities directory into the Adapter or IAP Database. | Yes |
iapDeactivateTasks(tasks, callback) | This call provides the ability to remove tasks from the adapter. | Yes |
iapActivateTasks(tasks, callback) | This call provides the ability to add deactivated tasks back into the adapter. | Yes |
iapExpandedGenericAdapterRequest(metadata, uriPath, restMethod, pathVars, queryData, requestBody, addlHeaders, callback) | This is an expanded Generic Call. The metadata object allows us to provide many new capabilities within the generic request. | Yes |
genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) | This call allows you to provide the path to have the adapter call. It is an easy way to incorporate paths that have not been built into the adapter yet. | Yes |
genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) | This call is the same as the genericAdapterRequest only it does not add a base_path or version to the call. | Yes |
iapRunAdapterLint(callback) | Runs lint on the addapter and provides the information back. | Yes |
iapRunAdapterTests(callback) | Runs baseunit and unit tests on the adapter and provides the information back. | Yes |
iapGetAdapterInventory(callback) | This call provides some inventory related information about the adapter. | Yes |
Adapter Cache Calls
These are adapter methods that are used for adapter caching. If configured, the adapter will cache based on the interval provided. However, you can force a population of the cache manually as well.
Method Signature | Description | Workflow? |
---|---|---|
iapPopulateEntityCache(entityTypes, callback) | This call populates the adapter cache. | Yes |
iapRetrieveEntitiesCache(entityType, options, callback) | This call retrieves the specific items from the adapter cache. | Yes |
Adapter Broker Calls
These are adapter methods that are used to integrate to IAP Brokers. This adapter currently supports the following broker calls.
Method Signature | Description | Workflow? |
---|---|---|
hasEntities(entityType, entityList, callback) | This call is utilized by the IAP Device Broker to determine if the adapter has a specific entity and item of the entity. | No |
getDevice(deviceName, callback) | This call returns the details of the requested device. | No |
getDevicesFiltered(options, callback) | This call returns the list of devices that match the criteria provided in the options filter. | No |
isAlive(deviceName, callback) | This call returns whether the device status is active | No |
getConfig(deviceName, format, callback) | This call returns the configuration for the selected device. | No |
iapGetDeviceCount(callback) | This call returns the count of devices. | No |
Specific Adapter Calls
Specific adapter calls are built based on the API of the VMware vCenter. The Adapter Builder creates the proper method comments for generating JS-DOC for the adapter. This is the best way to get information on the calls.
Method Signature | Description | Path | Workflow? |
---|---|---|---|
postComvmwarevcenterinventorydatastoreactionfind(callback) | Returns datastore information for the specified datastores. The key in the {@term result} {@term map} is the datastore identifier and the value in the {@term map} is the datastore information. | {base_path}/{version}/com/vmware/vcenter/inventory/datastore?{query} | Yes |
postComvmwarevcenterinventorynetworkactionfind(callback) | Returns network information for the specified vCenter Server networks. The key in the {@term result} {@term map} is the network identifier and the value in the {@term map} is the network information. | {base_path}/{version}/com/vmware/vcenter/inventory/network?{query} | Yes |
postComvmwarevcenterisoimageidlibraryItemactionmount(libraryItem, callback) | Mounts an ISO image from a content library on a virtual machine. | {base_path}/{version}/com/vmware/vcenter/iso/image/id:{pathv1}?{query} | Yes |
postComvmwarevcenterisoimageidvmactionunmount(vm, callback) | Unmounts a previously mounted CD-ROM using an ISO image as a backing. | {base_path}/{version}/com/vmware/vcenter/iso/image/id:{pathv1}?{query} | Yes |
getComvmwarevcenterovfexportFlag(callback) | Returns information about the supported export flags by the server. The supported flags are:
Future server versions might support additional flags. | {base_path}/{version}/com/vmware/vcenter/ovf/export-flag?{query} | Yes |
getComvmwarevcenterovfimportFlag(callback) | Returns information about the import flags supported by the deployment platform. The supported flags are:
Future server versions might support additional flags. | {base_path}/{version}/com/vmware/vcenter/ovf/import-flag?{query} | Yes |
postComvmwarevcenterovflibraryItem(clientTokensourcetargetcreateSpec, callback) | Creates a library item in content library from a virtual machine or virtual appliance. This {@term operation} creates a library item in content library whose content is an OVF package derived from a source virtual machine or virtual appliance, using the supplied create specification. The OVF package may be stored as in a newly created library item or in an in an existing library item. For an existing library item whose content is updated by this {@term operation}, the original content is overwritten. | {base_path}/{version}/com/vmware/vcenter/ovf/library-item?{query} | Yes |
postComvmwarevcenterovflibraryItemidovfLibraryItemIdactiondeploy(ovfLibraryItemId, clientTokentargetdeploymentSpec, callback) | Deploys an OVF package stored in content library to a newly created virtual machine or virtual appliance. This {@term operation} deploys an OVF package which is stored in the library item specified by {@param.name ovfLibraryItemId}. It uses the deployment specification in {@param.name deploymentSpec} to deploy the OVF package to the location specified by {@param.name target}. | {base_path}/{version}/com/vmware/vcenter/ovf/library-item/id:{pathv1}?{query} | Yes |
postComvmwarevcenterovflibraryItemidovfLibraryItemIdactionfilter(ovfLibraryItemId, target, callback) | Queries an OVF package stored in content library to retrieve information to use when deploying the package. See {@link #deploy}. This {@term operation} retrieves information from the descriptor of the OVF package stored in the library item specified by {@param.name ovfLibraryItemId}. The information returned by the {@term operation} can be used to populate the deployment specification (see {@link ResourcePoolDeploymentSpec} when deploying the OVF package to the deployment target specified by {@param.name target}. | {base_path}/{version}/com/vmware/vcenter/ovf/library-item/id:{pathv1}?{query} | Yes |
getVcentercluster(filterfolders, filterclusters, filternames, filterdatacenters, callback) | Returns information about at most 1000 visible (subject to permission checks) clusters in vCenter matching the Cluster.FilterSpec. | {base_path}/{version}/vcenter/cluster?{query} | Yes |
getVcenterclustercluster(cluster, callback) | Retrieves information about the cluster corresponding to cluster. | {base_path}/{version}/vcenter/cluster/{pathv1}?{query} | Yes |
postVcenterdatacenter(spec, callback) | Create a new datacenter in the vCenter inventory | {base_path}/{version}/vcenter/datacenter?{query} | Yes |
getVcenterdatacenter(filterfolders, filterdatacenters, filternames, callback) | Returns information about at most 1000 visible (subject to permission checks) datacenters in vCenter matching the Datacenter.FilterSpec. | {base_path}/{version}/vcenter/datacenter?{query} | Yes |
getVcenterdatacenterdatacenter(datacenter, callback) | Retrieves information about the datacenter corresponding to datacenter. | {base_path}/{version}/vcenter/datacenter/{pathv1}?{query} | Yes |
deleteVcenterdatacenterdatacenter(datacenter, force, callback) | Delete an empty datacenter from the vCenter Server | {base_path}/{version}/vcenter/datacenter/{pathv1}?{query} | Yes |
getVcenterdatastore(filterdatastores, filterfolders, filternames, filtertypes, filterdatacenters, callback) | Returns information about at most 1000 visible (subject to permission checks) datastores in vCenter matching the Datastore.FilterSpec. | {base_path}/{version}/vcenter/datastore?{query} | Yes |
getVcenterdatastoredatastore(datastore, callback) | Retrieves information about the datastore indicated by datastore. | {base_path}/{version}/vcenter/datastore/{pathv1}?{query} | Yes |
getVcenterfolder(filterfolders, filterparentFolders, filtertype, filternames, filterdatacenters, callback) | Returns information about at most 1000 visible (subject to permission checks) folders in vCenter matching the Folder.FilterSpec. | {base_path}/{version}/vcenter/folder?{query} | Yes |
postVcenterhost(spec, callback) | Add a new standalone host in the vCenter inventory. The newly connected host will be in connected state. The vCenter Server will verify the SSL certificate before adding the host to its inventory. In the case where the SSL certificate cannot be verified because the Certificate Authority is not recognized or the certificate is self signed, the vCenter Server will fall back to thumbprint verification mode as defined by Host.CreateSpec.ThumbprintVerification. | {base_path}/{version}/vcenter/host?{query} | Yes |
getVcenterhost(filterfolders, filterstandalone, filterhosts, filternames, filterclusters, filterdatacenters, filterconnectionStates, callback) | Returns information about at most 1000 visible (subject to permission checks) hosts in vCenter matching the Host.FilterSpec. | {base_path}/{version}/vcenter/host?{query} | Yes |
deleteVcenterhosthost(host, callback) | Remove a standalone host from the vCenter Server. | {base_path}/{version}/vcenter/host/{pathv1}?{query} | Yes |
postVcenterhosthostconnect(host, callback) | Connect to the host corresponding to host previously added to the vCenter server. | {base_path}/{version}/vcenter/host/{pathv1}/connect?{query} | Yes |
postVcenterhosthostdisconnect(host, callback) | Disconnect the host corresponding to host from the vCenter server | {base_path}/{version}/vcenter/host/{pathv1}/disconnect?{query} | Yes |
getVcenternetwork(filterfolders, filterdatacenters, filternetworks, filtertypes, filternames, callback) | Returns information about at most 1000 visible (subject to permission checks) networks in vCenter matching the Network.FilterSpec. | {base_path}/{version}/vcenter/network?{query} | Yes |
getVcenterresourcePool(filterparentResourcePools, filterhosts, filternames, filterclusters, filterdatacenters, filterresourcePools, callback) | Returns information about at most 1000 visible (subject to permission checks) resource pools in vCenter matching the ResourcePool.FilterSpec. | {base_path}/{version}/vcenter/resource-pool?{query} | Yes |
getVcenterresourcePoolresourcePool(resourcepool, callback) | Retrieves information about the resource pool indicated by resourcePool. | {base_path}/{version}/vcenter/resource-pool/{pathv1}?{query} | Yes |
postVcentervm(spec, callback) | Creates a virtual machine. | {base_path}/{version}/vcenter/vm?{query} | Yes |
getVcentervm(filterfolders, filterpowerStates, filterhosts, filternames, filterclusters, filterdatacenters, filterresourcePools, filtervms, callback) | Returns information about at most 1000 visible (subject to permission checks) virtual machines in vCenter matching the VM.FilterSpec. | {base_path}/{version}/vcenter/vm?{query} | Yes |
deleteVcentervmvm(vm, callback) | Deletes a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}?{query} | Yes |
getVcentervmvm(vm, callback) | Returns information about a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}?{query} | Yes |
getVcentervmvmhardware(vm, callback) | Returns the virtual hardware settings of a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware?{query} | Yes |
patchVcentervmvmhardware(vm, spec, callback) | Updates the virtual hardware settings of a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware?{query} | Yes |
postVcentervmvmhardwareactionupgrade(vm, version, callback) | Upgrades the virtual machine to a newer virtual hardware version. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/action/upgrade?{query} | Yes |
postVcentervmvmhardwareadaptersata(vm, spec, callback) | Adds a virtual SATA adapter to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/adapter/sata?{query} | Yes |
getVcentervmvmhardwareadaptersata(vm, callback) | Returns commonly used information about the virtual SATA adapters belonging to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/adapter/sata?{query} | Yes |
deleteVcentervmvmhardwareadaptersataadapter(vm, adapter, callback) | Removes a virtual SATA adapter from the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/adapter/sata/{pathv2}?{query} | Yes |
getVcentervmvmhardwareadaptersataadapter(vm, adapter, callback) | Returns information about a virtual SATA adapter. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/adapter/sata/{pathv2}?{query} | Yes |
postVcentervmvmhardwareadapterscsi(vm, spec, callback) | Adds a virtual SCSI adapter to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/adapter/scsi?{query} | Yes |
getVcentervmvmhardwareadapterscsi(vm, callback) | Returns commonly used information about the virtual SCSI adapters belonging to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/adapter/scsi?{query} | Yes |
getVcentervmvmhardwareadapterscsiadapter(vm, adapter, callback) | Returns information about a virtual SCSI adapter. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/adapter/scsi/{pathv2}?{query} | Yes |
patchVcentervmvmhardwareadapterscsiadapter(vm, adapter, spec, callback) | Updates the configuration of a virtual SCSI adapter. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/adapter/scsi/{pathv2}?{query} | Yes |
deleteVcentervmvmhardwareadapterscsiadapter(vm, adapter, callback) | Removes a virtual SCSI adapter from the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/adapter/scsi/{pathv2}?{query} | Yes |
getVcentervmvmhardwareboot(vm, callback) | Returns the boot-related settings of a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/boot?{query} | Yes |
patchVcentervmvmhardwareboot(vm, spec, callback) | Updates the boot-related settings of a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/boot?{query} | Yes |
putVcentervmvmhardwarebootdevice(vm, devices, callback) | Sets the virtual devices that will be used to boot the virtual machine. The virtual machine will check the devices in order, attempting to boot from each, until the virtual machine boots successfully. If the list is empty, the virtual machine will use a default boot sequence. There should be no more than one instance of Device.Entry for a given device type except ETHERNET in the list. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/boot/device?{query} | Yes |
getVcentervmvmhardwarebootdevice(vm, callback) | Returns an ordered list of boot devices for the virtual machine. If the list is empty, the virtual machine uses a default boot sequence. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/boot/device?{query} | Yes |
postVcentervmvmhardwarecdrom(vm, spec, callback) | Adds a virtual CD-ROM device to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/cdrom?{query} | Yes |
getVcentervmvmhardwarecdrom(vm, callback) | Returns commonly used information about the virtual CD-ROM devices belonging to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/cdrom?{query} | Yes |
patchVcentervmvmhardwarecdromcdrom(vm, cdrom, spec, callback) | Updates the configuration of a virtual CD-ROM device. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/cdrom/{pathv2}?{query} | Yes |
getVcentervmvmhardwarecdromcdrom(vm, cdrom, callback) | Returns information about a virtual CD-ROM device. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/cdrom/{pathv2}?{query} | Yes |
deleteVcentervmvmhardwarecdromcdrom(vm, cdrom, callback) | Removes a virtual CD-ROM device from the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/cdrom/{pathv2}?{query} | Yes |
postVcentervmvmhardwarecdromcdromconnect(vm, cdrom, callback) | Connects a virtual CD-ROM device of a powered-on virtual machine to its backing. Connecting the virtual device makes the backing accessible from the perspective of the guest operating system. For a powered-off virtual machine, the Cdrom.update operation may be used to configure the virtual CD-ROM device to start in the connected state when the virtual machine is powered on. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/cdrom/{pathv2}/connect?{query} | Yes |
postVcentervmvmhardwarecdromcdromdisconnect(vm, cdrom, callback) | Disconnects a virtual CD-ROM device of a powered-on virtual machine from its backing. The virtual device is still present and its backing configuration is unchanged, but from the perspective of the guest operating system, the CD-ROM device is not connected to its backing resource. For a powered-off virtual machine, the Cdrom.update operation may be used to configure the virtual CD-ROM device to start in the disconnected state when the virtual machine is powered on. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/cdrom/{pathv2}/disconnect?{query} | Yes |
getVcentervmvmhardwarecpu(vm, callback) | Returns the CPU-related settings of a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/cpu?{query} | Yes |
patchVcentervmvmhardwarecpu(vm, spec, callback) | Updates the CPU-related settings of a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/cpu?{query} | Yes |
postVcentervmvmhardwaredisk(vm, spec, callback) | Adds a virtual disk to the virtual machine. While adding the virtual disk, a new VMDK file may be created or an existing VMDK file may be used to back the virtual disk. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/disk?{query} | Yes |
getVcentervmvmhardwaredisk(vm, callback) | Returns commonly used information about the virtual disks belonging to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/disk?{query} | Yes |
getVcentervmvmhardwarediskdisk(vm, disk, callback) | Returns information about a virtual disk. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/disk/{pathv2}?{query} | Yes |
deleteVcentervmvmhardwarediskdisk(vm, disk, callback) | Removes a virtual disk from the virtual machine. This operation does not destroy the VMDK file that backs the virtual disk. It only detaches the VMDK file from the virtual machine. Once detached, the VMDK file will not be destroyed when the virtual machine to which it was associated is deleted. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/disk/{pathv2}?{query} | Yes |
patchVcentervmvmhardwarediskdisk(vm, disk, spec, callback) | Updates the configuration of a virtual disk. An update operation can be used to detach the existing VMDK file and attach another VMDK file to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/disk/{pathv2}?{query} | Yes |
postVcentervmvmhardwareethernet(vm, spec, callback) | Adds a virtual Ethernet adapter to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/ethernet?{query} | Yes |
getVcentervmvmhardwareethernet(vm, callback) | Returns commonly used information about the virtual Ethernet adapters belonging to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/ethernet?{query} | Yes |
patchVcentervmvmhardwareethernetnic(vm, nic, spec, callback) | Updates the configuration of a virtual Ethernet adapter. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/ethernet/{pathv2}?{query} | Yes |
getVcentervmvmhardwareethernetnic(vm, nic, callback) | Returns information about a virtual Ethernet adapter. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/ethernet/{pathv2}?{query} | Yes |
deleteVcentervmvmhardwareethernetnic(vm, nic, callback) | Removes a virtual Ethernet adapter from the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/ethernet/{pathv2}?{query} | Yes |
postVcentervmvmhardwareethernetnicconnect(vm, nic, callback) | Connects a virtual Ethernet adapter of a powered-on virtual machine to its backing. Connecting the virtual device makes the backing accessible from the perspective of the guest operating system. For a powered-off virtual machine, the Ethernet.update operation may be used to configure the virtual Ethernet adapter to start in the connected state when the virtual machine is powered on. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/ethernet/{pathv2}/connect?{query} | Yes |
postVcentervmvmhardwareethernetnicdisconnect(vm, nic, callback) | Disconnects a virtual Ethernet adapter of a powered-on virtual machine from its backing. The virtual device is still present and its backing configuration is unchanged, but from the perspective of the guest operating system, the Ethernet adapter is not connected to its backing resource. For a powered-off virtual machine, the Ethernet.update operation may be used to configure the virtual Ethernet adapter to start in the disconnected state when the virtual machine is powered on. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/ethernet/{pathv2}/disconnect?{query} | Yes |
postVcentervmvmhardwarefloppy(vm, spec, callback) | Adds a virtual floppy drive to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/floppy?{query} | Yes |
getVcentervmvmhardwarefloppy(vm, callback) | Returns commonly used information about the virtual floppy drives belonging to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/floppy?{query} | Yes |
deleteVcentervmvmhardwarefloppyfloppy(vm, floppy, callback) | Removes a virtual floppy drive from the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/floppy/{pathv2}?{query} | Yes |
patchVcentervmvmhardwarefloppyfloppy(vm, floppy, spec, callback) | Updates the configuration of a virtual floppy drive. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/floppy/{pathv2}?{query} | Yes |
getVcentervmvmhardwarefloppyfloppy(vm, floppy, callback) | Returns information about a virtual floppy drive. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/floppy/{pathv2}?{query} | Yes |
postVcentervmvmhardwarefloppyfloppyconnect(vm, floppy, callback) | Connects a virtual floppy drive of a powered-on virtual machine to its backing. Connecting the virtual device makes the backing accessible from the perspective of the guest operating system. For a powered-off virtual machine, the Floppy.update operation may be used to configure the virtual floppy drive to start in the connected state when the virtual machine is powered on. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/floppy/{pathv2}/connect?{query} | Yes |
postVcentervmvmhardwarefloppyfloppydisconnect(vm, floppy, callback) | Disconnects a virtual floppy drive of a powered-on virtual machine from its backing. The virtual device is still present and its backing configuration is unchanged, but from the perspective of the guest operating system, the floppy drive is not connected to its backing resource. For a powered-off virtual machine, the Floppy.update operation may be used to configure the virtual floppy floppy to start in the disconnected state when the virtual machine is powered on. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/floppy/{pathv2}/disconnect?{query} | Yes |
patchVcentervmvmhardwarememory(vm, spec, callback) | Updates the memory-related settings of a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/memory?{query} | Yes |
getVcentervmvmhardwarememory(vm, callback) | Returns the memory-related settings of a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/memory?{query} | Yes |
postVcentervmvmhardwareparallel(vm, spec, callback) | Adds a virtual parallel port to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/parallel?{query} | Yes |
getVcentervmvmhardwareparallel(vm, callback) | Returns commonly used information about the virtual parallel ports belonging to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/parallel?{query} | Yes |
deleteVcentervmvmhardwareparallelport(vm, port, callback) | Removes a virtual parallel port from the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/parallel/{pathv2}?{query} | Yes |
patchVcentervmvmhardwareparallelport(vm, port, spec, callback) | Updates the configuration of a virtual parallel port. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/parallel/{pathv2}?{query} | Yes |
getVcentervmvmhardwareparallelport(vm, port, callback) | Returns information about a virtual parallel port. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/parallel/{pathv2}?{query} | Yes |
postVcentervmvmhardwareparallelportconnect(vm, port, callback) | Connects a virtual parallel port of a powered-on virtual machine to its backing. Connecting the virtual device makes the backing accessible from the perspective of the guest operating system. For a powered-off virtual machine, the Parallel.update operation may be used to configure the virtual parallel port to start in the connected state when the virtual machine is powered on. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/parallel/{pathv2}/connect?{query} | Yes |
postVcentervmvmhardwareparallelportdisconnect(vm, port, callback) | Disconnects a virtual parallel port of a powered-on virtual machine from its backing. The virtual device is still present and its backing configuration is unchanged, but from the perspective of the guest operating system, the parallel port is not connected to its backing. For a powered-off virtual machine, the Parallel.update operation may be used to configure the virtual parallel port to start in the disconnected state when the virtual machine is powered on. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/parallel/{pathv2}/disconnect?{query} | Yes |
postVcentervmvmhardwareserial(vm, spec, callback) | Adds a virtual serial port to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/serial?{query} | Yes |
getVcentervmvmhardwareserial(vm, callback) | Returns commonly used information about the virtual serial ports belonging to the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/serial?{query} | Yes |
patchVcentervmvmhardwareserialport(vm, port, spec, callback) | Updates the configuration of a virtual serial port. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/serial/{pathv2}?{query} | Yes |
getVcentervmvmhardwareserialport(vm, port, callback) | Returns information about a virtual serial port. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/serial/{pathv2}?{query} | Yes |
deleteVcentervmvmhardwareserialport(vm, port, callback) | Removes a virtual serial port from the virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/serial/{pathv2}?{query} | Yes |
postVcentervmvmhardwareserialportconnect(vm, port, callback) | Connects a virtual serial port of a powered-on virtual machine to its backing. Connecting the virtual device makes the backing accessible from the perspective of the guest operating system. For a powered-off virtual machine, the Serial.update operation may be used to configure the virtual serial port to start in the connected state when the virtual machine is powered on. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/serial/{pathv2}/connect?{query} | Yes |
postVcentervmvmhardwareserialportdisconnect(vm, port, callback) | Disconnects a virtual serial port of a powered-on virtual machine from its backing. The virtual device is still present and its backing configuration is unchanged, but from the perspective of the guest operating system, the serial port is not connected to its backing. For a powered-off virtual machine, the Serial.update operation may be used to configure the virtual serial port to start in the disconnected state when the virtual machine is powered on. | {base_path}/{version}/vcenter/vm/{pathv1}/hardware/serial/{pathv2}/disconnect?{query} | Yes |
getVcentervmvmpower(vm, callback) | Returns the power state information of a virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/power?{query} | Yes |
postVcentervmvmpowerreset(vm, callback) | Resets a powered-on virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/power/reset?{query} | Yes |
postVcentervmvmpowerstart(vm, callback) | Powers on a powered-off or suspended virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/power/start?{query} | Yes |
postVcentervmvmpowerstop(vm, callback) | Powers off a powered-on or suspended virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/power/stop?{query} | Yes |
postVcentervmvmpowersuspend(vm, callback) | Suspends a powered-on virtual machine. | {base_path}/{version}/vcenter/vm/{pathv1}/power/suspend?{query} | Yes |
postVcentervmtemplatedeploy(item, requestBody, callback) | Creates a Virtual Machine from the template | {base_path}/{version}/vcenter/vm-template/library-items/{pathv1}?{query} | Yes |
Authentication
This document will go through the steps for authenticating the VMware vCenter adapter with Dynamic Token Authentication. Properly configuring the properties for an adapter in IAP is critical for getting the adapter online. You can read more about adapter authentication HERE.
Dynamic Token Authentication
The VMware vCenter adapter requires Dynamic Token Authentication. If you change authentication methods, you should change this section accordingly and merge it back into the adapter repository.
STEPS
- Ensure you have access to a VMware vCenter server and that it is running
- Follow the steps in the README.md to import the adapter into IAP if you have not already done so
- Use the properties below for the
properties.authentication
field"authentication": { "auth_method": "request_token", "username": "<username>", "password": "<password>", "token_timeout": 180000, "token_cache": "local", "invalid_token_error": 401, "auth_field": "header.headers.Cookie", "auth_field_format": "vmware-api-session-id={token}" }
you can leave all of the other properties in the authentication section, they will not be used for VMware vCenter dynamic token authentication.
- Restart the adapter. If your properties were set correctly, the adapter should go online.
Troubleshooting
- Make sure you copied over the correct username and password.
- Turn on debug level logs for the adapter in IAP Admin Essentials.
- Turn on auth_logging for the adapter in IAP Admin Essentials (adapter properties).
- Investigate the logs - in particular:
- The FULL REQUEST log to make sure the proper headers are being sent with the request.
- The FULL BODY log to make sure the payload is accurate.
- The CALL RETURN log to see what the other system is telling us.
- Credentials should be masked by the adapter so make sure you verify the username and password - including that there are erroneous spaces at the front or end.
- Remember when you are done to turn auth_logging off as you do not want to log credentials.
Additional Information
Enhancements
Adding a Second Instance of an Adapter
You can add a second instance of this adapter without adding new code on the file system. To do this go into the IAP Admin Essentials and add a new service config for this adapter. The two instances of the adapter should have unique ids. In addition, they should point to different instances (unique host and port) of the other system.
Adding Adapter Calls
There are multiple ways to add calls to an existing adapter.
The easiest way would be to use the Adapter Builder update process. This process takes in a Swagger or OpenAPI document, allows you to select the calls you want to add and then generates a zip file that can be used to update the adapter. Once you have the zip file simply put it in the adapter directory and execute npm run adapter:update
.
mv updatePackage.zip adapter-vmware_vcenter
cd adapter-vmware_vcenter
npm run adapter:update
If you do not have a Swagger or OpenAPI document, you can use a Postman Collection and convert that to an OpenAPI document using APIMatic and then follow the first process.
If you want to manually update the adapter that can also be done the key thing is to make sure you update all of the right files. Within the entities directory you will find 1 or more entities. You can create a new entity or add to an existing entity. Each entity has an action.json file, any new call will need to be put in the action.json file. It will also need to be added to the enum for the ph_request_type in the appropriate schema files. Once this configuration is complete you will need to add the call to the adapter.js file and, in order to make it available as a workflow task in IAP, it should also be added to the pronghorn.json file. You can optionally add it to the unit and integration test files. There is more information on how to work on each of these files in the Adapter Technical Resources on our Documentation Site.
Files to update
* entities/<entity>/action.json: add an action
* entities/<entity>/schema.json (or the schema defined on the action): add action to the enum for ph_request_type
* adapter.js: add the new method and make sure it calls the proper entity and action
* pronghorn.json: add the new method
* test/unit/adapterTestUnit.js (optional but best practice): add unit test(s) - function is there, any required parameters error when not passed in
* test/integration/adapterTestIntegration.js (optional but best practice): add integration test
Adding Adapter Properties
While changing adapter properties is done in the service instance configuration section of IAP, adding properties has to be done in the adapter. To add a property you should edit the propertiesSchema.json with the proper information for the property. In addition, you should modify the sampleProperties to have the new property in it.
Files to update
* propertiesSchema.json: add the new property and how it is defined
* sampleProperties: add the new property with a default value
* test/unit/adapterTestUnit.js (optional but best practice): add the property to the global properties
* test/integration/adapterTestIntegration.js (optional but best practice): add the property to the global properties
Changing Adapter Authentication
Often an adapter is built before knowing the authentication and authentication processes can also change over time. The adapter supports many different kinds of authentication but it does require configuration. Some forms of authentication can be defined entirely with the adapter properties but others require configuration.
Files to update
* entities/.system/action.json: change the getToken action as needed
* entities/.system/schemaTokenReq.json: add input parameters (external name is name in other system)
* entities/.system/schemaTokenResp.json: add response parameters (external name is name in other system)
* propertiesSchema.json: add any new property and how it is defined
* sampleProperties: add any new property with a default value
* test/unit/adapterTestUnit.js (optional but best practice): add the property to the global properties
* test/integration/adapterTestIntegration.js (optional but best practice): add the property to the global properties
Enhancing Adapter Integration Tests
The adapter integration tests are written to be able to test in either stub (standalone) mode or integrated to the other system. However, if integrating to the other system, you may need to provide better data than what the adapter provides by default as that data is likely to fail for create and update. To provide better data, edit the adapter integration test file. Make sure you do not remove the marker and keep custom code below the marker so you do not impact future migrations. Once the edits are complete, run the integration test as it instructs you to above. When you run integrated to the other system, you can also save mockdata for future use by changing the isSaveMockData flag to true.
Files to update
* test/integration/adapterTestIntegration.js: add better data for the create and update calls so that they will not fail.
As mentioned previously, for most of these changes as well as other possible changes, there is more information on how to work on an adapter in the Adapter Technical Resources on our Documentation Site.
Contributing
First off, thanks for taking the time to contribute!
The following is a set of rules for contributing.
Code of Conduct
This project and everyone participating in it is governed by the Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to support@itential.com.
How to Contribute
Follow the contributing guide (here)[https://gitlab.com/itentialopensource/adapters/contributing-guide]
Helpful Links
Node Scripts
There are several node scripts that now accompany the adapter. These scripts are provided to make several activities easier. Many of these scripts can have issues with different versions of IAP as they have dependencies on IAP and Mongo. If you have issues with the scripts please report them to the Itential Adapter Team. Each of these scripts are described below.
Run | Description |
---|---|
npm run adapter:install | Provides an easier way to install the adapter. |
npm run adapter:checkMigrate | Checks whether your adapter can and should be migrated to the latest foundation. |
npm run adapter:findPath | Can be used to see if the adapter supports a particular API call. |
npm run adapter:migrate | Provides an easier way to update your adapter after you download the migration zip from Itential DevSite. |
npm run adapter:update | Provides an easier way to update your adapter after you download the update zip from Itential DevSite. |
npm run adapter:revert | Allows you to revert after a migration or update if it resulted in issues. |
npm run troubleshoot | Provides a way to troubleshoot the adapter - runs connectivity, healthcheck and basic get. |
npm run connectivity | Provides a connectivity check to the Servicenow system. |
npm run healthcheck | Checks whether the configured healthcheck call works to Servicenow. |
npm run basicget | Checks whether the basic get calls works to Servicenow. |
Troubleshoot
Run npm run troubleshoot
to start the interactive troubleshooting process. The command allows you to verify and update connection, authentication as well as healthcheck configuration. After that it will test these properties by sending HTTP request to the endpoint. If the tests pass, it will persist these changes into IAP.
You also have the option to run individual commands to perform specific test:
npm run healthcheck
will perform a healthcheck request of with current setting.npm run basicget
will perform some non-parameter GET request with current setting.npm run connectivity
will perform networking diagnostics of the adatper endpoint.
Connectivity Issues
- You can run the adapter troubleshooting script which will check connectivity, run the healthcheck and run basic get calls.
npm run troubleshoot
- Verify the adapter properties are set up correctly.
Go into the Itential Platform GUI and verify/update the properties
- Verify there is connectivity between the Itential Platform Server and Vmware_vCenter Server.
ping the ip address of Vmware_vCenter server
try telnet to the ip address port of Vmware_vCenter
execute a curl command to the other system
- Verify the credentials provided for Vmware_vCenter.
login to Vmware_vCenter using the provided credentials
- Verify the API of the call utilized for Vmware_vCenter Healthcheck.
Go into the Itential Platform GUI and verify/update the properties
Functional Issues
Adapter logs are located in /var/log/pronghorn
. In older releases of the Itential Platform, there is a pronghorn.log
file which contains logs for all of the Itential Platform. In newer versions, adapters can be configured to log into their own files.