@itentialopensource/adapter-vmware_vcenter 0.5.3 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.eslintignore +1 -0
  2. package/.eslintrc.js +12 -12
  3. package/CHANGELOG.md +32 -0
  4. package/README.md +209 -29
  5. package/adapter.js +1476 -34
  6. package/adapterBase.js +289 -11
  7. package/entities/.generic/action.json +109 -0
  8. package/entities/.generic/schema.json +23 -0
  9. package/entities/.system/action.json +3 -3
  10. package/entities/.system/schemaTokenReq.json +2 -2
  11. package/entities/Vmtemplatelibraryitems/action.json +25 -0
  12. package/entities/Vmtemplatelibraryitems/schema.json +19 -0
  13. package/error.json +6 -0
  14. package/package.json +42 -21
  15. package/pronghorn.json +614 -0
  16. package/propertiesSchema.json +56 -9
  17. package/refs?service=git-upload-pack +0 -0
  18. package/report/updateReport1594310791028.json +95 -0
  19. package/report/updateReport1615860501665.json +95 -0
  20. package/report/updateReport1643047821981.json +95 -0
  21. package/sampleProperties.json +20 -5
  22. package/test/integration/adapterTestBasicGet.js +85 -0
  23. package/test/integration/adapterTestConnectivity.js +93 -0
  24. package/test/integration/adapterTestIntegration.js +59 -6
  25. package/test/unit/adapterBaseTestUnit.js +944 -0
  26. package/test/unit/adapterTestUnit.js +683 -10
  27. package/utils/addAuth.js +94 -0
  28. package/utils/basicGet.js +50 -0
  29. package/utils/checkMigrate.js +63 -0
  30. package/utils/entitiesToDB.js +224 -0
  31. package/utils/findPath.js +74 -0
  32. package/utils/modify.js +154 -0
  33. package/utils/packModificationScript.js +1 -1
  34. package/utils/patches2bundledDeps.js +90 -0
  35. package/utils/removeHooks.js +20 -0
  36. package/utils/tbScript.js +169 -0
  37. package/utils/tbUtils.js +451 -0
  38. package/utils/troubleshootingAdapter.js +190 -0
package/.eslintignore CHANGED
@@ -2,3 +2,4 @@
2
2
  backup/*
3
3
  coverage/*
4
4
  out/*
5
+ adapter_modifications/*
package/.eslintrc.js CHANGED
@@ -1,18 +1,18 @@
1
1
  module.exports = {
2
- 'env': {
3
- 'browser': true,
4
- 'es6': true,
5
- 'node': true,
2
+ env: {
3
+ browser: true,
4
+ es6: true,
5
+ node: true
6
6
  },
7
- 'extends': 'airbnb-base',
8
- "plugins": [
9
- "json"
7
+ extends: 'airbnb-base',
8
+ plugins: [
9
+ 'json'
10
10
  ],
11
- 'parserOptions': {
12
- 'sourceType': 'module',
11
+ parserOptions: {
12
+ sourceType: 'module'
13
13
  },
14
14
  rules: {
15
15
  'max-len': 'warn',
16
- 'comma-dangle': ['error', 'never'],
17
- },
18
- };
16
+ 'comma-dangle': ['error', 'never']
17
+ }
18
+ };
package/CHANGELOG.md CHANGED
@@ -1,4 +1,36 @@
1
1
 
2
+ ## 0.7.0 [01-24-2022]
3
+
4
+ * migration to the latest foundation and broker ready
5
+
6
+ See merge request itentialopensource/adapters/cloud/adapter-vmware_vcenter!15
7
+
8
+ ---
9
+
10
+ ## 0.6.0 [08-02-2021]
11
+
12
+ * Add call
13
+
14
+ See merge request itentialopensource/adapters/cloud/adapter-vmware_vcenter!14
15
+
16
+ ---
17
+
18
+ ## 0.5.5 [03-16-2021]
19
+
20
+ * migration to the latest adapter foundation
21
+
22
+ See merge request itentialopensource/adapters/cloud/adapter-vmware_vcenter!12
23
+
24
+ ---
25
+
26
+ ## 0.5.4 [07-09-2020]
27
+
28
+ * migration
29
+
30
+ See merge request itentialopensource/adapters/cloud/adapter-vmware_vcenter!11
31
+
32
+ ---
33
+
2
34
  ## 0.5.3 [06-25-2020]
3
35
 
4
36
  * changes to filters
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Vmware_vCenter Adapter
1
+ # Adapter for Vmware_vCenter
2
2
 
3
3
  This adapter is used to integrate the Itential Automation Platform (IAP) with the Vmware_vCenter System. The API for Vmware_vCenter is available at [undefined API URL]. The adapter utilizes the Vmware_vCenter API to provide the integrations that are deemed pertinent to IAP. This ReadMe file is intended to provide information on this adapter.
4
4
 
@@ -22,6 +22,24 @@ Release notes can be viewed in CHANGELOG.md or in the [Customer Knowledge Base](
22
22
 
23
23
  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.
24
24
 
25
+ ### Adapter Technical Resources
26
+
27
+ There is adapter documentation available on the Itential Developer Site [HERE](https://developer.itential.io/adapters-resources/). This documentation includes information and examples that are helpful for:
28
+
29
+ ```text
30
+ Authentication
31
+ Properties
32
+ Code Files
33
+ Action Files
34
+ Schema Files
35
+ Mock Data Files
36
+ Linting and Testing
37
+ Troubleshooting
38
+ ```
39
+
40
+ Others will be added over time.
41
+ Want to build a new adapter? Use the Adapter Builder [HERE](https://adapters.itential.io)
42
+
25
43
  ### Environment Prerequisites
26
44
 
27
45
  The following is a list of required packages for an adapter.
@@ -40,8 +58,14 @@ The following list of packages are required for Itential product adapters or cus
40
58
  | ------- | ------- |
41
59
  | @itentialopensource/adapter-utils | Runtime library classes for all adapters; includes request handling, connection, throttling, and translation. |
42
60
  | ajv | Required for validation of adapter properties to integrate with Vmware_vCenter. |
61
+ | axios | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
62
+ | commander | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
43
63
  | fs-extra | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
44
- | readline-sync | Utilized by the testRunner script that comes with the adapter; helps to test unit and integration functionality. |
64
+ | network-diagnostics | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
65
+ | readline-sync | Utilized by the node script that comes with the adapter; helps to test unit and integration functionality. |
66
+ | semver | Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality. |
67
+
68
+ Some of the adapter node scripts run testing scripts which require the dev dependencies listed below.
45
69
 
46
70
  ### Additional Prerequisites for Development and Testing
47
71
 
@@ -54,7 +78,9 @@ eslint-config-airbnb-base
54
78
  eslint-plugin-import
55
79
  eslint-plugin-json
56
80
  mocha
81
+ mocha-param
57
82
  nyc
83
+ package-json-validator
58
84
  testdouble
59
85
  winston
60
86
  ```
@@ -81,6 +107,7 @@ This section defines **all** the properties that are available for the adapter,
81
107
  "base_path": "/",
82
108
  "version": "v1",
83
109
  "cache_location": "local",
110
+ "encode_pathvars": true,
84
111
  "save_metric": true,
85
112
  "stub": false,
86
113
  "protocol": "https",
@@ -88,16 +115,18 @@ This section defines **all** the properties that are available for the adapter,
88
115
  "auth_method": "basic user_password",
89
116
  "username": "username",
90
117
  "password": "password",
91
- "auth_field": "header.headers.X-AUTH-TOKEN",
92
- "auth_field_format": "{token}",
93
118
  "token": "token",
94
119
  "invalid_token_error": 401,
95
120
  "token_timeout": 0,
96
- "token_cache": "local"
121
+ "token_cache": "local",
122
+ "auth_field": "header.headers.X-AUTH-TOKEN",
123
+ "auth_field_format": "{token}",
124
+ "auth_logging": false
97
125
  },
98
126
  "healthcheck": {
99
127
  "type": "startup",
100
- "frequency": 300000
128
+ "frequency": 300000,
129
+ "query_object": {}
101
130
  },
102
131
  "request": {
103
132
  "number_redirects": 0,
@@ -113,7 +142,8 @@ This section defines **all** the properties that are available for the adapter,
113
142
  },
114
143
  "healthcheck_on_timeout": false,
115
144
  "return_raw": false,
116
- "archiving": false
145
+ "archiving": false,
146
+ "return_request": false
117
147
  },
118
148
  "ssl": {
119
149
  "ecdhCurve": "",
@@ -132,13 +162,16 @@ This section defines **all** the properties that are available for the adapter,
132
162
  "max_in_queue": 1000,
133
163
  "concurrent_max": 1,
134
164
  "expire_timeout": 0,
135
- "avg_runtime": 200
165
+ "avg_runtime": 200,
166
+ "priorities": []
136
167
  },
137
168
  "proxy": {
138
169
  "enabled": false,
139
170
  "host": "localhost",
140
171
  "port": 9999,
141
- "protocol": "http"
172
+ "protocol": "http",
173
+ "username": "",
174
+ "password": "",
142
175
  },
143
176
  "mongo": {
144
177
  "host": "",
@@ -171,6 +204,7 @@ These base properties are used to connect to Vmware_vCenter upon the adapter ini
171
204
  | 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 ``.|
172
205
  | 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 ``.|
173
206
  | 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.|
207
+ | 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 b e used to stop that behavior.|
174
208
  | 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.|
175
209
  | 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).|
176
210
  | protocol | Optional. Notifies the adapter whether to use HTTP or HTTPS. Default is HTTP.|
@@ -188,12 +222,13 @@ The following properties are used to define the authentication process to Vmware
188
222
  | 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`.|
189
223
  | username | Used to authenticate with Vmware_vCenter on every request or when pulling a token that will be used in subsequent requests.|
190
224
  | password | Used to authenticate with Vmware_vCenter on every request or when pulling a token that will be used in subsequent requests.|
191
- | 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.|
192
- | 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. |
193
225
  | token | Defines a static token that can be used on all requests. Only used with `static_token` as an authentication method (auth\_method).|
194
226
  | 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.|
195
227
  | 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.|
196
228
  | token\_cache | Used to determine where the token should be stored (local memory or in Redis).|
229
+ | 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.|
230
+ | 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. |
231
+ | 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. |
197
232
 
198
233
  #### Examples of authentication field format
199
234
 
@@ -216,6 +251,7 @@ The healthcheck properties defines the API that runs the healthcheck to tell the
216
251
  | ------- | ------- |
217
252
  | type | Required. The type of health check to run. |
218
253
  | frequency | Required if intermittent. Defines how often the health check should run. Measured in milliseconds. Default is 300000.|
254
+ | query_object | Query parameters to be added to the adapter healthcheck call.|
219
255
 
220
256
  ### Request Properties
221
257
 
@@ -236,6 +272,7 @@ The request section defines properties to help handle requests.
236
272
  | 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.|
237
273
  | 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.|
238
274
  | 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.|
275
+ | 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.|
239
276
 
240
277
  ### SSL Properties
241
278
 
@@ -265,6 +302,7 @@ The throttle section is used when requests to Vmware_vCenter must be queued (thr
265
302
  | 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. |
266
303
  | 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).|
267
304
  | 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.|
305
+ | 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 }|
268
306
 
269
307
  ### Proxy Properties
270
308
 
@@ -276,6 +314,8 @@ The proxy section defines the properties to utilize when Vmware_vCenter is behin
276
314
  | host | Host information for the proxy server. Required if `enabled` is true.|
277
315
  | port | Port information for the proxy server. Required if `enabled` is true.|
278
316
  | protocol | The protocol (i.e., http, https, etc.) used to connect to the proxy. Default is http.|
317
+ | username | If there is authentication for the proxy, provide the username here.|
318
+ | password | If there is authentication for the proxy, provide the password here.|
279
319
 
280
320
  ### Mongo Properties
281
321
 
@@ -309,6 +349,7 @@ Unit Testing includes testing basic adapter functionality as well as error condi
309
349
  node utils/testRunner --unit
310
350
 
311
351
  npm run test:unit
352
+ npm run test:baseunit
312
353
  ```
313
354
 
314
355
  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.
@@ -344,6 +385,23 @@ Test should also be written to clean up after themselves. However, it is importa
344
385
 
345
386
  > **Reminder**: Do not check in code with actual credentials to systems.
346
387
 
388
+ ## Adapter Node Scripts
389
+
390
+ There are several node scripts that now accompany the adapter. These scripts are provided to make several activities easier. Each of these scripts are described below.
391
+
392
+ | Run | Description |
393
+ | ------- | ------- |
394
+ | npm run adapter:install | Provides an easier way to install the adapter.|
395
+ | npm run adapter:checkMigrate | Checks whether your adapter can and should be migrated to the latest foundation.|
396
+ | npm run adapter:findPath | Can be used to see if the adapter supports a particular API call.|
397
+ | npm run adapter:migrate | Provides an easier way to migrate your adapter after you download the migration zip from Itential DevSite|
398
+ | npm run adapter:update | Provides an easier way to update your adapter after you download the migration zip from Itential DevSite|
399
+ | npm run adapter:revert | Allows you to revert after a migration or update if it resulted in issues.|
400
+ | npm run troubleshoot | Provides a way to troubleshoot the adapter - runs connectivity, healthcheck and basic get.|
401
+ | npm run connectivity | Provides a connectivity check to the Vmware_vCenter system.|
402
+ | npm run healthcheck | Checks whether the configured healthcheck call works to Vmware_vCenter.|
403
+ | npm run basicget | Checks whether the basic get calls works to Vmware_vCenter.|
404
+
347
405
  ## Installing an Itential Product Adapter
348
406
 
349
407
  If you have App-Artifact installed in IAP, you can follow the instruction for that application to install the adapter into IAP. If not, follow these instructions.
@@ -356,24 +414,21 @@ if the @itentialopensource directory does not exist, create it:
356
414
  mkdir @itentialopensource
357
415
  ```
358
416
 
359
- 1. Clone the adapter into your IAP environment.
417
+ 2. Clone the adapter into your IAP environment.
360
418
 
361
419
  ```bash
362
420
  cd \@itentialopensource
363
421
  git clone git@gitlab.com:\@itentialopensource/adapters/adapter-vmware_vcenter
364
422
  ```
365
423
 
366
- 1. Install the dependencies for the adapter.
424
+ 3. Run the adapter install script.
367
425
 
368
426
  ```bash
369
427
  cd adapter-vmware_vcenter
370
- npm install
428
+ npm run adapter:install
371
429
  ```
372
430
 
373
- 1. If you are running IAP 2019.1 or older, add the adapter properties for Vmware_vCenter (created from Adapter Builder) to the `properties.json` file for your Itential build. You will need to change the credentials and possibly the host information below.
374
- [Vmware_vCenter sample properties](sampleProperties.json). If you are running IAP 2019.2 the adapter properties need to go into the database. You can review IAP documentation for how to do this.
375
-
376
- 1. Restart IAP
431
+ 4. Restart IAP
377
432
 
378
433
  ```bash
379
434
  systemctl restart pronghorn
@@ -393,7 +448,7 @@ Depending on where your code is located, this process is different.
393
448
  Adapter should be placed into: /opt/pronghorn/current/node_modules/\@itentialopensource
394
449
  ```
395
450
 
396
- 1. Follow Steps 3-5 (above) to install an Itential adapter to load your properties, dependencies and restart IAP.
451
+ 2. Follow Steps 3-4 (above) to install an Itential adapter to load your properties, dependencies and restart IAP.
397
452
 
398
453
  ## Using this Adapter
399
454
 
@@ -421,11 +476,6 @@ The `encryptProperty` call will take the provided property and technique, and re
421
476
  encryptProperty(property, technique, callback)
422
477
  ```
423
478
 
424
- The `getQueue` call will return the requests that are waiting in the queue if throttling is enabled.
425
- ```js
426
- getQueue(callback)
427
- ```
428
-
429
479
  The `addEntityCache` call will take the entities and add the list to the entity cache to expedite performance.
430
480
  ```js
431
481
  addEntityCache(entityType, entities, key, callback)
@@ -446,39 +496,169 @@ The `verifyCapability` call verifies the adapter can perform the provided action
446
496
  verifyCapability(entityType, actionType, entityId, callback)
447
497
  ```
448
498
 
449
- The `updateEntityCache` call will update the entity cache.
499
+ The `updateEntityCache` call will update the entity cache.
450
500
  ```js
451
501
  updateEntityCache()
452
502
  ```
453
503
 
504
+ The `updateAdapterConfiguration` call provides the ability to update the adapter configuration from IAP - includes actions, schema, mockdata and other configurations.
505
+ ```js
506
+ updateAdapterConfiguration(configFile, changes, entity, type, action, callback)
507
+ ```
508
+
509
+ The `suspend` 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.
510
+ ```js
511
+ suspend(mode, callback)
512
+ ```
513
+
514
+ The `unsuspend` call provides the ability to resume a suspended adapter. Any requests in queue will be processed before new requests.
515
+ ```js
516
+ unsuspend(callback)
517
+ ```
518
+
519
+ The `findPath` call provides the ability to see if a particular API path is supported by the adapter.
520
+ ```js
521
+ findPath(apiPath, callback)
522
+ ```
523
+
524
+ The `troubleshoot` call can be used to check on the performance of the adapter - it checks connectivity, healthcheck and basic get calls.
525
+ ```js
526
+ troubleshoot(props, persistFlag, adapter, callback)
527
+ ```
528
+
529
+ The `runHealthcheck` call will return the results of a healthcheck.
530
+ ```js
531
+ runHealthcheck(adapter, callback)
532
+ ```
533
+
534
+ The `runConnectivity` call will return the results of a connectivity check.
535
+ ```js
536
+ runConnectivity(callback)
537
+ ```
538
+
539
+ The `runBasicGet` call will return the results of running basic get API calls.
540
+ ```js
541
+ runBasicGet(callback)
542
+ ```
543
+
544
+ The `getQueue` call will return the requests that are waiting in the queue if throttling is enabled.
545
+ ```js
546
+ getQueue(callback)
547
+ ```
548
+
454
549
  ### Specific Adapter Calls
455
550
 
456
551
  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.
457
552
 
553
+
554
+ ## Extending/Enhancing the Adapter
555
+
556
+ ### Adding a Second Instance of an Adapter
557
+
558
+ 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 of the other system. For example, they should be configured to talk to different hosts.
559
+
560
+ ### Adding Adapter Calls
561
+
562
+ There are multiple ways to add calls to an existing adapter.
563
+
564
+ 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 simple put it in the adapter direcctory and execute `npm run adapter:update`.
565
+
566
+ ```bash
567
+ mv updatePackage.zip adapter-vmware_vcenter
568
+ cd adapter-vmware_vcenter
569
+ npm run adapter:update
570
+ ```
571
+
572
+ 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.
573
+
574
+ 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 Dev Site [HERE](https://developer.itential.io/adapters-resources/)
575
+
576
+ ```text
577
+ Files to update
578
+ * entities/<entity>/action.json: add an action
579
+ * entities/<entity>/schema.json (or the schema defined on the action): add action to the enum for ph_request_type
580
+ * adapter.js: add the new method and make sure it calls the proper entity and action
581
+ * pronghorn.json: add the new method
582
+ * test/unit/adapterTestUnit.js (optional but best practice): add unit test(s) - function is there, any required parameters error when not passed in
583
+ * test/integration/adapterTestIntegration.js (optional but best practice): add integration test
584
+ ```
585
+
586
+ ### Adding Adapter Properties
587
+
588
+ 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.
589
+
590
+ ```text
591
+ Files to update
592
+ * propertiesSchema.json: add the new property and how it is defined
593
+ * sampleProperties: add the new property with a default value
594
+ * test/unit/adapterTestUnit.js (optional but best practice): add the property to the global properties
595
+ * test/integration/adapterTestIntegration.js (optional but best practice): add the property to the global properties
596
+ ```
597
+
598
+ ### Changing Adapter Authentication
599
+
600
+ Often an adapter is built before knowing the authentication and authentication process 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.
601
+
602
+ ```text
603
+ Files to update
604
+ * entities/<entity>/action.json: change the getToken action as needed
605
+ * entities/<entity>/schemaTokenReq.json: add input parameters (external name is name in other system)
606
+ * entities/<entity>/schemaTokenResp.json: add response parameters (external name is name in other system)
607
+ * propertiesSchema.json: add any new property and how it is defined
608
+ * sampleProperties: add any new property with a default value
609
+ * test/unit/adapterTestUnit.js (optional but best practice): add the property to the global properties
610
+ * test/integration/adapterTestIntegration.js (optional but best practice): add the property to the global properties
611
+ ```
612
+
613
+ ### Enhancing Adapter Integration Tests
614
+
615
+ 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.
616
+
617
+ ```text
618
+ Files to update
619
+ * test/integration/adapterTestIntegration.js: add better data for the create and update calls so that they will not fail.
620
+ ```
621
+
622
+ 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 Dev Site [HERE](https://developer.itential.io/adapters-resources/)
623
+
458
624
  ## Troubleshooting the Adapter
459
625
 
626
+ Run `npm run troubleshoot` to start the interactive troubleshooting process. The command allows user 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.
627
+
628
+ User also have the option to run individual command to perform specific test
629
+
630
+ - `npm run healthcheck` will perform a healthcheck request of with current setting.
631
+ - `npm run basicget` will perform some non-parameter GET request with current setting.
632
+ - `npm run connectivity` will perform networking diagnostics of the adatper endpoint.
633
+
460
634
  ### Connectivity Issues
461
635
 
462
- 1. Verify the adapter properties are set up correctly.
636
+ 1. You can run the adapter troubleshooting script which will check connectivity, run the healthcheck and run basic get calls.
637
+
638
+ ```bash
639
+ npm run troubleshoot
640
+ ```
641
+
642
+ 2. Verify the adapter properties are set up correctly.
463
643
 
464
644
  ```text
465
645
  Go into the Itential Platform GUI and verify/update the properties
466
646
  ```
467
647
 
468
- 1. Verify there is connectivity between the Itential Platform Server and Vmware_vCenter Server.
648
+ 3. Verify there is connectivity between the Itential Platform Server and Vmware_vCenter Server.
469
649
 
470
650
  ```text
471
651
  ping the ip address of Vmware_vCenter server
472
652
  try telnet to the ip address port of Vmware_vCenter
473
653
  ```
474
654
 
475
- 1. Verify the credentials provided for Vmware_vCenter.
655
+ 4. Verify the credentials provided for Vmware_vCenter.
476
656
 
477
657
  ```text
478
658
  login to Vmware_vCenter using the provided credentials
479
659
  ```
480
660
 
481
- 1. Verify the API of the call utilized for Vmware_vCenter Healthcheck.
661
+ 5. Verify the API of the call utilized for Vmware_vCenter Healthcheck.
482
662
 
483
663
  ```text
484
664
  Go into the Itential Platform GUI and verify/update the properties