@itentialopensource/adapter-nokia_altiplano 0.2.0 → 0.5.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.
@@ -3,6 +3,7 @@
3
3
  // Set globals
4
4
  /* global describe it log pronghornProps */
5
5
  /* eslint no-unused-vars: warn */
6
+ /* eslint no-underscore-dangle: warn */
6
7
 
7
8
  // include required items for testing & logging
8
9
  const assert = require('assert');
@@ -471,6 +472,7 @@ describe('[integration] Nokia_altiplano Adapter Test', () => {
471
472
  }
472
473
  }
473
474
  };
475
+
474
476
  describe('#createOnt - errors', () => {
475
477
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
476
478
  try {
@@ -496,6 +498,31 @@ describe('[integration] Nokia_altiplano Adapter Test', () => {
496
498
  }).timeout(attemptTimeout);
497
499
  });
498
500
 
501
+ describe('#createOntWithQuery - errors', () => {
502
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
503
+ try {
504
+ a.createOntWithQuery(intentCreateOntBodyParam, {}, (data, error) => {
505
+ try {
506
+ if (stub) {
507
+ const displayE = 'Error 400 received on request';
508
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
509
+ } else {
510
+ runCommonAsserts(data, error);
511
+ }
512
+ saveMockData('Intent', 'createOnt', 'default', data);
513
+ done();
514
+ } catch (err) {
515
+ log.error(`Test Failure: ${err}`);
516
+ done(err);
517
+ }
518
+ });
519
+ } catch (error) {
520
+ log.error(`Adapter Exception: ${error}`);
521
+ done(error);
522
+ }
523
+ }).timeout(attemptTimeout);
524
+ });
525
+
499
526
  const intentIntent = 'fakedata';
500
527
  describe('#dependentsSummaryFiber - errors', () => {
501
528
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
@@ -622,6 +649,56 @@ describe('[integration] Nokia_altiplano Adapter Test', () => {
622
649
  }).timeout(attemptTimeout);
623
650
  });
624
651
 
652
+ describe('#auditIbnIntent - errors', () => {
653
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
654
+ try {
655
+ a.auditIbnIntent(intentIntent, (data, error) => {
656
+ try {
657
+ if (stub) {
658
+ const displayE = 'Error 400 received on request';
659
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
660
+ } else {
661
+ runCommonAsserts(data, error);
662
+ }
663
+ saveMockData('Intent', 'auditIbnIntent', 'default', data);
664
+ done();
665
+ } catch (err) {
666
+ log.error(`Test Failure: ${err}`);
667
+ done(err);
668
+ }
669
+ });
670
+ } catch (error) {
671
+ log.error(`Adapter Exception: ${error}`);
672
+ done(error);
673
+ }
674
+ }).timeout(attemptTimeout);
675
+ });
676
+
677
+ describe('#synchronizeIbnIntent - errors', () => {
678
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
679
+ try {
680
+ a.synchronizeIbnIntent(intentIntent, (data, error) => {
681
+ try {
682
+ if (stub) {
683
+ const displayE = 'Error 400 received on request';
684
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
685
+ } else {
686
+ runCommonAsserts(data, error);
687
+ }
688
+ saveMockData('Intent', 'synchronizeIbnIntent', 'default', data);
689
+ done();
690
+ } catch (err) {
691
+ log.error(`Test Failure: ${err}`);
692
+ done(err);
693
+ }
694
+ });
695
+ } catch (error) {
696
+ log.error(`Adapter Exception: ${error}`);
697
+ done(error);
698
+ }
699
+ }).timeout(attemptTimeout);
700
+ });
701
+
625
702
  describe('#dependentsSummaryForDevice - errors', () => {
626
703
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
627
704
  try {
@@ -805,6 +882,131 @@ describe('[integration] Nokia_altiplano Adapter Test', () => {
805
882
  }).timeout(attemptTimeout);
806
883
  });
807
884
 
885
+ describe('#modifyIbnIntent - errors', () => {
886
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
887
+ try {
888
+ a.modifyIbnIntent(intentIntent, intentLockOntBodyParam, (data, error) => {
889
+ try {
890
+ if (stub) {
891
+ const displayE = 'Error 400 received on request';
892
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
893
+ } else {
894
+ runCommonAsserts(data, error);
895
+ }
896
+ saveMockData('Intent', 'modifyIbnIntent', 'default', data);
897
+ done();
898
+ } catch (err) {
899
+ log.error(`Test Failure: ${err}`);
900
+ done(err);
901
+ }
902
+ });
903
+ } catch (error) {
904
+ log.error(`Adapter Exception: ${error}`);
905
+ done(error);
906
+ }
907
+ }).timeout(attemptTimeout);
908
+ });
909
+
910
+ describe('#getIbnIntent - errors', () => {
911
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
912
+ try {
913
+ a.getIbnIntent(intentIntent, (data, error) => {
914
+ try {
915
+ if (stub) {
916
+ const displayE = 'Error 400 received on request';
917
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
918
+ } else {
919
+ runCommonAsserts(data, error);
920
+ }
921
+ saveMockData('Intent', 'getIbnIntent', 'default', data);
922
+ done();
923
+ } catch (err) {
924
+ log.error(`Test Failure: ${err}`);
925
+ done(err);
926
+ }
927
+ });
928
+ } catch (error) {
929
+ log.error(`Adapter Exception: ${error}`);
930
+ done(error);
931
+ }
932
+ }).timeout(attemptTimeout);
933
+ });
934
+
935
+ describe('#getEntityOntView - errors', () => {
936
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
937
+ try {
938
+ a.getEntityOntView('fakedata', 'fakedata', 'fakedata', null, null, (data, error) => {
939
+ try {
940
+ if (stub) {
941
+ const displayE = 'Error 400 received on request';
942
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
943
+ } else {
944
+ runCommonAsserts(data, error);
945
+ }
946
+ saveMockData('Entity', 'getEntityOntView', 'default', data);
947
+ done();
948
+ } catch (err) {
949
+ log.error(`Test Failure: ${err}`);
950
+ done(err);
951
+ }
952
+ });
953
+ } catch (error) {
954
+ log.error(`Adapter Exception: ${error}`);
955
+ done(error);
956
+ }
957
+ }).timeout(attemptTimeout);
958
+ });
959
+
960
+ describe('#getEntityOntPort - errors', () => {
961
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
962
+ try {
963
+ a.getEntityOntPort('fakedata', 'fakedata', 'fakedata', null, null, (data, error) => {
964
+ try {
965
+ if (stub) {
966
+ const displayE = 'Error 400 received on request';
967
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
968
+ } else {
969
+ runCommonAsserts(data, error);
970
+ }
971
+ saveMockData('Entity', 'getEntityOntPort', 'default', data);
972
+ done();
973
+ } catch (err) {
974
+ log.error(`Test Failure: ${err}`);
975
+ done(err);
976
+ }
977
+ });
978
+ } catch (error) {
979
+ log.error(`Adapter Exception: ${error}`);
980
+ done(error);
981
+ }
982
+ }).timeout(attemptTimeout);
983
+ });
984
+
985
+ describe('#getEntityOntVlanAssociation - errors', () => {
986
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
987
+ try {
988
+ a.getEntityOntVlanAssociation('fakedata', 'fakedata', 'fakedata', null, null, (data, error) => {
989
+ try {
990
+ if (stub) {
991
+ const displayE = 'Error 400 received on request';
992
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
993
+ } else {
994
+ runCommonAsserts(data, error);
995
+ }
996
+ saveMockData('Entity', 'getEntityOntVlanAssociation', 'default', data);
997
+ done();
998
+ } catch (err) {
999
+ log.error(`Test Failure: ${err}`);
1000
+ done(err);
1001
+ }
1002
+ });
1003
+ } catch (error) {
1004
+ log.error(`Adapter Exception: ${error}`);
1005
+ done(error);
1006
+ }
1007
+ }).timeout(attemptTimeout);
1008
+ });
1009
+
808
1010
  describe('#deletel2User - errors', () => {
809
1011
  it('should work if integrated but since no mockdata should error when run standalone', (done) => {
810
1012
  try {
@@ -854,5 +1056,30 @@ describe('[integration] Nokia_altiplano Adapter Test', () => {
854
1056
  }
855
1057
  }).timeout(attemptTimeout);
856
1058
  });
1059
+
1060
+ describe('#deleteIbnIntent - errors', () => {
1061
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
1062
+ try {
1063
+ a.deleteIbnIntent(intentIntent, (data, error) => {
1064
+ try {
1065
+ if (stub) {
1066
+ const displayE = 'Error 400 received on request';
1067
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
1068
+ } else {
1069
+ runCommonAsserts(data, error);
1070
+ }
1071
+ saveMockData('Intent', 'deleteIbnIntent', 'default', data);
1072
+ done();
1073
+ } catch (err) {
1074
+ log.error(`Test Failure: ${err}`);
1075
+ done(err);
1076
+ }
1077
+ });
1078
+ } catch (error) {
1079
+ log.error(`Adapter Exception: ${error}`);
1080
+ done(error);
1081
+ }
1082
+ }).timeout(attemptTimeout);
1083
+ });
857
1084
  });
858
1085
  });
@@ -317,8 +317,8 @@ describe('[unit] Adapter Base Test', () => {
317
317
  });
318
318
  it('should return a list of functions', (done) => {
319
319
  const returnedFunctions = ['addEntityCache', 'capabilityResults', 'checkActionFiles', 'checkProperties', 'connect', 'encryptProperty',
320
- 'entityInList', 'findPath', 'getAllCapabilities', 'getAllFunctions', 'getQueue', 'getWorkflowFunctions', 'healthCheck', 'moveEntitiesToDB',
321
- 'refreshProperties', 'runBasicGet', 'runConnectivity', 'runHealthcheck', 'suspend', 'troubleshoot', 'unsuspend', 'updateAdapterConfiguration', 'addListener',
320
+ 'entityInList', 'getAllCapabilities', 'getAllFunctions', 'healthCheck', 'iapFindAdapterPath', 'iapGetAdapterQueue', 'iapGetAdapterWorkflowFunctions', 'iapMakeBrokerCall', 'iapMoveAdapterEntitiesToDB',
321
+ 'iapRunAdapterBasicGet', 'iapRunAdapterConnectivity', 'iapRunAdapterHealthcheck', 'iapSuspendAdapter', 'iapTroubleshootAdapter', 'iapUnsuspendAdapter', 'iapUpdateAdapterConfiguration', 'refreshProperties', 'addListener',
322
322
  'emit', 'eventNames', 'getMaxListeners', 'listenerCount', 'listeners', 'off', 'on', 'once', 'prependListener',
323
323
  'prependOnceListener', 'rawListeners', 'removeAllListeners', 'removeListener', 'setMaxListeners'];
324
324
  try {
@@ -337,10 +337,10 @@ describe('[unit] Adapter Base Test', () => {
337
337
  }).timeout(attemptTimeout);
338
338
  });
339
339
 
340
- describe('#getWorkflowFunctions', () => {
341
- it('should have a getWorkflowFunctions function', (done) => {
340
+ describe('#iapGetAdapterWorkflowFunctions', () => {
341
+ it('should have a iapGetAdapterWorkflowFunctions function', (done) => {
342
342
  try {
343
- assert.equal(true, typeof a.getWorkflowFunctions === 'function');
343
+ assert.equal(true, typeof a.iapGetAdapterWorkflowFunctions === 'function');
344
344
  done();
345
345
  } catch (error) {
346
346
  log.error(`Test Failure: ${error}`);
@@ -349,7 +349,7 @@ describe('[unit] Adapter Base Test', () => {
349
349
  });
350
350
  it('should retrieve workflow functions', (done) => {
351
351
  try {
352
- const expectedFunctions = a.getWorkflowFunctions([]);
352
+ const expectedFunctions = a.iapGetAdapterWorkflowFunctions([]);
353
353
  try {
354
354
  assert.equal(0, expectedFunctions.length);
355
355
  done();
@@ -426,10 +426,10 @@ describe('[unit] Adapter Base Test', () => {
426
426
  }).timeout(attemptTimeout);
427
427
  });
428
428
 
429
- describe('#getQueue', () => {
430
- it('should have a getQueue function', (done) => {
429
+ describe('#iapGetAdapterQueue', () => {
430
+ it('should have a iapGetAdapterQueue function', (done) => {
431
431
  try {
432
- assert.equal(true, typeof a.getQueue === 'function');
432
+ assert.equal(true, typeof a.iapGetAdapterQueue === 'function');
433
433
  done();
434
434
  } catch (error) {
435
435
  log.error(`Test Failure: ${error}`);
@@ -438,7 +438,7 @@ describe('[unit] Adapter Base Test', () => {
438
438
  });
439
439
  it('should get information for all of the requests currently in the queue', (done) => {
440
440
  try {
441
- const expectedFunctions = a.getQueue();
441
+ const expectedFunctions = a.iapGetAdapterQueue();
442
442
  try {
443
443
  assert.equal(0, expectedFunctions.length);
444
444
  done();
@@ -843,12 +843,10 @@ describe('[unit] Adapter Base Test', () => {
843
843
  }).timeout(attemptTimeout);
844
844
  });
845
845
 
846
- // const returnedFunctions = ['updateAdapterConfiguration'];
847
-
848
- describe('#updateAdapterConfiguration', () => {
849
- it('should have a updateAdapterConfiguration function', (done) => {
846
+ describe('#iapUpdateAdapterConfiguration', () => {
847
+ it('should have a iapUpdateAdapterConfiguration function', (done) => {
850
848
  try {
851
- assert.equal(true, typeof a.updateAdapterConfiguration === 'function');
849
+ assert.equal(true, typeof a.iapUpdateAdapterConfiguration === 'function');
852
850
  done();
853
851
  } catch (error) {
854
852
  log.error(`Test Failure: ${error}`);
@@ -857,7 +855,7 @@ describe('[unit] Adapter Base Test', () => {
857
855
  });
858
856
  it('should return no updated if no changes are provided', (done) => {
859
857
  try {
860
- a.updateAdapterConfiguration(null, null, null, null, null, (data, error) => {
858
+ a.iapUpdateAdapterConfiguration(null, null, null, null, null, (data, error) => {
861
859
  try {
862
860
  assert.equal('No configuration updates to make', data.response);
863
861
  done();
@@ -873,10 +871,10 @@ describe('[unit] Adapter Base Test', () => {
873
871
  }).timeout(attemptTimeout);
874
872
  it('should throw an error if missing configuration file', (done) => {
875
873
  try {
876
- a.updateAdapterConfiguration(null, { name: 'fakeChange' }, null, null, null, (data, error) => {
874
+ a.iapUpdateAdapterConfiguration(null, { name: 'fakeChange' }, null, null, null, (data, error) => {
877
875
  try {
878
876
  const displayE = 'configFile is required';
879
- runErrorAsserts(data, error, 'AD.300', 'Test-Base-adapterBase-updateAdapterConfiguration', displayE);
877
+ runErrorAsserts(data, error, 'AD.300', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
880
878
  done();
881
879
  } catch (err) {
882
880
  log.error(`Test Failure: ${err}`);
@@ -890,10 +888,10 @@ describe('[unit] Adapter Base Test', () => {
890
888
  }).timeout(attemptTimeout);
891
889
  it('if not package.json, entity is required', (done) => {
892
890
  try {
893
- a.updateAdapterConfiguration('notPackage', { name: 'fakeChange' }, null, null, null, (data, error) => {
891
+ a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, null, null, null, (data, error) => {
894
892
  try {
895
893
  const displayE = 'Unsupported Configuration Change or Missing Entity';
896
- runErrorAsserts(data, error, 'AD.999', 'Test-Base-adapterBase-updateAdapterConfiguration', displayE);
894
+ runErrorAsserts(data, error, 'AD.999', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
897
895
  done();
898
896
  } catch (err) {
899
897
  log.error(`Test Failure: ${err}`);
@@ -907,10 +905,10 @@ describe('[unit] Adapter Base Test', () => {
907
905
  }).timeout(attemptTimeout);
908
906
  it('if not package.json, type is required', (done) => {
909
907
  try {
910
- a.updateAdapterConfiguration('notPackage', { name: 'fakeChange' }, 'entity', null, null, (data, error) => {
908
+ a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, 'entity', null, null, (data, error) => {
911
909
  try {
912
910
  const displayE = 'type is required';
913
- runErrorAsserts(data, error, 'AD.300', 'Test-Base-adapterBase-updateAdapterConfiguration', displayE);
911
+ runErrorAsserts(data, error, 'AD.300', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
914
912
  done();
915
913
  } catch (err) {
916
914
  log.error(`Test Failure: ${err}`);
@@ -924,10 +922,10 @@ describe('[unit] Adapter Base Test', () => {
924
922
  }).timeout(attemptTimeout);
925
923
  it('if not package.json, entity must be valid', (done) => {
926
924
  try {
927
- a.updateAdapterConfiguration('notPackage', { name: 'fakeChange' }, 'fakeEntity', 'fakeType', null, (data, error) => {
925
+ a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, 'fakeEntity', 'fakeType', null, (data, error) => {
928
926
  try {
929
927
  const displayE = 'Incomplete Configuration Change: Invalid Entity - fakeEntity';
930
- runErrorAsserts(data, error, 'AD.999', 'Test-Base-adapterBase-updateAdapterConfiguration', displayE);
928
+ runErrorAsserts(data, error, 'AD.999', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
931
929
  done();
932
930
  } catch (err) {
933
931
  log.error(`Test Failure: ${err}`);