@itentialopensource/adapter-winston_syslog 1.0.1 → 1.1.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 (47) hide show
  1. package/BROKER.md +199 -0
  2. package/CALLS.md +162 -0
  3. package/CHANGELOG.md +8 -1
  4. package/CODE_OF_CONDUCT.md +43 -0
  5. package/CONTRIBUTING.md +13 -0
  6. package/ENHANCE.md +69 -0
  7. package/LICENSE +1 -1
  8. package/PROPERTIES.md +641 -0
  9. package/README.md +89 -28
  10. package/SUMMARY.md +9 -0
  11. package/TROUBLESHOOT.md +47 -0
  12. package/adapter.js +566 -0
  13. package/adapterBase.js +549 -879
  14. package/changelogs/CHANGELOG.md +9 -0
  15. package/metadata.json +49 -0
  16. package/package.json +26 -25
  17. package/pronghorn.json +981 -0
  18. package/propertiesSchema.json +506 -51
  19. package/refs?service=git-upload-pack +0 -0
  20. package/report/adapterInfo.json +8 -8
  21. package/report/updateReport1691508888201.json +120 -0
  22. package/report/updateReport1692202203193.json +120 -0
  23. package/report/updateReport1692203305042.json +120 -0
  24. package/report/updateReport1694469210573.json +120 -0
  25. package/report/updateReport1698422912292.json +120 -0
  26. package/sampleProperties.json +210 -12
  27. package/test/integration/adapterTestBasicGet.js +83 -0
  28. package/test/integration/adapterTestConnectivity.js +142 -0
  29. package/test/integration/adapterTestIntegration.js +180 -15
  30. package/test/unit/adapterBaseTestUnit.js +388 -313
  31. package/test/unit/adapterTestUnit.js +465 -106
  32. package/utils/adapterInfo.js +1 -1
  33. package/utils/addAuth.js +1 -1
  34. package/utils/artifactize.js +1 -1
  35. package/utils/checkMigrate.js +1 -1
  36. package/utils/entitiesToDB.js +2 -2
  37. package/utils/findPath.js +1 -1
  38. package/utils/methodDocumentor.js +273 -0
  39. package/utils/modify.js +13 -15
  40. package/utils/packModificationScript.js +1 -1
  41. package/utils/pre-commit.sh +2 -0
  42. package/utils/taskMover.js +309 -0
  43. package/utils/tbScript.js +89 -34
  44. package/utils/tbUtils.js +41 -21
  45. package/utils/testRunner.js +1 -1
  46. package/utils/troubleshootingAdapter.js +9 -6
  47. package/workflows/README.md +0 -3
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Adapter for Winston Syslog
1
+ # Adapter for WinstonSyslog
2
2
 
3
3
  ## Table of Contents
4
4
 
@@ -14,6 +14,7 @@ Some of the page links in this document and links to other GitLab files do not w
14
14
  - [Testing](#testing)
15
15
  - [Configuration](./PROPERTIES.md)
16
16
  - [Using this Adapter](./CALLS.md)
17
+ - [Authentication](./AUTH.md)
17
18
  - [Additional Information](#additional-information)
18
19
  - [Enhancements](./ENHANCE.md)
19
20
  - [Contributing](./CONTRIBUTING.md)
@@ -29,7 +30,9 @@ Some of the page links in this document and links to other GitLab files do not w
29
30
 
30
31
  Itential Product and opensource adapters utilize SemVer for versioning. The current version of the adapter can be found in the `package.json` file or viewed in the IAP GUI on the System page. All Itential opensource adapters can be found in the <a href="https://gitlab.com/itentialopensource/adapters" target="_blank">Itential OpenSource Repository</a>.
31
32
 
32
- Release notes can be viewed in CHANGELOG.md or in the <a href="https://itential.atlassian.net/servicedesk/customer/portals" target="_blank">Customer Knowledge Base</a> for Itential adapters.
33
+ Any release prior to 1.0.0 is a pre-release. Initial builds of adapters are generally set up as pre-releases as there is often work that needs to be done to configure the adapter and make sure the authentication process to WinstonSyslog works appropriately.
34
+
35
+ Release notes can be viewed in CHANGELOG.md.
33
36
 
34
37
  ## Supported IAP Versions
35
38
 
@@ -45,17 +48,20 @@ These instructions will help you get a copy of the project on your local machine
45
48
 
46
49
  ### Helpful Background Information
47
50
 
48
- There is adapter documentation available on the Itential Developer Site <a href="https://www.itential.com/automation-platform/integrations/adapters-resources/" target="_blank">HERE</a>. This documentation includes information and examples that are helpful for:
51
+ There is <a href="https://docs.itential.com/opensource/docs/adapters" target="_blank">Adapter documentation available on the Itential Documentation Site</a>. This documentation includes information and examples that are helpful for:
49
52
 
50
53
  ```text
51
54
  Authentication
52
- Properties
55
+ IAP Service Instance Configuration
53
56
  Code Files
54
- Action Files
55
- Schema Files
56
- Mock Data Files
57
+ Endpoint Configuration (Action & Schema)
58
+ Mock Data
59
+ Adapter Generic Methods
60
+ Headers
61
+ Security
57
62
  Linting and Testing
58
- Troubleshooting
63
+ Build an Adapter
64
+ Troubleshooting an Adapter
59
65
  ```
60
66
 
61
67
  Others will be added over time.
@@ -84,7 +90,7 @@ The following list of packages are required for Itential opensource adapters or
84
90
  </tr>
85
91
  <tr>
86
92
  <td style="padding:15px">ajv</td>
87
- <td style="padding:15px">Required for validation of adapter properties to integrate with Winsotn Syslog.</td>
93
+ <td style="padding:15px">Required for validation of adapter properties to integrate with WinstonSyslog.</td>
88
94
  </tr>
89
95
  <tr>
90
96
  <td style="padding:15px">axios</td>
@@ -94,6 +100,10 @@ The following list of packages are required for Itential opensource adapters or
94
100
  <td style="padding:15px">commander</td>
95
101
  <td style="padding:15px">Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality.</td>
96
102
  </tr>
103
+ <tr>
104
+ <td style="padding:15px">dns-lookup-promise</td>
105
+ <td style="padding:15px">Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality.</td>
106
+ </tr>
97
107
  <tr>
98
108
  <td style="padding:15px">fs-extra</td>
99
109
  <td style="padding:15px">Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality.</td>
@@ -110,14 +120,14 @@ The following list of packages are required for Itential opensource adapters or
110
120
  <td style="padding:15px">mongodb</td>
111
121
  <td style="padding:15px">Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality.</td>
112
122
  </tr>
113
- <tr>
114
- <td style="padding:15px">network-diagnostics</td>
115
- <td style="padding:15px">Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality.</td>
116
- </tr>
117
123
  <tr>
118
124
  <td style="padding:15px">nyc</td>
119
125
  <td style="padding:15px">Testing coverage library that is utilized by some of the node scripts that are included with the adapter.</td>
120
126
  </tr>
127
+ <tr>
128
+ <td style="padding:15px">ping</td>
129
+ <td style="padding:15px">Utilized by the node scripts that are included with the adapter; helps to build and extend the functionality.</td>
130
+ </tr>
121
131
  <tr>
122
132
  <td style="padding:15px">readline-sync</td>
123
133
  <td style="padding:15px">Utilized by the node script that comes with the adapter; helps to test unit and integration functionality.</td>
@@ -141,7 +151,6 @@ eslint
141
151
  eslint-config-airbnb-base
142
152
  eslint-plugin-import
143
153
  eslint-plugin-json
144
- package-json-validator
145
154
  testdouble
146
155
  ```
147
156
 
@@ -168,13 +177,6 @@ tar -xvf adapter-winston_syslog.tar
168
177
 
169
178
  3. Run the adapter install script.
170
179
 
171
- ```bash
172
- cd adapter-winston_syslog
173
- npm run adapter:install
174
- ```
175
-
176
- 3. Install adapter dependencies and check the adapter.
177
-
178
180
  ```bash
179
181
  cd adapter-winston_syslog
180
182
  npm install
@@ -194,6 +196,25 @@ systemctl restart pronghorn
194
196
 
195
197
  7. Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI
196
198
 
199
+
200
+ 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:
201
+
202
+ 3. Install adapter dependencies and check the adapter.
203
+
204
+ ```bash
205
+ cd adapter-winston_syslog
206
+ npm run adapter:install
207
+ ```
208
+
209
+ 4. Restart IAP
210
+
211
+ ```bash
212
+ systemctl restart pronghorn
213
+ ```
214
+
215
+ 5. Change the adapter service instance configuration (host, port, credentials, etc) in IAP Admin Essentials GUI
216
+
217
+
197
218
  ### Testing
198
219
 
199
220
  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.
@@ -211,14 +232,42 @@ npm run test:baseunit
211
232
 
212
233
  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.
213
234
 
235
+ #### Integration Testing - Standalone
214
236
 
215
- ## Configuration
237
+ 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 WinstonSyslog. 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.
216
238
 
217
- The critical information required for this adapter to work as expected are the host, port, and log protocol (udp4, tcp4, etc.). These options ensure we can connect to the correct syslog server. An optional property is minLogLevel. This will tell the adapter which log levels to send logs at. If this is not set, it will default to info and above. Note that the options in the task will not change when this is set, so the user will need to be careful and only select the appropriate log levels. An example of what these properties might look like are included in the sampleProperties.json file. Note that the healthcheck type for this adapter should always be set to `none`, as there is no way to ensure connectivity over UDP which is the mechanism for writing to the syslog.
239
+ 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.
218
240
 
219
- ## Using this Adapter
241
+ ```bash
242
+ node utils/testRunner
243
+ answer no at the first prompt
244
+
245
+ npm run test:integration
246
+ ```
247
+
248
+ 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.
220
249
 
221
- This adapter has one task, `postLog` that can be used to post a log to the the server whose details have been provided in the adapter's properties. This task takes in three arguments: severity, facility and the message to send.
250
+ #### Integration Testing
251
+
252
+ Integration Testing requires connectivity to WinstonSyslog. 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.
253
+
254
+ > **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` and `updates`. Hence, integration tests may have to be enhanced before they will work (integrate) with WinstonSyslog. 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 WinstonSyslog which change order dependencies or required data.
255
+
256
+ ```bash
257
+ node utils/testRunner
258
+ answer yes at the first prompt
259
+ answer all other questions on connectivity and credentials
260
+ ```
261
+
262
+ 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.
263
+
264
+ > **Reminder**: Do not check in code with actual credentials to systems.
265
+
266
+ ## [Configuration](./PROPERTIES.md)
267
+
268
+ ## [Using this Adapter](./CALLS.md)
269
+
270
+ ### [Authentication](./AUTH.md)
222
271
 
223
272
  ## Additional Information
224
273
 
@@ -228,7 +277,7 @@ This adapter has one task, `postLog` that can be used to post a log to the the s
228
277
 
229
278
  ### Helpful Links
230
279
 
231
- <a href="https://www.itential.com/automation-platform/integrations/adapters-resources/" target="_blank">Adapter Technical Resources</a>
280
+ <a href="https://docs.itential.com/opensource/docs/adapters" target="_blank">Adapter Technical Resources</a>
232
281
 
233
282
  ### Node Scripts
234
283
 
@@ -263,9 +312,21 @@ There are several node scripts that now accompany the adapter. These scripts are
263
312
  <td style="padding:15px">npm run adapter:revert</td>
264
313
  <td style="padding:15px">Allows you to revert after a migration or update if it resulted in issues.</td>
265
314
  </tr>
315
+ <tr>
316
+ <td style="padding:15px">npm run troubleshoot</td>
317
+ <td style="padding:15px">Provides a way to troubleshoot the adapter - runs connectivity, healthcheck and basic get.</td>
318
+ </tr>
319
+ <tr>
320
+ <td style="padding:15px">npm run connectivity</td>
321
+ <td style="padding:15px">Provides a connectivity check to the WinstonSyslog system.</td>
322
+ </tr>
266
323
  <tr>
267
324
  <td style="padding:15px">npm run healthcheck</td>
268
- <td style="padding:15px">Checks whether the configured healthcheck call works to Winston Syslog.</td>
325
+ <td style="padding:15px">Checks whether the configured healthcheck call works to WinstonSyslog.</td>
326
+ </tr>
327
+ <tr>
328
+ <td style="padding:15px">npm run basicget</td>
329
+ <td style="padding:15px">Checks whether the basic get calls works to WinstonSyslog.</td>
269
330
  </tr>
270
331
  </table>
271
332
  <br>
@@ -282,4 +343,4 @@ Custom Adapters are maintained by other sources.
282
343
 
283
344
  ## Product License
284
345
 
285
- [Apache 2.0](./LICENSE)
346
+ [Apache 2.0](./LICENSE)
package/SUMMARY.md ADDED
@@ -0,0 +1,9 @@
1
+ ## Overview
2
+
3
+ This adapter is used to integrate the Itential Automation Platform (IAP) with the WinstonSyslog System. The API that was used to build the adapter for WinstonSyslog is usually available in the report directory of this adapter. The adapter utilizes the WinstonSyslog 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.
4
+
5
+ >**Note**: It is possible that some integrations will be supported through the WinstonSyslog adapter while other integrations will not. If you need additional API calls, you can use the Update capabilities provided by the Adapter Builder or request Itential to add them if the Adapter is an Itential opensourced adapter.
6
+
7
+ Itential provides information on all of its product adapters in the Customer Knowledge Base. Information in the <a href="https://itential.atlassian.net/servicedesk/customer/portals" target="_blank">Customer Knowledge Base</a> is consistently maintained and goes through documentation reviews. As a result, it should be the first place to go for information.
8
+
9
+ For opensourced and custom built adapters, the ReadMe is a starting point to understand what you have built, provide the information for you to be able to update the adapter, and assist you with deploying the adapter into IAP.
@@ -0,0 +1,47 @@
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 IAP.
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 WinstonSyslog Server.
26
+
27
+ ```text
28
+ ping the ip address of WinstonSyslog server
29
+ try telnet to the ip address port of WinstonSyslog
30
+ execute a curl command to the other system
31
+ ```
32
+
33
+ 4. Verify the credentials provided for WinstonSyslog.
34
+
35
+ ```text
36
+ login to WinstonSyslog using the provided credentials
37
+ ```
38
+
39
+ 5. Verify the API of the call utilized for WinstonSyslog 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.