@itentialopensource/adapter-checkpoint_management 0.4.0 → 0.6.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 (41) hide show
  1. package/AUTH.md +19 -16
  2. package/CALLS.md +12 -0
  3. package/CHANGELOG.md +16 -0
  4. package/CONTRIBUTING.md +1 -160
  5. package/ENHANCE.md +2 -2
  6. package/README.md +23 -18
  7. package/SYSTEMINFO.md +15 -3
  8. package/adapter.js +256 -333
  9. package/adapterBase.js +465 -898
  10. package/changelogs/changelog.md +111 -0
  11. package/entities/SessionManagement/action.json +21 -0
  12. package/entities/SessionManagement/schema.json +1 -0
  13. package/metadata.json +52 -0
  14. package/package.json +25 -25
  15. package/pronghorn.json +529 -161
  16. package/propertiesSchema.json +358 -31
  17. package/refs?service=git-upload-pack +0 -0
  18. package/report/adapterInfo.json +8 -8
  19. package/report/updateReport1691152555900.json +120 -0
  20. package/sampleProperties.json +153 -34
  21. package/test/integration/adapterTestBasicGet.js +2 -4
  22. package/test/integration/adapterTestConnectivity.js +91 -42
  23. package/test/integration/adapterTestIntegration.js +130 -2
  24. package/test/unit/adapterBaseTestUnit.js +388 -313
  25. package/test/unit/adapterTestUnit.js +332 -112
  26. package/utils/adapterInfo.js +1 -1
  27. package/utils/addAuth.js +1 -1
  28. package/utils/artifactize.js +1 -1
  29. package/utils/checkMigrate.js +1 -1
  30. package/utils/entitiesToDB.js +2 -2
  31. package/utils/findPath.js +1 -1
  32. package/utils/methodDocumentor.js +225 -0
  33. package/utils/modify.js +13 -15
  34. package/utils/packModificationScript.js +1 -1
  35. package/utils/pre-commit.sh +2 -0
  36. package/utils/taskMover.js +309 -0
  37. package/utils/tbScript.js +89 -34
  38. package/utils/tbUtils.js +41 -21
  39. package/utils/testRunner.js +1 -1
  40. package/utils/troubleshootingAdapter.js +9 -6
  41. package/workflows/README.md +0 -3
@@ -0,0 +1,120 @@
1
+ {
2
+ "errors": [],
3
+ "statistics": [
4
+ {
5
+ "owner": "errorJson",
6
+ "description": "New adapter errors available for use",
7
+ "value": 0
8
+ },
9
+ {
10
+ "owner": "errorJson",
11
+ "description": "Adapter errors no longer available for use",
12
+ "value": 0
13
+ },
14
+ {
15
+ "owner": "errorJson",
16
+ "description": "Adapter errors that have been updated (e.g. recommendation changes)",
17
+ "value": 31
18
+ },
19
+ {
20
+ "owner": "packageJson",
21
+ "description": "Number of production dependencies",
22
+ "value": 17
23
+ },
24
+ {
25
+ "owner": "packageJson",
26
+ "description": "Number of development dependencies",
27
+ "value": 6
28
+ },
29
+ {
30
+ "owner": "packageJson",
31
+ "description": "Number of npm scripts",
32
+ "value": 22
33
+ },
34
+ {
35
+ "owner": "packageJson",
36
+ "description": "Runtime Library dependency",
37
+ "value": "^5.0.5"
38
+ },
39
+ {
40
+ "owner": "propertiesSchemaJson",
41
+ "description": "Adapter properties defined in the propertiesSchema file",
42
+ "value": 76
43
+ },
44
+ {
45
+ "owner": "markdown",
46
+ "description": "Number of lines in the README.md",
47
+ "value": 343
48
+ },
49
+ {
50
+ "owner": "markdown",
51
+ "description": "Number of lines in the SUMMARY.md",
52
+ "value": 9
53
+ },
54
+ {
55
+ "owner": "markdown",
56
+ "description": "Number of lines in the PROPERTIES.md",
57
+ "value": 642
58
+ },
59
+ {
60
+ "owner": "markdown",
61
+ "description": "Number of lines in the TROUBLESHOOT.md",
62
+ "value": 48
63
+ },
64
+ {
65
+ "owner": "markdown",
66
+ "description": "Number of lines in the ENHANCE.md",
67
+ "value": 70
68
+ },
69
+ {
70
+ "owner": "markdown",
71
+ "description": "Number of lines in the BROKER.md",
72
+ "value": 70
73
+ },
74
+ {
75
+ "owner": "unitTestJS",
76
+ "description": "Number of lines of code in unit tests",
77
+ "value": 10059
78
+ },
79
+ {
80
+ "owner": "unitTestJS",
81
+ "description": "Number of unit tests",
82
+ "value": 658
83
+ },
84
+ {
85
+ "owner": "integrationTestJS",
86
+ "description": "Number of lines of code in integration tests",
87
+ "value": 10322
88
+ },
89
+ {
90
+ "owner": "integrationTestJS",
91
+ "description": "Number of integration tests",
92
+ "value": 304
93
+ },
94
+ {
95
+ "owner": "staticFile",
96
+ "description": "Number of lines of code in adapterBase.js",
97
+ "value": 1350
98
+ },
99
+ {
100
+ "owner": "staticFile",
101
+ "description": "Number of static files added",
102
+ "value": 38
103
+ },
104
+ {
105
+ "owner": "Overall",
106
+ "description": "Total lines of Code",
107
+ "value": 21731
108
+ },
109
+ {
110
+ "owner": "Overall",
111
+ "description": "Total Tests",
112
+ "value": 962
113
+ },
114
+ {
115
+ "owner": "Overall",
116
+ "description": "Total Files",
117
+ "value": 6
118
+ }
119
+ ]
120
+ }
@@ -4,13 +4,14 @@
4
4
  "properties": {
5
5
  "host": "INSERT CHECKPOINT HOST HERE",
6
6
  "port": 443,
7
+ "choosepath": "",
7
8
  "base_path": "/web_api",
8
9
  "version": "",
9
10
  "cache_location": "none",
10
11
  "encode_pathvars": true,
11
12
  "encode_queryvars": true,
12
13
  "save_metric": false,
13
- "stub": false,
14
+ "stub": true,
14
15
  "protocol": "https",
15
16
  "authentication": {
16
17
  "auth_method": "request_token",
@@ -21,20 +22,35 @@
21
22
  "token_password_field": "password",
22
23
  "token_result_field": "sid",
23
24
  "token_URI_path": "/login",
24
- "invalid_token_error": 400,
25
25
  "token_timeout": 3600000,
26
26
  "token_cache": "local",
27
+ "invalid_token_error": 400,
27
28
  "auth_field": "header.headers.x-chkp-sid",
28
29
  "auth_field_format": "{token}",
29
30
  "auth_logging": false,
30
31
  "client_id": "",
31
32
  "client_secret": "",
32
- "grant_type": ""
33
+ "grant_type": "",
34
+ "sensitive": [],
35
+ "sso": {
36
+ "protocol": "",
37
+ "host": "",
38
+ "port": 0
39
+ },
40
+ "multiStepAuthCalls": [
41
+ {
42
+ "name": "",
43
+ "requestFields": {},
44
+ "responseFields": {},
45
+ "successfullResponseCode": 200
46
+ }
47
+ ]
33
48
  },
34
49
  "healthcheck": {
35
50
  "type": "startup",
36
51
  "frequency": 60000,
37
- "query_object": {}
52
+ "query_object": {},
53
+ "addlHeaders": {}
38
54
  },
39
55
  "throttle": {
40
56
  "throttle_enabled": false,
@@ -107,72 +123,136 @@
107
123
  "devicebroker": {
108
124
  "getDevice": [
109
125
  {
110
- "path": "/get/devices/{id}",
111
- "method": "GET",
126
+ "path": "/show-simple-gateway",
127
+ "method": "POST",
112
128
  "query": {},
113
- "body": {},
129
+ "body": {
130
+ "uid": "uid"
131
+ },
114
132
  "headers": {},
115
133
  "handleFailure": "ignore",
116
134
  "requestFields": {
117
- "id": "name"
135
+ "uid": "uid"
118
136
  },
119
137
  "responseDatakey": "",
120
138
  "responseFields": {
121
- "name": "host",
122
- "ostype": "os",
123
- "ostypePrefix": "system-",
124
- "ipaddress": "attributes.ipaddr",
125
- "port": "443"
139
+ "name": "name",
140
+ "ostype": "type",
141
+ "ostypePrefix": "chkpt-",
142
+ "ipaddress": "ipv4-address",
143
+ "port": "n/a"
144
+ }
145
+ },
146
+ {
147
+ "path": "/show-lsm-gateway",
148
+ "method": "POST",
149
+ "query": {},
150
+ "body": {
151
+ "uid": "uid"
152
+ },
153
+ "headers": {},
154
+ "handleFailure": "ignore",
155
+ "requestFields": {
156
+ "uid": "uid"
157
+ },
158
+ "responseDatakey": "",
159
+ "responseFields": {
160
+ "name": "name",
161
+ "ostype": "type",
162
+ "ostypePrefix": "chkpt-",
163
+ "ipaddress": "ipv4-address",
164
+ "port": "n/a"
126
165
  }
127
166
  }
128
167
  ],
129
168
  "getDevicesFiltered": [
130
169
  {
131
- "path": "/get/devices",
132
- "method": "GET",
170
+ "path": "/show-gateways-and-servers",
171
+ "method": "POST",
133
172
  "query": {},
134
- "body": {},
173
+ "body": {
174
+ "offset": "0",
175
+ "limit": "500"
176
+ },
135
177
  "headers": {},
136
178
  "handleFailure": "ignore",
137
179
  "requestFields": {},
138
180
  "responseDatakey": "",
139
181
  "responseFields": {
140
- "name": "host",
141
- "ostype": "os",
142
- "ostypePrefix": "system-",
143
- "ipaddress": "attributes.ipaddr",
144
- "port": "443"
182
+ "name": "name",
183
+ "ostype": "type",
184
+ "ostypePrefix": "chkpt-",
185
+ "ipaddress": "n/a",
186
+ "port": "n/a",
187
+ "uid": "uid"
145
188
  }
146
189
  }
147
190
  ],
148
191
  "isAlive": [
149
192
  {
150
- "path": "/get/devices/{id}/status",
151
- "method": "GET",
193
+ "path": "/show-simple-gateway",
194
+ "method": "POST",
195
+ "query": {},
196
+ "body": {
197
+ "uid": "uid"
198
+ },
199
+ "headers": {},
200
+ "handleFailure": "ignore",
201
+ "requestFields": {
202
+ "uid": "uid"
203
+ },
204
+ "responseDatakey": "",
205
+ "responseFields": {
206
+ "status": "meta-info.validation-state",
207
+ "statusValue": "ok"
208
+ }
209
+ },
210
+ {
211
+ "path": "/show-lsm-gateway",
212
+ "method": "POST",
152
213
  "query": {},
153
- "body": {},
214
+ "body": {
215
+ "uid": "uid"
216
+ },
154
217
  "headers": {},
155
218
  "handleFailure": "ignore",
156
219
  "requestFields": {
157
- "id": "name"
220
+ "uid": "uid"
158
221
  },
159
222
  "responseDatakey": "",
160
223
  "responseFields": {
161
- "status": "status",
162
- "statusValue": "online"
224
+ "status": "meta-info.validation-state",
225
+ "statusValue": "ok"
163
226
  }
164
227
  }
165
228
  ],
166
229
  "getConfig": [
167
230
  {
168
- "path": "/get/devices/{id}/configPart1",
169
- "method": "GET",
231
+ "path": "/show-simple-gateway",
232
+ "method": "POST",
170
233
  "query": {},
171
- "body": {},
234
+ "body": {
235
+ "uid": "uid"
236
+ },
172
237
  "headers": {},
173
238
  "handleFailure": "ignore",
174
239
  "requestFields": {
175
- "id": "name"
240
+ "uid": "uid"
241
+ },
242
+ "responseDatakey": "",
243
+ "responseFields": {}
244
+ },
245
+ {
246
+ "path": "/show-lsm-gateway",
247
+ "method": "POST",
248
+ "query": {},
249
+ "body": {
250
+ "uid": "uid"
251
+ },
252
+ "headers": {},
253
+ "handleFailure": "ignore",
254
+ "requestFields": {
255
+ "uid": "uid"
176
256
  },
177
257
  "responseDatakey": "",
178
258
  "responseFields": {}
@@ -180,10 +260,13 @@
180
260
  ],
181
261
  "getCount": [
182
262
  {
183
- "path": "/get/devices",
184
- "method": "GET",
263
+ "path": "/show-gateways-and-servers",
264
+ "method": "POST",
185
265
  "query": {},
186
- "body": {},
266
+ "body": {
267
+ "offset": "0",
268
+ "limit": "500"
269
+ },
187
270
  "headers": {},
188
271
  "handleFailure": "ignore",
189
272
  "requestFields": {},
@@ -191,6 +274,42 @@
191
274
  "responseFields": {}
192
275
  }
193
276
  ]
277
+ },
278
+ "cache": {
279
+ "enabled": false,
280
+ "entities": [
281
+ {
282
+ "entityType": "device",
283
+ "frequency": 3600,
284
+ "flushOnFail": false,
285
+ "limit": 1000,
286
+ "retryAttempts": 5,
287
+ "sort": true,
288
+ "populate": [
289
+ {
290
+ "path": "/show-gateways-and-servers",
291
+ "method": "POST",
292
+ "query": {},
293
+ "body": {
294
+ "offset": "0",
295
+ "limit": "500"
296
+ },
297
+ "headers": {},
298
+ "handleFailure": "ignore",
299
+ "requestFields": {},
300
+ "responseDatakey": "",
301
+ "responseFields": {}
302
+ }
303
+ ],
304
+ "cachedTasks": [
305
+ {
306
+ "name": "",
307
+ "filterField": "",
308
+ "filterLoc": ""
309
+ }
310
+ ]
311
+ }
312
+ ]
194
313
  }
195
314
  },
196
315
  "groups": [],
@@ -7,9 +7,9 @@
7
7
  /* eslint import/no-dynamic-require: warn */
8
8
  /* eslint import/no-unresolved: warn */
9
9
 
10
- const mocha = require('mocha');
11
10
  const path = require('path');
12
11
  const assert = require('assert');
12
+ const mocha = require('mocha');
13
13
  const itParam = require('mocha-param');
14
14
 
15
15
  const utils = require('../../utils/tbUtils');
@@ -18,12 +18,10 @@ const { name } = require('../../package.json');
18
18
  const { methods } = require('../../pronghorn.json');
19
19
 
20
20
  const getPronghornProps = (iapDir) => {
21
- const { Discovery } = require('@itential/itential-utils');
22
21
  console.log('Retrieving properties.json file...');
23
22
  const rawProps = require(path.join(iapDir, 'properties.json'));
24
23
  console.log('Decrypting properties...');
25
- const discovery = new Discovery();
26
- const pronghornProps = utils.decryptProperties(rawProps, path.join(__dirname, '..'), discovery);
24
+ const pronghornProps = utils.decryptProperties(rawProps, iapDir);
27
25
  console.log('Found properties.\n');
28
26
  return pronghornProps;
29
27
  };
@@ -3,9 +3,12 @@
3
3
  /* global describe it context before after */
4
4
  /* eslint no-unused-vars: warn */
5
5
 
6
- const mocha = require('mocha');
7
6
  const assert = require('assert');
8
- const diagnostics = require('network-diagnostics');
7
+ const http = require('http');
8
+ const https = require('https');
9
+ const mocha = require('mocha');
10
+ const ping = require('ping');
11
+ const dnsLookup = require('dns-lookup-promise');
9
12
 
10
13
  let host;
11
14
  process.argv.forEach((val) => {
@@ -16,78 +19,124 @@ process.argv.forEach((val) => {
16
19
 
17
20
  describe('[integration] Adapter Test', () => {
18
21
  context(`Testing network connection on ${host}`, () => {
19
- before(() => {
20
- diagnostics.setTestURL(host);
21
- });
22
-
23
22
  after((done) => {
24
23
  done();
25
24
  });
26
25
 
27
26
  it('DNS resolve', (done) => {
28
- diagnostics.haveDNS((result) => {
29
- try {
30
- assert.equal(result, true);
31
- done();
32
- } catch (error) {
33
- done(error);
34
- }
35
- });
27
+ dnsLookup(host)
28
+ .then((addresses) => {
29
+ try {
30
+ assert.ok(addresses.length > 0);
31
+ done();
32
+ } catch (error) {
33
+ done(error);
34
+ }
35
+ })
36
+ .catch((err) => {
37
+ done(err);
38
+ });
36
39
  });
37
40
 
38
41
  it('Responds to ping', (done) => {
39
- diagnostics.havePing((result) => {
40
- try {
41
- assert.equal(result, true);
42
- done();
43
- } catch (error) {
44
- done(error);
45
- }
46
- });
42
+ ping.promise.probe(host)
43
+ .then((result) => {
44
+ try {
45
+ assert.ok(result.alive);
46
+ done();
47
+ } catch (error) {
48
+ done(error);
49
+ }
50
+ })
51
+ .catch((err) => {
52
+ done(err);
53
+ });
47
54
  });
48
55
 
49
56
  it('Support HTTP on port 80', (done) => {
50
- diagnostics.haveHTTP((result) => {
57
+ const requestOptions = {
58
+ host,
59
+ port: 80,
60
+ method: 'HEAD'
61
+ };
62
+
63
+ const req = http.request(requestOptions, (res) => {
51
64
  try {
52
- assert.equal(result, true);
65
+ assert.ok(res.statusCode >= 200 && res.statusCode < 400);
53
66
  done();
54
67
  } catch (error) {
55
68
  done(error);
56
69
  }
57
70
  });
71
+
72
+ req.on('error', (err) => {
73
+ done(err);
74
+ });
75
+
76
+ req.end();
58
77
  });
59
78
 
60
79
  it('Support HTTPS on port 443', (done) => {
61
- diagnostics.haveHTTPS((result) => {
80
+ const requestOptions = {
81
+ host,
82
+ port: 443,
83
+ method: 'HEAD'
84
+ };
85
+
86
+ const req = https.request(requestOptions, (res) => {
62
87
  try {
63
- assert.equal(result, true);
88
+ assert.ok(res.statusCode >= 200 && res.statusCode < 400);
64
89
  done();
65
90
  } catch (error) {
66
91
  done(error);
67
92
  }
68
93
  });
94
+
95
+ req.on('error', (err) => {
96
+ done(err);
97
+ });
98
+
99
+ req.end();
69
100
  });
70
101
 
71
102
  it('Support IPv4', (done) => {
72
- diagnostics.haveIPv4Async((result) => {
73
- try {
74
- assert.equal(result, true);
75
- done();
76
- } catch (error) {
77
- done(error);
78
- }
79
- });
103
+ const options = {
104
+ family: 4,
105
+ hints: dnsLookup.ADDRCONFIG
106
+ };
107
+
108
+ dnsLookup.lookup(host, options)
109
+ .then((address, family) => {
110
+ try {
111
+ assert.ok(address !== null && family === 4);
112
+ done();
113
+ } catch (error) {
114
+ done(error);
115
+ }
116
+ })
117
+ .catch((err) => {
118
+ done(err);
119
+ });
80
120
  });
81
121
 
82
122
  it('Support IPv6', (done) => {
83
- diagnostics.haveIPv6Async((result) => {
84
- try {
85
- assert.equal(result, true);
86
- done();
87
- } catch (error) {
88
- done(error);
89
- }
90
- });
123
+ const options = {
124
+ family: 6,
125
+ hints: dnsLookup.ADDRCONFIG
126
+ };
127
+
128
+ dnsLookup.lookup(host, options)
129
+ .then((address, family) => {
130
+ try {
131
+ assert.ok(address !== null && family === 6);
132
+ done();
133
+ } catch (error) {
134
+ done(error);
135
+ }
136
+ })
137
+ .catch((err) => {
138
+ done(err);
139
+ });
91
140
  });
92
141
  });
93
142
  });