@itentialopensource/adapter-netbox 0.6.3 → 0.7.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.
- package/CHANGELOG.md +24 -0
- package/README.md +84 -11
- package/adapter.js +551 -1
- package/adapterBase.js +23 -1
- package/entities/.generic/action.json +5 -5
- package/entities/.system/action.json +1 -1
- package/entities/Graphql/action.json +25 -0
- package/entities/Graphql/schema.json +19 -0
- package/error.json +6 -0
- package/package.json +19 -14
- package/pronghorn.json +226 -0
- package/propertiesSchema.json +15 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/updateReport1644854487087.json +95 -0
- package/sampleProperties.json +4 -1
- package/test/integration/adapterTestBasicGet.js +1 -1
- package/test/integration/adapterTestIntegration.js +35 -2
- package/test/unit/adapterBaseTestUnit.js +6 -3
- package/test/unit/adapterTestUnit.js +518 -4
- package/utils/addAuth.js +94 -0
- package/utils/basicGet.js +1 -14
- package/utils/entitiesToDB.js +224 -0
- package/utils/modify.js +1 -1
- package/utils/packModificationScript.js +1 -1
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/removeHooks.js +20 -0
- package/utils/tbScript.js +14 -8
- package/utils/tbUtils.js +98 -19
- package/utils/troubleshootingAdapter.js +2 -26
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"actions": [
|
|
3
|
+
{
|
|
4
|
+
"name": "getGraphql",
|
|
5
|
+
"protocol": "REST",
|
|
6
|
+
"method": "GET",
|
|
7
|
+
"entitypath": "/graphql/?{query}",
|
|
8
|
+
"requestSchema": "schema.json",
|
|
9
|
+
"responseSchema": "schema.json",
|
|
10
|
+
"timeout": 0,
|
|
11
|
+
"sendEmpty": false,
|
|
12
|
+
"sendGetBody": true,
|
|
13
|
+
"requestDatatype": "JSON",
|
|
14
|
+
"responseDatatype": "JSON",
|
|
15
|
+
"headers": {},
|
|
16
|
+
"responseObjects": [
|
|
17
|
+
{
|
|
18
|
+
"type": "default",
|
|
19
|
+
"key": "",
|
|
20
|
+
"mockFile": ""
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$id": "schema.json",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"schema": "http://json-schema.org/draft-07/schema#",
|
|
5
|
+
"translate": false,
|
|
6
|
+
"dynamicfields": true,
|
|
7
|
+
"properties": {
|
|
8
|
+
"ph_request_type": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "type of request (internal to adapter)",
|
|
11
|
+
"default": "getGraphql",
|
|
12
|
+
"enum": [
|
|
13
|
+
"getGraphql"
|
|
14
|
+
],
|
|
15
|
+
"external_name": "ph_request_type"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"definitions": {}
|
|
19
|
+
}
|
package/error.json
CHANGED
|
@@ -168,6 +168,12 @@
|
|
|
168
168
|
"displayString": "Failure response received for $VARIABLE$",
|
|
169
169
|
"recommendation": "Check the reason for failure in the stack trace"
|
|
170
170
|
},
|
|
171
|
+
{
|
|
172
|
+
"key": "Suspended Adapter",
|
|
173
|
+
"icode": "AD.600",
|
|
174
|
+
"displayString": "Adapter is suspended",
|
|
175
|
+
"recommendation": "Check if external system is functional and unsuspend if appropriate"
|
|
176
|
+
},
|
|
171
177
|
{
|
|
172
178
|
"key": "Caught Exception",
|
|
173
179
|
"icode": "AD.900",
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itentialopensource/adapter-netbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "This adapter integrates with system Netbox",
|
|
5
5
|
"main": "adapter.js",
|
|
6
|
-
"wizardVersion": "2.
|
|
7
|
-
"engineVersion": "1.
|
|
6
|
+
"wizardVersion": "2.44.7",
|
|
7
|
+
"engineVersion": "1.59.55",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"artifactize": "npm i && node utils/packModificationScript.js",
|
|
10
|
-
"preinstall": "node utils/setup.js",
|
|
10
|
+
"preinstall": "node utils/setup.js && npm install --package-lock-only --ignore-scripts && npx npm-force-resolutions",
|
|
11
11
|
"lint": "node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js",
|
|
12
12
|
"lint:errors": "node --max_old_space_size=4096 ./node_modules/eslint/bin/eslint.js . --ext .json --ext .js --quiet",
|
|
13
13
|
"test:baseunit": "mocha test/unit/adapterBaseTestUnit.js --LOG=error",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"test:integration": "mocha test/integration/adapterTestIntegration.js --LOG=error",
|
|
16
16
|
"test:cover": "nyc --reporter html --reporter text mocha --reporter dot test/*",
|
|
17
17
|
"test": "npm run test:baseunit && npm run test:unit && npm run test:integration",
|
|
18
|
-
"adapter:install": "node utils/tbScript.js install",
|
|
18
|
+
"adapter:install": "npm i && node utils/tbScript.js install",
|
|
19
19
|
"adapter:checkMigrate": "node utils/checkMigrate.js",
|
|
20
20
|
"adapter:findPath": "node utils/findPath.js",
|
|
21
21
|
"adapter:migrate": "node utils/modify.js -m",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"healthcheck": "node utils/tbScript.js healthcheck",
|
|
26
26
|
"basicget": "node utils/tbScript.js basicget",
|
|
27
27
|
"connectivity": "node utils/tbScript.js connectivity",
|
|
28
|
-
"deploy": "npm publish --registry=
|
|
28
|
+
"deploy": "npm publish --registry=https://registry.npmjs.org --access=public",
|
|
29
29
|
"build": "npm run deploy"
|
|
30
30
|
},
|
|
31
31
|
"keywords": [
|
|
@@ -51,13 +51,14 @@
|
|
|
51
51
|
"author": "Itential",
|
|
52
52
|
"homepage": "https://gitlab.com/itentialopensource/adapters/inventory/adapter-netbox#readme",
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@itentialopensource/adapter-utils": "^4.
|
|
54
|
+
"@itentialopensource/adapter-utils": "^4.44.11",
|
|
55
55
|
"ajv": "^6.12.0",
|
|
56
56
|
"axios": "^0.21.0",
|
|
57
57
|
"commander": "^2.20.0",
|
|
58
58
|
"fs-extra": "^8.1.0",
|
|
59
|
-
"mocha": "^
|
|
59
|
+
"mocha": "^9.0.1",
|
|
60
60
|
"mocha-param": "^2.0.1",
|
|
61
|
+
"mongodb": "^4.1.0",
|
|
61
62
|
"network-diagnostics": "^0.5.3",
|
|
62
63
|
"nyc": "^15.1.0",
|
|
63
64
|
"readline-sync": "^1.4.10",
|
|
@@ -65,13 +66,17 @@
|
|
|
65
66
|
"winston": "^3.3.3"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
|
-
"chai": "^4.
|
|
69
|
-
"eslint": "^7.
|
|
70
|
-
"eslint-config-airbnb-base": "^14.2.
|
|
71
|
-
"eslint-plugin-import": "^2.
|
|
72
|
-
"eslint-plugin-json": "^
|
|
69
|
+
"chai": "^4.3.4",
|
|
70
|
+
"eslint": "^7.29.0",
|
|
71
|
+
"eslint-config-airbnb-base": "^14.2.1",
|
|
72
|
+
"eslint-plugin-import": "^2.23.4",
|
|
73
|
+
"eslint-plugin-json": "^3.0.0",
|
|
73
74
|
"package-json-validator": "^0.6.3",
|
|
74
75
|
"testdouble": "^3.16.1"
|
|
75
76
|
},
|
|
76
|
-
"
|
|
77
|
+
"resolutions": {
|
|
78
|
+
"minimist": "^1.2.5"
|
|
79
|
+
},
|
|
80
|
+
"private": false,
|
|
81
|
+
"adapterType": "http"
|
|
77
82
|
}
|
package/pronghorn.json
CHANGED
|
@@ -386,6 +386,198 @@
|
|
|
386
386
|
},
|
|
387
387
|
"task": true
|
|
388
388
|
},
|
|
389
|
+
{
|
|
390
|
+
"name": "moveEntitiesToDB",
|
|
391
|
+
"summary": "Moves entities from an adapter into the IAP database",
|
|
392
|
+
"description": "Moves entities from an adapter into the IAP database",
|
|
393
|
+
"input": [],
|
|
394
|
+
"output": {
|
|
395
|
+
"name": "res",
|
|
396
|
+
"type": "object",
|
|
397
|
+
"description": "A JSON Object containing status, code and the response from the mongo transaction",
|
|
398
|
+
"schema": {
|
|
399
|
+
"title": "res",
|
|
400
|
+
"type": "object"
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
"roles": [
|
|
404
|
+
"admin"
|
|
405
|
+
],
|
|
406
|
+
"route": {
|
|
407
|
+
"verb": "POST",
|
|
408
|
+
"path": "/moveEntitiesToDB"
|
|
409
|
+
},
|
|
410
|
+
"task": true
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
"name": "getDevice",
|
|
414
|
+
"summary": "Get the Appliance",
|
|
415
|
+
"description": "Get the Appliance",
|
|
416
|
+
"input": [
|
|
417
|
+
{
|
|
418
|
+
"name": "deviceName",
|
|
419
|
+
"type": "string",
|
|
420
|
+
"info": "An Appliance Device Name",
|
|
421
|
+
"required": true,
|
|
422
|
+
"schema": {
|
|
423
|
+
"title": "deviceName",
|
|
424
|
+
"type": "string"
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
],
|
|
428
|
+
"output": {
|
|
429
|
+
"name": "result",
|
|
430
|
+
"type": "object",
|
|
431
|
+
"description": "A JSON Object containing status, code and the result",
|
|
432
|
+
"schema": {
|
|
433
|
+
"title": "result",
|
|
434
|
+
"type": "object"
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
"roles": [
|
|
438
|
+
"admin"
|
|
439
|
+
],
|
|
440
|
+
"route": {
|
|
441
|
+
"verb": "POST",
|
|
442
|
+
"path": "/getDevice"
|
|
443
|
+
},
|
|
444
|
+
"task": false
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
"name": "getDevicesFiltered",
|
|
448
|
+
"summary": "Get Appliances that match the filter",
|
|
449
|
+
"description": "Get Appliances that match the filter",
|
|
450
|
+
"input": [
|
|
451
|
+
{
|
|
452
|
+
"name": "options",
|
|
453
|
+
"type": "object",
|
|
454
|
+
"info": "options - e.g. { 'start': 1, 'limit': 20, 'filter': { 'name': 'abc123' } }",
|
|
455
|
+
"required": true,
|
|
456
|
+
"schema": {
|
|
457
|
+
"title": "options",
|
|
458
|
+
"type": "object"
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
],
|
|
462
|
+
"output": {
|
|
463
|
+
"name": "result",
|
|
464
|
+
"type": "array",
|
|
465
|
+
"description": "A JSON Object containing status, code and the result",
|
|
466
|
+
"schema": {
|
|
467
|
+
"title": "result",
|
|
468
|
+
"type": "array"
|
|
469
|
+
}
|
|
470
|
+
},
|
|
471
|
+
"roles": [
|
|
472
|
+
"admin"
|
|
473
|
+
],
|
|
474
|
+
"route": {
|
|
475
|
+
"verb": "POST",
|
|
476
|
+
"path": "/getDevicesFiltered"
|
|
477
|
+
},
|
|
478
|
+
"task": false
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
"name": "isAlive",
|
|
482
|
+
"summary": "Checks the status for the provided Appliance",
|
|
483
|
+
"description": "Checks the status for the provided Appliance",
|
|
484
|
+
"input": [
|
|
485
|
+
{
|
|
486
|
+
"name": "deviceName",
|
|
487
|
+
"type": "string",
|
|
488
|
+
"info": "An Appliance Device Name",
|
|
489
|
+
"required": true,
|
|
490
|
+
"schema": {
|
|
491
|
+
"title": "deviceName",
|
|
492
|
+
"type": "string"
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
],
|
|
496
|
+
"output": {
|
|
497
|
+
"name": "result",
|
|
498
|
+
"type": "boolean",
|
|
499
|
+
"description": "A JSON Object containing status, code and the result",
|
|
500
|
+
"schema": {
|
|
501
|
+
"title": "result",
|
|
502
|
+
"type": "boolean"
|
|
503
|
+
}
|
|
504
|
+
},
|
|
505
|
+
"roles": [
|
|
506
|
+
"admin"
|
|
507
|
+
],
|
|
508
|
+
"route": {
|
|
509
|
+
"verb": "POST",
|
|
510
|
+
"path": "/isAlive"
|
|
511
|
+
},
|
|
512
|
+
"task": false
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
"name": "getConfig",
|
|
516
|
+
"summary": "Gets a config for the provided Appliance",
|
|
517
|
+
"description": "Gets a config for the provided Appliance",
|
|
518
|
+
"input": [
|
|
519
|
+
{
|
|
520
|
+
"name": "deviceName",
|
|
521
|
+
"type": "string",
|
|
522
|
+
"info": "An Appliance Device Name",
|
|
523
|
+
"required": true,
|
|
524
|
+
"schema": {
|
|
525
|
+
"title": "deviceName",
|
|
526
|
+
"type": "string"
|
|
527
|
+
}
|
|
528
|
+
},
|
|
529
|
+
{
|
|
530
|
+
"name": "format",
|
|
531
|
+
"type": "string",
|
|
532
|
+
"info": "The format to be returned - this is ignored as we always return json",
|
|
533
|
+
"required": false,
|
|
534
|
+
"schema": {
|
|
535
|
+
"title": "format",
|
|
536
|
+
"type": "string"
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
],
|
|
540
|
+
"output": {
|
|
541
|
+
"name": "result",
|
|
542
|
+
"type": "object",
|
|
543
|
+
"description": "A JSON Object containing status, code and the result",
|
|
544
|
+
"schema": {
|
|
545
|
+
"title": "result",
|
|
546
|
+
"type": "object"
|
|
547
|
+
}
|
|
548
|
+
},
|
|
549
|
+
"roles": [
|
|
550
|
+
"admin"
|
|
551
|
+
],
|
|
552
|
+
"route": {
|
|
553
|
+
"verb": "POST",
|
|
554
|
+
"path": "/getConfig"
|
|
555
|
+
},
|
|
556
|
+
"task": false
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"name": "getCount",
|
|
560
|
+
"summary": "Gets a device count from the system",
|
|
561
|
+
"description": "Gets a device count from the system",
|
|
562
|
+
"input": [],
|
|
563
|
+
"output": {
|
|
564
|
+
"name": "result",
|
|
565
|
+
"type": "object",
|
|
566
|
+
"description": "A JSON Object containing status, code and the result",
|
|
567
|
+
"schema": {
|
|
568
|
+
"title": "result",
|
|
569
|
+
"type": "object"
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
"roles": [
|
|
573
|
+
"admin"
|
|
574
|
+
],
|
|
575
|
+
"route": {
|
|
576
|
+
"verb": "POST",
|
|
577
|
+
"path": "/getCount"
|
|
578
|
+
},
|
|
579
|
+
"task": false
|
|
580
|
+
},
|
|
389
581
|
{
|
|
390
582
|
"name": "getCircuitsCircuitTerminations",
|
|
391
583
|
"summary": "get Circuit Terminations",
|
|
@@ -42436,6 +42628,40 @@
|
|
|
42436
42628
|
"path": "/deleteVirtualizationVirtualMachinesId"
|
|
42437
42629
|
},
|
|
42438
42630
|
"task": true
|
|
42631
|
+
},
|
|
42632
|
+
{
|
|
42633
|
+
"name": "getGraphql",
|
|
42634
|
+
"summary": "A lightweight read-only endpoint for conveying querying using graphql.",
|
|
42635
|
+
"description": "A lightweight read-only endpoint for conveying querying using graphql.",
|
|
42636
|
+
"input": [
|
|
42637
|
+
{
|
|
42638
|
+
"name": "body",
|
|
42639
|
+
"type": "object",
|
|
42640
|
+
"info": "JSON object containing the graphql query",
|
|
42641
|
+
"required": true,
|
|
42642
|
+
"schema": {
|
|
42643
|
+
"title": "body",
|
|
42644
|
+
"type": "object"
|
|
42645
|
+
}
|
|
42646
|
+
}
|
|
42647
|
+
],
|
|
42648
|
+
"output": {
|
|
42649
|
+
"name": "result",
|
|
42650
|
+
"type": "object",
|
|
42651
|
+
"description": "A JSON Object containing status, code and the result",
|
|
42652
|
+
"schema": {
|
|
42653
|
+
"title": "result",
|
|
42654
|
+
"type": "object"
|
|
42655
|
+
}
|
|
42656
|
+
},
|
|
42657
|
+
"roles": [
|
|
42658
|
+
"admin"
|
|
42659
|
+
],
|
|
42660
|
+
"route": {
|
|
42661
|
+
"verb": "GET",
|
|
42662
|
+
"path": "/getGraphql"
|
|
42663
|
+
},
|
|
42664
|
+
"task": true
|
|
42439
42665
|
}
|
|
42440
42666
|
],
|
|
42441
42667
|
"views": []
|
package/propertiesSchema.json
CHANGED
|
@@ -232,6 +232,21 @@
|
|
|
232
232
|
"type": "boolean",
|
|
233
233
|
"description": "This property turns on logging of Authentication Information and should only be true when debugging authentication and connectivity",
|
|
234
234
|
"default": false
|
|
235
|
+
},
|
|
236
|
+
"client_id": {
|
|
237
|
+
"type": "string",
|
|
238
|
+
"description": "The client id for OAuth requests - can also use username depending on schema",
|
|
239
|
+
"default": ""
|
|
240
|
+
},
|
|
241
|
+
"client_secret": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"description": "The client secret for OAuth requests - can also use password depending on schema",
|
|
244
|
+
"default": ""
|
|
245
|
+
},
|
|
246
|
+
"grant_type": {
|
|
247
|
+
"type": "string",
|
|
248
|
+
"description": "The grant type for OAuth requests - can also provide in schema",
|
|
249
|
+
"default": ""
|
|
235
250
|
}
|
|
236
251
|
},
|
|
237
252
|
"required": [
|
|
Binary file
|
|
@@ -0,0 +1,95 @@
|
|
|
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": 30
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"owner": "packageJson",
|
|
21
|
+
"description": "Number of production dependencies",
|
|
22
|
+
"value": 13
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"owner": "packageJson",
|
|
26
|
+
"description": "Number of development dependencies",
|
|
27
|
+
"value": 7
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"owner": "packageJson",
|
|
31
|
+
"description": "Number of npm scripts",
|
|
32
|
+
"value": 23
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"owner": "packageJson",
|
|
36
|
+
"description": "Runtime Library dependency",
|
|
37
|
+
"value": "^4.44.11"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"owner": "propertiesSchemaJson",
|
|
41
|
+
"description": "Adapter properties defined in the propertiesSchema file",
|
|
42
|
+
"value": 64
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"owner": "readmeMd",
|
|
46
|
+
"description": "Number of lines in the README.md",
|
|
47
|
+
"value": 688
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"owner": "unitTestJS",
|
|
51
|
+
"description": "Number of lines of code in unit tests",
|
|
52
|
+
"value": 13450
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"owner": "unitTestJS",
|
|
56
|
+
"description": "Number of unit tests",
|
|
57
|
+
"value": 879
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"owner": "integrationTestJS",
|
|
61
|
+
"description": "Number of lines of code in integration tests",
|
|
62
|
+
"value": 12334
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"owner": "integrationTestJS",
|
|
66
|
+
"description": "Number of integration tests",
|
|
67
|
+
"value": 390
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"owner": "staticFile",
|
|
71
|
+
"description": "Number of lines of code in adapterBase.js",
|
|
72
|
+
"value": 1029
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"owner": "staticFile",
|
|
76
|
+
"description": "Number of static files added",
|
|
77
|
+
"value": 34
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"owner": "Overall",
|
|
81
|
+
"description": "Total lines of Code",
|
|
82
|
+
"value": 26813
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"owner": "Overall",
|
|
86
|
+
"description": "Total Tests",
|
|
87
|
+
"value": 1269
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"owner": "Overall",
|
|
91
|
+
"description": "Total Files",
|
|
92
|
+
"value": 6
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
}
|
package/sampleProperties.json
CHANGED
|
@@ -21,7 +21,10 @@
|
|
|
21
21
|
"invalid_token_error": 401,
|
|
22
22
|
"auth_field": "header.headers.Authorization",
|
|
23
23
|
"auth_field_format": "Basic {b64}{username}:{password}{/b64}",
|
|
24
|
-
"auth_logging": false
|
|
24
|
+
"auth_logging": false,
|
|
25
|
+
"client_id": "",
|
|
26
|
+
"client_secret": "",
|
|
27
|
+
"grant_type": ""
|
|
25
28
|
},
|
|
26
29
|
"healthcheck": {
|
|
27
30
|
"type": "startup",
|
|
@@ -14,7 +14,7 @@ const itParam = require('mocha-param');
|
|
|
14
14
|
|
|
15
15
|
const utils = require('../../utils/tbUtils');
|
|
16
16
|
const basicGet = require('../../utils/basicGet');
|
|
17
|
-
const { name } = require('../../package');
|
|
17
|
+
const { name } = require('../../package.json');
|
|
18
18
|
const { methods } = require('../../pronghorn.json');
|
|
19
19
|
|
|
20
20
|
const getPronghornProps = (iapDir) => {
|
|
@@ -13,7 +13,10 @@ const winston = require('winston');
|
|
|
13
13
|
const { expect } = require('chai');
|
|
14
14
|
const { use } = require('chai');
|
|
15
15
|
const td = require('testdouble');
|
|
16
|
+
const util = require('util');
|
|
17
|
+
const pronghorn = require('../../pronghorn.json');
|
|
16
18
|
|
|
19
|
+
pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
|
|
17
20
|
const anything = td.matchers.anything();
|
|
18
21
|
|
|
19
22
|
// stub and attemptTimeout are used throughout the code so set them here
|
|
@@ -63,7 +66,10 @@ global.pronghornProps = {
|
|
|
63
66
|
token_cache: 'local',
|
|
64
67
|
auth_field: 'header.headers.Authorization',
|
|
65
68
|
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
66
|
-
auth_logging: false
|
|
69
|
+
auth_logging: false,
|
|
70
|
+
client_id: '',
|
|
71
|
+
client_secret: '',
|
|
72
|
+
grant_type: ''
|
|
67
73
|
},
|
|
68
74
|
healthcheck: {
|
|
69
75
|
type: 'startup',
|
|
@@ -310,7 +316,7 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
|
|
|
310
316
|
}
|
|
311
317
|
|
|
312
318
|
// require the adapter that we are going to be using
|
|
313
|
-
const Netbox = require('../../adapter
|
|
319
|
+
const Netbox = require('../../adapter');
|
|
314
320
|
|
|
315
321
|
// begin the testing - these should be pretty well defined between the describe and the it!
|
|
316
322
|
describe('[integration] Netbox Adapter Test', () => {
|
|
@@ -341,6 +347,8 @@ describe('[integration] Netbox Adapter Test', () => {
|
|
|
341
347
|
try {
|
|
342
348
|
assert.notEqual(null, a);
|
|
343
349
|
assert.notEqual(undefined, a);
|
|
350
|
+
const checkId = global.pronghornProps.adapterProps.adapters[0].id;
|
|
351
|
+
assert.equal(checkId, a.id);
|
|
344
352
|
assert.notEqual(null, a.allProps);
|
|
345
353
|
const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
|
|
346
354
|
assert.equal(check, a.healthcheckType);
|
|
@@ -12299,5 +12307,30 @@ describe('[integration] Netbox Adapter Test', () => {
|
|
|
12299
12307
|
}
|
|
12300
12308
|
}).timeout(attemptTimeout);
|
|
12301
12309
|
});
|
|
12310
|
+
|
|
12311
|
+
describe('#getGraphql - errors', () => {
|
|
12312
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
12313
|
+
try {
|
|
12314
|
+
a.getGraphql({ query: 'fakeq' }, (data, error) => {
|
|
12315
|
+
try {
|
|
12316
|
+
if (stub) {
|
|
12317
|
+
const displayE = 'Error 400 received on request';
|
|
12318
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-netbox-connectorRest-handleEndResponse', displayE);
|
|
12319
|
+
} else {
|
|
12320
|
+
runCommonAsserts(data, error);
|
|
12321
|
+
}
|
|
12322
|
+
saveMockData('Status', 'getGraphql', 'default', data);
|
|
12323
|
+
done();
|
|
12324
|
+
} catch (err) {
|
|
12325
|
+
log.error(`Test Failure: ${err}`);
|
|
12326
|
+
done(err);
|
|
12327
|
+
}
|
|
12328
|
+
});
|
|
12329
|
+
} catch (error) {
|
|
12330
|
+
log.error(`Adapter Exception: ${error}`);
|
|
12331
|
+
done(error);
|
|
12332
|
+
}
|
|
12333
|
+
}).timeout(attemptTimeout);
|
|
12334
|
+
});
|
|
12302
12335
|
});
|
|
12303
12336
|
});
|
|
@@ -61,7 +61,10 @@ global.pronghornProps = {
|
|
|
61
61
|
token_cache: 'local',
|
|
62
62
|
auth_field: 'header.headers.Authorization',
|
|
63
63
|
auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
|
|
64
|
-
auth_logging: false
|
|
64
|
+
auth_logging: false,
|
|
65
|
+
client_id: '',
|
|
66
|
+
client_secret: '',
|
|
67
|
+
grant_type: ''
|
|
65
68
|
},
|
|
66
69
|
healthcheck: {
|
|
67
70
|
type: 'none',
|
|
@@ -194,7 +197,7 @@ function runErrorAsserts(data, error, code, origin, displayStr) {
|
|
|
194
197
|
}
|
|
195
198
|
|
|
196
199
|
// require the adapter that we are going to be using
|
|
197
|
-
const AdapterBase = require('../../adapterBase
|
|
200
|
+
const AdapterBase = require('../../adapterBase');
|
|
198
201
|
|
|
199
202
|
// delete the .DS_Store directory in entities -- otherwise this will cause errors
|
|
200
203
|
const dirPath = path.join(__dirname, '../../entities/.DS_Store');
|
|
@@ -314,7 +317,7 @@ describe('[unit] Adapter Base Test', () => {
|
|
|
314
317
|
});
|
|
315
318
|
it('should return a list of functions', (done) => {
|
|
316
319
|
const returnedFunctions = ['addEntityCache', 'capabilityResults', 'checkActionFiles', 'checkProperties', 'connect', 'encryptProperty',
|
|
317
|
-
'entityInList', 'findPath', 'getAllCapabilities', 'getAllFunctions', 'getQueue', 'getWorkflowFunctions', 'healthCheck',
|
|
320
|
+
'entityInList', 'findPath', 'getAllCapabilities', 'getAllFunctions', 'getQueue', 'getWorkflowFunctions', 'healthCheck', 'moveEntitiesToDB',
|
|
318
321
|
'refreshProperties', 'runBasicGet', 'runConnectivity', 'runHealthcheck', 'suspend', 'troubleshoot', 'unsuspend', 'updateAdapterConfiguration', 'addListener',
|
|
319
322
|
'emit', 'eventNames', 'getMaxListeners', 'listenerCount', 'listeners', 'off', 'on', 'once', 'prependListener',
|
|
320
323
|
'prependOnceListener', 'rawListeners', 'removeAllListeners', 'removeListener', 'setMaxListeners'];
|