@itentialopensource/adapter-selector_ai 0.1.1

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 (117) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +19 -0
  3. package/.jshintrc +3 -0
  4. package/AUTH.md +39 -0
  5. package/BROKER.md +211 -0
  6. package/CALLS.md +405 -0
  7. package/CODE_OF_CONDUCT.md +43 -0
  8. package/CONTRIBUTING.md +13 -0
  9. package/ENHANCE.md +69 -0
  10. package/LICENSE +201 -0
  11. package/PROPERTIES.md +661 -0
  12. package/README.md +344 -0
  13. package/SUMMARY.md +9 -0
  14. package/SYSTEMINFO.md +14 -0
  15. package/TAB1.md +8 -0
  16. package/TAB2.md +314 -0
  17. package/TROUBLESHOOT.md +56 -0
  18. package/UTILITIES.md +473 -0
  19. package/adapter.js +4039 -0
  20. package/adapterBase.js +1488 -0
  21. package/entities/.generic/action.json +214 -0
  22. package/entities/.generic/schema.json +28 -0
  23. package/entities/.system/action.json +50 -0
  24. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  25. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  26. package/entities/.system/schema.json +19 -0
  27. package/entities/.system/schemaTokenReq.json +53 -0
  28. package/entities/.system/schemaTokenResp.json +53 -0
  29. package/entities/InventorySchemaCreation/action.json +24 -0
  30. package/entities/InventorySchemaCreation/schema.json +19 -0
  31. package/entities/InventorySchemaDelete/action.json +24 -0
  32. package/entities/InventorySchemaDelete/schema.json +19 -0
  33. package/entities/InventorySchemaDeleteType/action.json +24 -0
  34. package/entities/InventorySchemaDeleteType/schema.json +19 -0
  35. package/entities/InventorySchemaFileDownload/action.json +24 -0
  36. package/entities/InventorySchemaFileDownload/schema.json +19 -0
  37. package/entities/InventorySchemaFileUpload/action.json +24 -0
  38. package/entities/InventorySchemaFileUpload/schema.json +19 -0
  39. package/entities/InventorySchemaUpdate/action.json +24 -0
  40. package/entities/InventorySchemaUpdate/schema.json +19 -0
  41. package/entities/InventoryV2SchemaDeleteAll/action.json +24 -0
  42. package/entities/InventoryV2SchemaDeleteAll/schema.json +19 -0
  43. package/entities/InventoryV2SchemaDeleteType/action.json +24 -0
  44. package/entities/InventoryV2SchemaDeleteType/schema.json +19 -0
  45. package/entities/InventoryV2SchemaUpdate/action.json +24 -0
  46. package/entities/InventoryV2SchemaUpdate/schema.json +19 -0
  47. package/entities/InventoryV2SchemaUpload/action.json +24 -0
  48. package/entities/InventoryV2SchemaUpload/schema.json +19 -0
  49. package/entities/MetastoreInventoryBulkDataUpload/action.json +24 -0
  50. package/entities/MetastoreInventoryBulkDataUpload/schema.json +19 -0
  51. package/entities/MetastoreInventoryCSVDataUpload/action.json +24 -0
  52. package/entities/MetastoreInventoryCSVDataUpload/schema.json +19 -0
  53. package/entities/MetastoreInventoryCsvFileExport/action.json +25 -0
  54. package/entities/MetastoreInventoryCsvFileExport/schema.json +19 -0
  55. package/entities/MetastoreInventoryDataDelete/action.json +24 -0
  56. package/entities/MetastoreInventoryDataDelete/schema.json +19 -0
  57. package/entities/MetastoreInventoryDataDownload/action.json +46 -0
  58. package/entities/MetastoreInventoryDataDownload/schema.json +20 -0
  59. package/entities/MetastoreInventoryDataEdit/action.json +24 -0
  60. package/entities/MetastoreInventoryDataEdit/schema.json +19 -0
  61. package/entities/MetastoreInventoryDataUpload/action.json +24 -0
  62. package/entities/MetastoreInventoryDataUpload/schema.json +19 -0
  63. package/entities/MetastoreInventoryFilesExport/action.json +24 -0
  64. package/entities/MetastoreInventoryFilesExport/schema.json +19 -0
  65. package/entities/MetastoreInventoryFilesImport/action.json +24 -0
  66. package/entities/MetastoreInventoryFilesImport/schema.json +30 -0
  67. package/entities/MetastoreInventoryItems/action.json +25 -0
  68. package/entities/MetastoreInventoryItems/schema.json +19 -0
  69. package/entities/MetastoreInventoryNameDelete/action.json +24 -0
  70. package/entities/MetastoreInventoryNameDelete/schema.json +19 -0
  71. package/entities/MetastoreInventoryNameUpdate/action.json +24 -0
  72. package/entities/MetastoreInventoryNameUpdate/schema.json +19 -0
  73. package/entities/MetastoreInventoryNameUpload/action.json +24 -0
  74. package/entities/MetastoreInventoryNameUpload/schema.json +19 -0
  75. package/entities/MetastoreInventoryNamesDownload/action.json +25 -0
  76. package/entities/MetastoreInventoryNamesDownload/schema.json +19 -0
  77. package/entities/MetastoreInventorySchemaGet/action.json +25 -0
  78. package/entities/MetastoreInventorySchemaGet/schema.json +19 -0
  79. package/entities/MetastoreInventorySystem/action.json +130 -0
  80. package/entities/MetastoreInventorySystem/schema.json +24 -0
  81. package/entities/MetastoreV2InventorySchemaGet/action.json +25 -0
  82. package/entities/MetastoreV2InventorySchemaGet/schema.json +19 -0
  83. package/error.json +190 -0
  84. package/metadata.json +58 -0
  85. package/package.json +77 -0
  86. package/pronghorn.json +2508 -0
  87. package/propertiesDecorators.json +14 -0
  88. package/propertiesSchema.json +1635 -0
  89. package/report/adapterInfo.json +10 -0
  90. package/report/auto-adapter-openapi.json +1330 -0
  91. package/report/creationReport.json +765 -0
  92. package/report/metastore-inventory-manager.yaml-OpenApi3Json.json +2366 -0
  93. package/sampleProperties.json +260 -0
  94. package/test/integration/adapterTestBasicGet.js +117 -0
  95. package/test/integration/adapterTestConnectivity.js +117 -0
  96. package/test/integration/adapterTestIntegration.js +1295 -0
  97. package/test/unit/adapterBaseTestUnit.js +1626 -0
  98. package/test/unit/adapterTestUnit.js +2288 -0
  99. package/utils/adapterInfo.js +156 -0
  100. package/utils/argParser.js +44 -0
  101. package/utils/checkMigrate.js +102 -0
  102. package/utils/entitiesToDB.js +190 -0
  103. package/utils/findPath.js +74 -0
  104. package/utils/logger.js +26 -0
  105. package/utils/methodDocumentor.js +273 -0
  106. package/utils/modify.js +153 -0
  107. package/utils/mongoDbConnection.js +79 -0
  108. package/utils/mongoUtils.js +162 -0
  109. package/utils/pre-commit.sh +32 -0
  110. package/utils/removeHooks.js +20 -0
  111. package/utils/setup.js +33 -0
  112. package/utils/taskMover.js +308 -0
  113. package/utils/tbScript.js +103 -0
  114. package/utils/tbUtils.js +347 -0
  115. package/utils/testRunner.js +298 -0
  116. package/utils/troubleshootingAdapter.js +177 -0
  117. package/utils/updateAdapterConfig.js +158 -0
package/TAB2.md ADDED
@@ -0,0 +1,314 @@
1
+ # Selector_ai
2
+
3
+ ## Table of Contents
4
+
5
+ - [Specific Adapter Information](#specific-adapter-information)
6
+ - [Authentication](#authentication)
7
+ - [Sample Properties](#sample-properties)
8
+ - [Swagger](#swagger)
9
+ - [Generic Adapter Information](#generic-adapter-information)
10
+
11
+ ## Specific Adapter Information
12
+ ### Authentication
13
+
14
+ This document will go through the steps for authenticating the Adapter for Selector AI adapter with OAuth Authentication. Properly configuring the properties for an adapter in IAP is critical for getting the adapter online. You can read more about adapter authentication <a href="https://docs.itential.com/opensource/docs/authentication" target="_blank">HERE</a>.
15
+
16
+ #### OAuth Authentication
17
+ The Adapter for Selector AI adapter requires OAuth Authentication. If you change authentication methods, you should change this section accordingly and merge it back into the adapter repository.
18
+
19
+ STEPS
20
+ 1. Ensure you have access to a Adapter for Selector AI server and that it is running
21
+ 2. Follow the steps in the README.md to import the adapter into IAP if you have not already done so
22
+ 3. Use the properties below for the ```properties.authentication``` field
23
+ ```json
24
+ "authentication": {
25
+ "auth_method": "request_token",
26
+ "username": "username",
27
+ "password": "password",
28
+ "token_timeout": 600000,
29
+ "token_cache": "local",
30
+ "invalid_token_error": 401,
31
+ "auth_field": "header.headers.Authorization",
32
+ "auth_field_format": "Bearer {token}",
33
+ "auth_logging": false,
34
+ "client_id": "client_id",
35
+ "client_secret": "client_secret",
36
+ "grant_type": "",
37
+ "sensitive": [],
38
+ }
39
+ ```
40
+ 4. Restart the adapter. If your properties were set correctly, the adapter should go online.
41
+
42
+ #### Troubleshooting
43
+ - Make sure you copied over the correct username and password.
44
+ - Turn on debug level logs for the adapter in IAP Admin Essentials.
45
+ - Turn on auth_logging for the adapter in IAP Admin Essentials (adapter properties).
46
+ - Investigate the logs - in particular:
47
+ - The FULL REQUEST log to make sure the proper headers are being sent with the request.
48
+ - The FULL BODY log to make sure the payload is accurate.
49
+ - The CALL RETURN log to see what the other system is telling us.
50
+ - Remember when you are done to turn auth_logging off as you do not want to log credentials.
51
+
52
+ ### Sample Properties
53
+
54
+ Sample Properties can be used to help you configure the adapter in the Itential Platform. You will need to update connectivity information such as the host, port, protocol and credentials.
55
+
56
+ ```json
57
+ "properties": {
58
+ "host": "localhost",
59
+ "port": 443,
60
+ "choosepath": "",
61
+ "base_path": "/api",
62
+ "version": "",
63
+ "cache_location": "none",
64
+ "encode_pathvars": true,
65
+ "encode_queryvars": true,
66
+ "save_metric": false,
67
+ "stub": true,
68
+ "protocol": "https",
69
+ "authentication": {
70
+ "auth_method": "request_token",
71
+ "username": "username",
72
+ "password": "password",
73
+ "token": "token",
74
+ "token_timeout": 1800000,
75
+ "token_cache": "local",
76
+ "invalid_token_error": 401,
77
+ "auth_field": "header.headers.Authorization",
78
+ "auth_field_format": "Bearer {token}",
79
+ "auth_logging": false,
80
+ "client_id": "",
81
+ "client_secret": "",
82
+ "grant_type": "",
83
+ "sensitive": [],
84
+ "multiStepAuthCalls": [
85
+ {
86
+ "name": "",
87
+ "requestFields": {},
88
+ "responseFields": {},
89
+ "successfullResponseCode": 200
90
+ }
91
+ ],
92
+ "sso": {
93
+ "protocol": "",
94
+ "host": "",
95
+ "port": 0
96
+ }
97
+ },
98
+ "healthcheck": {
99
+ "type": "startup",
100
+ "frequency": 60000,
101
+ "query_object": {},
102
+ "addlHeaders": {}
103
+ },
104
+ "throttle": {
105
+ "throttle_enabled": false,
106
+ "number_pronghorns": 1,
107
+ "sync_async": "sync",
108
+ "max_in_queue": 1000,
109
+ "concurrent_max": 1,
110
+ "expire_timeout": 0,
111
+ "avg_runtime": 200,
112
+ "priorities": [
113
+ {
114
+ "value": 0,
115
+ "percent": 100
116
+ }
117
+ ]
118
+ },
119
+ "request": {
120
+ "number_redirects": 0,
121
+ "number_retries": 3,
122
+ "limit_retry_error": [
123
+ 0
124
+ ],
125
+ "failover_codes": [],
126
+ "attempt_timeout": 5000,
127
+ "global_request": {
128
+ "payload": {},
129
+ "uriOptions": {},
130
+ "addlHeaders": {},
131
+ "authData": {}
132
+ },
133
+ "healthcheck_on_timeout": true,
134
+ "return_raw": false,
135
+ "archiving": false,
136
+ "return_request": false
137
+ },
138
+ "proxy": {
139
+ "enabled": false,
140
+ "host": "",
141
+ "port": 1,
142
+ "protocol": "http",
143
+ "username": "",
144
+ "password": ""
145
+ },
146
+ "ssl": {
147
+ "ecdhCurve": "",
148
+ "enabled": false,
149
+ "accept_invalid_cert": false,
150
+ "ca_file": "",
151
+ "key_file": "",
152
+ "cert_file": "",
153
+ "secure_protocol": "",
154
+ "ciphers": ""
155
+ },
156
+ "mongo": {
157
+ "url": "",
158
+ "host": "",
159
+ "port": 0,
160
+ "database": "",
161
+ "dbAuth": false,
162
+ "username": "",
163
+ "password": "",
164
+ "replSet": "",
165
+ "addSrv": false,
166
+ "db_ssl": {
167
+ "enabled": false,
168
+ "accept_invalid_cert": false,
169
+ "ca_file": "",
170
+ "key_file": "",
171
+ "cert_file": ""
172
+ }
173
+ },
174
+ "devicebroker": {
175
+ "enabled": false,
176
+ "getDevice": [
177
+ {
178
+ "path": "/get/devices/{id}",
179
+ "method": "GET",
180
+ "query": {},
181
+ "body": {},
182
+ "headers": {},
183
+ "handleFailure": "fail",
184
+ "requestFields": {
185
+ "id": "name"
186
+ },
187
+ "responseDatakey": "",
188
+ "responseFields": {
189
+ "name": "host",
190
+ "ostype": "os",
191
+ "ostypePrefix": "system-",
192
+ "ipaddress": "attributes.ipaddr",
193
+ "port": "443"
194
+ }
195
+ }
196
+ ],
197
+ "getDevicesFiltered": [
198
+ {
199
+ "path": "/get/devices",
200
+ "method": "GET",
201
+ "pagination": {
202
+ "offsetVar": "",
203
+ "limitVar": "",
204
+ "incrementBy": "limit",
205
+ "requestLocation": "query"
206
+ },
207
+ "query": {},
208
+ "body": {},
209
+ "headers": {},
210
+ "handleFailure": "fail",
211
+ "requestFields": {},
212
+ "responseDatakey": "",
213
+ "responseFields": {
214
+ "name": "host",
215
+ "ostype": "os",
216
+ "ostypePrefix": "system-",
217
+ "ipaddress": "attributes.ipaddr",
218
+ "port": "443"
219
+ }
220
+ }
221
+ ],
222
+ "isAlive": [
223
+ {
224
+ "path": "/get/devices/{id}/status",
225
+ "method": "GET",
226
+ "query": {},
227
+ "body": {},
228
+ "headers": {},
229
+ "handleFailure": "fail",
230
+ "requestFields": {
231
+ "id": "name"
232
+ },
233
+ "responseDatakey": "",
234
+ "responseFields": {
235
+ "status": "status",
236
+ "statusValue": "online"
237
+ }
238
+ }
239
+ ],
240
+ "getConfig": [
241
+ {
242
+ "path": "/get/devices/{id}/configPart1",
243
+ "method": "GET",
244
+ "query": {},
245
+ "body": {},
246
+ "headers": {},
247
+ "handleFailure": "fail",
248
+ "requestFields": {
249
+ "id": "name"
250
+ },
251
+ "responseDatakey": "",
252
+ "responseFields": {}
253
+ }
254
+ ],
255
+ "getCount": [
256
+ {
257
+ "path": "/get/devices",
258
+ "method": "GET",
259
+ "query": {},
260
+ "body": {},
261
+ "headers": {},
262
+ "handleFailure": "fail",
263
+ "requestFields": {},
264
+ "responseDatakey": "",
265
+ "responseFields": {}
266
+ }
267
+ ]
268
+ },
269
+ "cache": {
270
+ "enabled": false,
271
+ "entities": [
272
+ {
273
+ "entityType": "",
274
+ "frequency": 1440,
275
+ "flushOnFail": false,
276
+ "limit": 1000,
277
+ "retryAttempts": 5,
278
+ "sort": true,
279
+ "populate": [
280
+ {
281
+ "path": "",
282
+ "method": "GET",
283
+ "pagination": {
284
+ "offsetVar": "",
285
+ "limitVar": "",
286
+ "incrementBy": "limit",
287
+ "requestLocation": "query"
288
+ },
289
+ "query": {},
290
+ "body": {},
291
+ "headers": {},
292
+ "handleFailure": "ignore",
293
+ "requestFields": {},
294
+ "responseDatakey": "",
295
+ "responseFields": {}
296
+ }
297
+ ],
298
+ "cachedTasks": [
299
+ {
300
+ "name": "",
301
+ "filterField": "",
302
+ "filterLoc": ""
303
+ }
304
+ ]
305
+ }
306
+ ]
307
+ }
308
+ }
309
+ ```
310
+ ### Swagger
311
+
312
+ Note: The content for this section may be missing as its corresponding .json file is unavailable. This sections will be updated once adapter-openapi.json file is added.
313
+ ## [Generic Adapter Information](https://gitlab.com/itentialopensource/adapters/adapter-selector_ai/-/blob/master/README.md)
314
+
@@ -0,0 +1,56 @@
1
+ ## Troubleshoot
2
+
3
+ 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 Itential Platform.
4
+
5
+ You also have the option to run individual commands to perform specific test:
6
+
7
+ - `npm run healthcheck` will perform a healthcheck request of with current setting.
8
+ - `npm run basicget` will perform some non-parameter GET request with current setting.
9
+ - `npm run connectivity` will perform networking diagnostics of the adatper endpoint.
10
+
11
+ ### Connectivity Issues
12
+
13
+ 1. You can run the adapter troubleshooting script which will check connectivity, run the healthcheck and run basic get calls.
14
+
15
+ ```bash
16
+ npm run troubleshoot
17
+ ```
18
+
19
+ 2. Verify the adapter properties are set up correctly.
20
+
21
+ ```text
22
+ Go into the Itential Platform GUI and verify/update the properties
23
+ ```
24
+
25
+ 3. Verify there is connectivity between the Itential Platform Server and Selector_ai Server.
26
+
27
+ ```text
28
+ ping the ip address of Selector_ai server
29
+ try telnet to the ip address port of Selector_ai
30
+ execute a curl command to the other system
31
+ ```
32
+
33
+ 4. Verify the credentials provided for Selector_ai.
34
+
35
+ ```text
36
+ login to Selector_ai using the provided credentials
37
+ ```
38
+
39
+ 5. Verify the API of the call utilized for Selector_ai Healthcheck.
40
+
41
+ ```text
42
+ Go into the Itential Platform GUI and verify/update the properties
43
+ ```
44
+
45
+ ### Functional Issues
46
+
47
+ 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.
48
+
49
+ ### Adapter Results
50
+
51
+ The majority of the http response codes from the adapter come directly from the downstream system. There are some exceptions to this:
52
+
53
+ 1. Timeout (-2): There is an attempt timeout property that defines how long the adapter should wait to receive a response before giving up. If that time expires before a resonse is received the adapter will respond with a code of -2. The message will say "The Adapter has run out of time for the request" and it will recommend that you "Increase your adapter request.attempt_timeout property".
54
+ 2. Econnreset (-1): When the downstream system or something within the network drops the connection, the adapter will receive and forward an ECONNRESET error with a -1 code. The message will say "The connection was terminated by the network or external system" and the recommendation will be for you to "Check connectivity to the external system and that the system is up".
55
+
56
+ The adapter will also have various errors if it is unable to build the request. All of these errors come with messages and recommendations to help you understand what you need to do to resolve the issue.