@itentialopensource/adapter-paragon_pathfinder 1.2.7 → 1.3.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 (51) hide show
  1. package/.eslintignore +0 -1
  2. package/.jshintrc +3 -0
  3. package/CALLS.md +173 -211
  4. package/CHANGELOG.md +16 -0
  5. package/CONTRIBUTING.md +1 -160
  6. package/ENHANCE.md +2 -2
  7. package/README.md +31 -22
  8. package/adapter.js +581 -334
  9. package/adapterBase.js +538 -873
  10. package/changelogs/changelog.md +96 -0
  11. package/entities/Config/schema.json +1 -1
  12. package/entities/Netconf/schema.json +1 -1
  13. package/entities/Scheduler/schema.json +1 -1
  14. package/entities/Topology/action.json +102 -0
  15. package/entities/Topology/schema.json +7 -2
  16. package/entities/TransportControllerGroups/schema.json +1 -1
  17. package/entities/TransportControllers/schema.json +1 -1
  18. package/metadata.json +47 -0
  19. package/package.json +22 -25
  20. package/pronghorn.json +2139 -281
  21. package/propertiesSchema.json +451 -39
  22. package/refs?service=git-upload-pack +0 -0
  23. package/report/adapter-openapi.json +69945 -0
  24. package/report/adapter-openapi.yaml +74294 -0
  25. package/report/adapterInfo.json +8 -8
  26. package/report/update-pathfinder-api-v2.json +31139 -0
  27. package/report/updateReport1691507543487.json +120 -0
  28. package/report/updateReport1692202561721.json +120 -0
  29. package/report/updateReport1694461665971.json +120 -0
  30. package/report/updateReport1698420920735.json +120 -0
  31. package/sampleProperties.json +63 -2
  32. package/test/integration/adapterTestBasicGet.js +1 -1
  33. package/test/integration/adapterTestConnectivity.js +91 -42
  34. package/test/integration/adapterTestIntegration.js +583 -2
  35. package/test/unit/adapterBaseTestUnit.js +388 -315
  36. package/test/unit/adapterTestUnit.js +468 -109
  37. package/utils/adapterInfo.js +1 -1
  38. package/utils/addAuth.js +1 -1
  39. package/utils/artifactize.js +1 -1
  40. package/utils/checkMigrate.js +1 -1
  41. package/utils/entitiesToDB.js +1 -0
  42. package/utils/findPath.js +1 -1
  43. package/utils/methodDocumentor.js +71 -23
  44. package/utils/modify.js +13 -15
  45. package/utils/packModificationScript.js +1 -1
  46. package/utils/taskMover.js +309 -0
  47. package/utils/tbScript.js +3 -10
  48. package/utils/tbUtils.js +2 -3
  49. package/utils/testRunner.js +1 -1
  50. package/utils/troubleshootingAdapter.js +1 -3
  51. package/workflows/README.md +0 -3
@@ -9,13 +9,13 @@
9
9
  // include required items for testing & logging
10
10
  const assert = require('assert');
11
11
  const fs = require('fs');
12
- const mocha = require('mocha');
13
12
  const path = require('path');
13
+ const util = require('util');
14
+ const mocha = require('mocha');
14
15
  const winston = require('winston');
15
16
  const { expect } = require('chai');
16
17
  const { use } = require('chai');
17
18
  const td = require('testdouble');
18
- const util = require('util');
19
19
 
20
20
  const anything = td.matchers.anything();
21
21
 
@@ -335,6 +335,134 @@ describe('[integration] Paragon_pathfinder Adapter Test', () => {
335
335
  }).timeout(attemptTimeout);
336
336
  });
337
337
 
338
+ // broker tests
339
+ describe('#getDevicesFiltered - errors', () => {
340
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
341
+ try {
342
+ const opts = {
343
+ filter: {
344
+ name: 'deviceName'
345
+ }
346
+ };
347
+ a.getDevicesFiltered(opts, (data, error) => {
348
+ try {
349
+ if (stub) {
350
+ if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
351
+ assert.equal(null, error);
352
+ assert.notEqual(undefined, data);
353
+ assert.notEqual(null, data);
354
+ assert.equal(0, data.total);
355
+ assert.equal(0, data.list.length);
356
+ } else {
357
+ const displayE = 'Error 400 received on request';
358
+ runErrorAsserts(data, error, 'AD.500', 'Test-paragon_pathfinder-connectorRest-handleEndResponse', displayE);
359
+ }
360
+ } else {
361
+ runCommonAsserts(data, error);
362
+ }
363
+ done();
364
+ } catch (err) {
365
+ log.error(`Test Failure: ${err}`);
366
+ done(err);
367
+ }
368
+ });
369
+ } catch (error) {
370
+ log.error(`Adapter Exception: ${error}`);
371
+ done(error);
372
+ }
373
+ }).timeout(attemptTimeout);
374
+ });
375
+
376
+ describe('#iapGetDeviceCount - errors', () => {
377
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
378
+ try {
379
+ const opts = {
380
+ filter: {
381
+ name: 'deviceName'
382
+ }
383
+ };
384
+ a.iapGetDeviceCount((data, error) => {
385
+ try {
386
+ if (stub) {
387
+ if (samProps.devicebroker.getDevicesFiltered[0].handleFailure === 'ignore') {
388
+ assert.equal(null, error);
389
+ assert.notEqual(undefined, data);
390
+ assert.notEqual(null, data);
391
+ assert.equal(0, data.count);
392
+ } else {
393
+ const displayE = 'Error 400 received on request';
394
+ runErrorAsserts(data, error, 'AD.500', 'Test-paragon_pathfinder-connectorRest-handleEndResponse', displayE);
395
+ }
396
+ } else {
397
+ runCommonAsserts(data, error);
398
+ }
399
+ done();
400
+ } catch (err) {
401
+ log.error(`Test Failure: ${err}`);
402
+ done(err);
403
+ }
404
+ });
405
+ } catch (error) {
406
+ log.error(`Adapter Exception: ${error}`);
407
+ done(error);
408
+ }
409
+ }).timeout(attemptTimeout);
410
+ });
411
+
412
+ // exposed cache tests
413
+ describe('#iapPopulateEntityCache - errors', () => {
414
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
415
+ try {
416
+ a.iapPopulateEntityCache('Device', (data, error) => {
417
+ try {
418
+ if (stub) {
419
+ assert.equal(null, data);
420
+ assert.notEqual(undefined, error);
421
+ assert.notEqual(null, error);
422
+ done();
423
+ } else {
424
+ assert.equal(undefined, error);
425
+ assert.equal('success', data[0]);
426
+ done();
427
+ }
428
+ } catch (err) {
429
+ log.error(`Test Failure: ${err}`);
430
+ done(err);
431
+ }
432
+ });
433
+ } catch (error) {
434
+ log.error(`Adapter Exception: ${error}`);
435
+ done(error);
436
+ }
437
+ }).timeout(attemptTimeout);
438
+ });
439
+
440
+ describe('#iapRetrieveEntitiesCache - errors', () => {
441
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
442
+ try {
443
+ a.iapRetrieveEntitiesCache('Device', {}, (data, error) => {
444
+ try {
445
+ if (stub) {
446
+ assert.equal(null, data);
447
+ assert.notEqual(null, error);
448
+ assert.notEqual(undefined, error);
449
+ } else {
450
+ assert.equal(undefined, error);
451
+ assert.notEqual(null, data);
452
+ assert.notEqual(undefined, data);
453
+ }
454
+ done();
455
+ } catch (err) {
456
+ log.error(`Test Failure: ${err}`);
457
+ done(err);
458
+ }
459
+ });
460
+ } catch (error) {
461
+ log.error(`Adapter Exception: ${error}`);
462
+ done(error);
463
+ }
464
+ }).timeout(attemptTimeout);
465
+ });
338
466
  /*
339
467
  -----------------------------------------------------------------------
340
468
  -----------------------------------------------------------------------
@@ -7310,5 +7438,458 @@ describe('[integration] Paragon_pathfinder Adapter Test', () => {
7310
7438
  }
7311
7439
  }).timeout(attemptTimeout);
7312
7440
  });
7441
+
7442
+ describe('#getTopologyV2TopologyIdIpePolicy - errors', () => {
7443
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
7444
+ try {
7445
+ a.getTopologyV2TopologyIdIpePolicy(555, (data, error) => {
7446
+ try {
7447
+ if (stub) {
7448
+ const displayE = 'Error 400 received on request';
7449
+ runErrorAsserts(data, error, 'AD.500', 'Test-paragon_pathfinder-connectorRest-handleEndResponse', displayE);
7450
+ } else {
7451
+ runCommonAsserts(data, error);
7452
+ }
7453
+ saveMockData('Topology', 'getTopologyV2TopologyIdIpePolicy', 'default', data);
7454
+ done();
7455
+ } catch (err) {
7456
+ log.error(`Test Failure: ${err}`);
7457
+ done(err);
7458
+ }
7459
+ });
7460
+ } catch (error) {
7461
+ log.error(`Adapter Exception: ${error}`);
7462
+ done(error);
7463
+ }
7464
+ }).timeout(attemptTimeout);
7465
+ });
7466
+
7467
+ const topologyPostTopologyV2TopologyIdIpePolicyBodyParam = [
7468
+ {}
7469
+ ];
7470
+ describe('#postTopologyV2TopologyIdIpePolicy - errors', () => {
7471
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
7472
+ try {
7473
+ a.postTopologyV2TopologyIdIpePolicy(555, topologyPostTopologyV2TopologyIdIpePolicyBodyParam, (data, error) => {
7474
+ try {
7475
+ if (stub) {
7476
+ const displayE = 'Error 400 received on request';
7477
+ runErrorAsserts(data, error, 'AD.500', 'Test-paragon_pathfinder-connectorRest-handleEndResponse', displayE);
7478
+ } else {
7479
+ runCommonAsserts(data, error);
7480
+ }
7481
+ saveMockData('Topology', 'postTopologyV2TopologyIdIpePolicy', 'default', data);
7482
+ done();
7483
+ } catch (err) {
7484
+ log.error(`Test Failure: ${err}`);
7485
+ done(err);
7486
+ }
7487
+ });
7488
+ } catch (error) {
7489
+ log.error(`Adapter Exception: ${error}`);
7490
+ done(error);
7491
+ }
7492
+ }).timeout(attemptTimeout);
7493
+ });
7494
+
7495
+ const topologyPutTopologyV2TopologyIdIpePolicyBodyParam = [
7496
+ {
7497
+ asPath: {
7498
+ regex: 'string'
7499
+ },
7500
+ id: 9,
7501
+ med: 6,
7502
+ neighbor: null,
7503
+ node: {
7504
+ AutonomousSystem: {
7505
+ asNumber: null
7506
+ },
7507
+ activeAssurance: {
7508
+ agentPath: 'string'
7509
+ },
7510
+ comment: 'string',
7511
+ configurationDataSource: {
7512
+ latest: {
7513
+ href: 'string',
7514
+ rel: 'string',
7515
+ schema: null,
7516
+ type: 'string'
7517
+ }
7518
+ },
7519
+ design: {
7520
+ delay: 7,
7521
+ simulation: {
7522
+ canFail: true
7523
+ },
7524
+ trafficRerouteThreshold: 4,
7525
+ userCost: 1
7526
+ },
7527
+ deviceUuid: 'string',
7528
+ epeProperties: {
7529
+ bandwidth: 4,
7530
+ externalRates: [
7531
+ null,
7532
+ null,
7533
+ null,
7534
+ null
7535
+ ],
7536
+ internalRate: 6,
7537
+ peeringRatePlan: [
7538
+ {
7539
+ bound: 9,
7540
+ rate: 8
7541
+ }
7542
+ ]
7543
+ },
7544
+ extraIpAddresses: [
7545
+ null
7546
+ ],
7547
+ hostName: 'string',
7548
+ id: 'string',
7549
+ layer: 'string',
7550
+ live: false,
7551
+ logicalSystemParent: 'string',
7552
+ name: 'string',
7553
+ nodeIndex: 5,
7554
+ nodeType: 'string',
7555
+ prefixes: [
7556
+ {
7557
+ SR: {
7558
+ algo: 3,
7559
+ flags: 4,
7560
+ index: 1
7561
+ },
7562
+ SRv6: {
7563
+ algo: 1,
7564
+ flags: 2,
7565
+ metric: 3
7566
+ },
7567
+ role: 'string'
7568
+ },
7569
+ {
7570
+ SR: {
7571
+ algo: 2,
7572
+ flags: 10,
7573
+ index: 9
7574
+ },
7575
+ SRv6: {
7576
+ algo: 3,
7577
+ flags: 2,
7578
+ metric: 5
7579
+ },
7580
+ role: 'string'
7581
+ },
7582
+ {
7583
+ SR: {
7584
+ algo: 10,
7585
+ flags: 6,
7586
+ index: 3
7587
+ },
7588
+ SRv6: {
7589
+ algo: 7,
7590
+ flags: 10,
7591
+ metric: 9
7592
+ },
7593
+ role: 'string'
7594
+ },
7595
+ {
7596
+ SR: {
7597
+ algo: 6,
7598
+ flags: 1,
7599
+ index: 8
7600
+ },
7601
+ SRv6: {
7602
+ algo: 3,
7603
+ flags: 3,
7604
+ metric: 6
7605
+ },
7606
+ role: 'string'
7607
+ },
7608
+ {
7609
+ SR: {
7610
+ algo: 5,
7611
+ flags: 1,
7612
+ index: 7
7613
+ },
7614
+ SRv6: {
7615
+ algo: 5,
7616
+ flags: 4,
7617
+ metric: 9
7618
+ },
7619
+ role: 'string'
7620
+ },
7621
+ {
7622
+ SR: {
7623
+ algo: 6,
7624
+ flags: 10,
7625
+ index: 9
7626
+ },
7627
+ SRv6: {
7628
+ algo: 9,
7629
+ flags: 3,
7630
+ metric: 3
7631
+ },
7632
+ role: 'string'
7633
+ }
7634
+ ],
7635
+ protocols: {
7636
+ BGP: {
7637
+ AutonomousSystem: {
7638
+ asNumber: null
7639
+ },
7640
+ id: 'string'
7641
+ },
7642
+ ISIS: {
7643
+ TERouterId: 'string',
7644
+ TERouterIdIPv6: 'string',
7645
+ area: 'string',
7646
+ isoAddress: 'string',
7647
+ overloadBit: true,
7648
+ routerId: 'string',
7649
+ routerIdIPv6: 'string'
7650
+ },
7651
+ NETCONF: {
7652
+ clientAddress: null,
7653
+ clientCapabilities: [
7654
+ 'string',
7655
+ 'string',
7656
+ 'string',
7657
+ 'string',
7658
+ 'string',
7659
+ 'string',
7660
+ 'string',
7661
+ 'string'
7662
+ ],
7663
+ operationalState: 'Invalid_credentials',
7664
+ operationalStatus: 'Up',
7665
+ sessionParameters: {
7666
+ keepalive: 10
7667
+ }
7668
+ },
7669
+ OSPF: {
7670
+ TERouterId: 'string',
7671
+ TERouterIdIPv6: 'string',
7672
+ overloadBit: true,
7673
+ referenceBw: 1,
7674
+ routerId: 'string',
7675
+ routerIdIPv6: 'string'
7676
+ },
7677
+ PCEP: {
7678
+ extensions: {
7679
+ 'lsp-association-protection': true
7680
+ },
7681
+ operationalStatus: 'Empty',
7682
+ pccAddress: null,
7683
+ peerStatefullCapabilities: {
7684
+ SRCapability: false,
7685
+ SRv6Capability: true,
7686
+ lspInstantiation: false,
7687
+ lspUpdate: true,
7688
+ p2mp: true,
7689
+ p2mpInstantiation: false,
7690
+ p2mpUpdate: false
7691
+ },
7692
+ sessionParameters: {
7693
+ deadtimer: 7,
7694
+ keepalive: 8,
7695
+ maximumStackDepth: 5
7696
+ }
7697
+ },
7698
+ SR: {
7699
+ SRGBs: [
7700
+ {
7701
+ range: 10,
7702
+ start: 6
7703
+ },
7704
+ {
7705
+ range: 2,
7706
+ start: 8
7707
+ },
7708
+ {
7709
+ range: 8,
7710
+ start: 1
7711
+ }
7712
+ ],
7713
+ capabilities: {
7714
+ unrestrictedFirstHop: true
7715
+ },
7716
+ enabled: false,
7717
+ nodeCapabilities: 10
7718
+ },
7719
+ SRv6: {
7720
+ enabled: false,
7721
+ msdType: {
7722
+ baseMplsImposition: 4,
7723
+ erld: 10,
7724
+ srhMaxEndD: 9,
7725
+ srhMaxEndPop: 6,
7726
+ srhMaxHEncaps: 9,
7727
+ srhMaxLs: 2
7728
+ },
7729
+ nodeCapabilities: 3
7730
+ },
7731
+ management: {
7732
+ address: null,
7733
+ operatingSystem: 'string',
7734
+ operatingSystemVersion: 'string',
7735
+ vendor: 'string'
7736
+ }
7737
+ },
7738
+ pseudoNode: true,
7739
+ routerId: 'string',
7740
+ routerIdIPv6: 'string',
7741
+ site: 'string',
7742
+ slices: [
7743
+ {
7744
+ sliceId: 7
7745
+ },
7746
+ {
7747
+ sliceId: 5
7748
+ },
7749
+ {
7750
+ sliceId: 5
7751
+ },
7752
+ {
7753
+ sliceId: 4
7754
+ },
7755
+ {
7756
+ sliceId: 8
7757
+ },
7758
+ {
7759
+ sliceId: 4
7760
+ },
7761
+ {
7762
+ sliceId: 7
7763
+ },
7764
+ {
7765
+ sliceId: 1
7766
+ },
7767
+ {
7768
+ sliceId: 4
7769
+ }
7770
+ ],
7771
+ switchingCapabilities: [
7772
+ {
7773
+ encoding: 'lsp-encoding-oduk',
7774
+ switchingCapability: 'switching-l2sc'
7775
+ },
7776
+ {
7777
+ encoding: 'lsp-encoding-lambda',
7778
+ switchingCapability: 'switching-tdm'
7779
+ },
7780
+ {
7781
+ encoding: 'lsp-encoding-line',
7782
+ switchingCapability: 'switching-psc1'
7783
+ },
7784
+ {
7785
+ encoding: 'lsp-encoding-digital-wrapper',
7786
+ switchingCapability: 'switching-packet'
7787
+ },
7788
+ {
7789
+ encoding: 'lsp-encoding-pdh',
7790
+ switchingCapability: 'switching-evpl'
7791
+ },
7792
+ {
7793
+ encoding: 'lsp-encoding-pdh',
7794
+ switchingCapability: 'switching-evpl'
7795
+ }
7796
+ ],
7797
+ topoObjectType: 'node',
7798
+ topology: {
7799
+ coordinates: {
7800
+ bbox: [
7801
+ 5,
7802
+ 9,
7803
+ 6,
7804
+ 6,
7805
+ 1
7806
+ ],
7807
+ crs: {
7808
+ properties: {},
7809
+ type: 'string'
7810
+ }
7811
+ }
7812
+ },
7813
+ topologyIndex: 1,
7814
+ userProperties: {}
7815
+ },
7816
+ prefix: null,
7817
+ priority: 7
7818
+ }
7819
+ ];
7820
+ describe('#putTopologyV2TopologyIdIpePolicy - errors', () => {
7821
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
7822
+ try {
7823
+ a.putTopologyV2TopologyIdIpePolicy(555, topologyPutTopologyV2TopologyIdIpePolicyBodyParam, (data, error) => {
7824
+ try {
7825
+ if (stub) {
7826
+ const displayE = 'Error 400 received on request';
7827
+ runErrorAsserts(data, error, 'AD.500', 'Test-paragon_pathfinder-connectorRest-handleEndResponse', displayE);
7828
+ } else {
7829
+ runCommonAsserts(data, error);
7830
+ }
7831
+ saveMockData('Topology', 'putTopologyV2TopologyIdIpePolicy', 'default', data);
7832
+ done();
7833
+ } catch (err) {
7834
+ log.error(`Test Failure: ${err}`);
7835
+ done(err);
7836
+ }
7837
+ });
7838
+ } catch (error) {
7839
+ log.error(`Adapter Exception: ${error}`);
7840
+ done(error);
7841
+ }
7842
+ }).timeout(attemptTimeout);
7843
+ });
7844
+
7845
+ describe('#deleteTopologyV2TopologyIdIpePolicy - errors', () => {
7846
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
7847
+ try {
7848
+ a.deleteTopologyV2TopologyIdIpePolicy(555, (data, error) => {
7849
+ try {
7850
+ if (stub) {
7851
+ const displayE = 'Error 400 received on request';
7852
+ runErrorAsserts(data, error, 'AD.500', 'Test-paragon_pathfinder-connectorRest-handleEndResponse', displayE);
7853
+ } else {
7854
+ runCommonAsserts(data, error);
7855
+ }
7856
+ saveMockData('Topology', 'deleteTopologyV2TopologyIdIpePolicy', 'default', data);
7857
+ done();
7858
+ } catch (err) {
7859
+ log.error(`Test Failure: ${err}`);
7860
+ done(err);
7861
+ }
7862
+ });
7863
+ } catch (error) {
7864
+ log.error(`Adapter Exception: ${error}`);
7865
+ done(error);
7866
+ }
7867
+ }).timeout(attemptTimeout);
7868
+ });
7869
+
7870
+ describe('#getTopologyV2TopologyIdIpePolicyIpePolicyId - errors', () => {
7871
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
7872
+ try {
7873
+ a.getTopologyV2TopologyIdIpePolicyIpePolicyId(555, 555, (data, error) => {
7874
+ try {
7875
+ if (stub) {
7876
+ const displayE = 'Error 400 received on request';
7877
+ runErrorAsserts(data, error, 'AD.500', 'Test-paragon_pathfinder-connectorRest-handleEndResponse', displayE);
7878
+ } else {
7879
+ runCommonAsserts(data, error);
7880
+ }
7881
+ saveMockData('Topology', 'getTopologyV2TopologyIdIpePolicyIpePolicyId', 'default', data);
7882
+ done();
7883
+ } catch (err) {
7884
+ log.error(`Test Failure: ${err}`);
7885
+ done(err);
7886
+ }
7887
+ });
7888
+ } catch (error) {
7889
+ log.error(`Adapter Exception: ${error}`);
7890
+ done(error);
7891
+ }
7892
+ }).timeout(attemptTimeout);
7893
+ });
7313
7894
  });
7314
7895
  });