@itentialopensource/adapter-dna_center 0.5.6 → 0.5.7

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.
@@ -0,0 +1,14 @@
1
+ [
2
+ {
3
+ "type": "encryption",
4
+ "pointer": "/authentication/password"
5
+ },
6
+ {
7
+ "type": "encryption",
8
+ "pointer": "/authentication/token"
9
+ },
10
+ {
11
+ "type": "encryption",
12
+ "pointer": "/mongo/password"
13
+ }
14
+ ]
@@ -93,6 +93,9 @@
93
93
  },
94
94
  "mongo": {
95
95
  "$ref": "#/definitions/mongo"
96
+ },
97
+ "devicebroker": {
98
+ "$ref": "#/definitions/devicebroker"
96
99
  }
97
100
  },
98
101
  "required": [
@@ -232,6 +235,21 @@
232
235
  "type": "boolean",
233
236
  "description": "This property turns on logging of Authentication Information and should only be true when debugging authentication and connectivity",
234
237
  "default": false
238
+ },
239
+ "client_id": {
240
+ "type": "string",
241
+ "description": "The client id for OAuth requests - can also use username depending on schema",
242
+ "default": ""
243
+ },
244
+ "client_secret": {
245
+ "type": "string",
246
+ "description": "The client secret for OAuth requests - can also use password depending on schema",
247
+ "default": ""
248
+ },
249
+ "grant_type": {
250
+ "type": "string",
251
+ "description": "The grant type for OAuth requests - can also provide in schema",
252
+ "default": ""
235
253
  }
236
254
  },
237
255
  "required": [
@@ -820,6 +838,370 @@
820
838
  }
821
839
  }
822
840
  }
841
+ },
842
+ "devicebroker": {
843
+ "type": "object",
844
+ "properties": {
845
+ "getDevice": {
846
+ "type": "array",
847
+ "description": "Broker call(s) to getDevice",
848
+ "items": {
849
+ "properties": {
850
+ "path": {
851
+ "type": "string",
852
+ "description": "The fully qualified path of the call to getDevice (e.g. /rest/api/device/{deviceid})",
853
+ "default": ""
854
+ },
855
+ "method": {
856
+ "type": "string",
857
+ "description": "The method of the call to getDevice",
858
+ "default": "GET"
859
+ },
860
+ "query": {
861
+ "type": "object",
862
+ "description": "The json object with query parameters of the call to getDevice",
863
+ "additionalProperties": {
864
+ "type": "string"
865
+ }
866
+ },
867
+ "body": {
868
+ "type": "object",
869
+ "description": "The json object with body of the call to getDevice",
870
+ "additionalProperties": {
871
+ "type": "string"
872
+ }
873
+ },
874
+ "headers": {
875
+ "type": "object",
876
+ "description": "The json object with headers of the call to getDevice",
877
+ "additionalProperties": {
878
+ "type": "string"
879
+ }
880
+ },
881
+ "handleFailure": {
882
+ "type": "string",
883
+ "enum": [
884
+ "ignore",
885
+ "fail"
886
+ ],
887
+ "description": "return failure or ignore failure",
888
+ "default": "ignore"
889
+ },
890
+ "requestFields": {
891
+ "type": "object",
892
+ "description": "The json object with response fields of the call to getDevice",
893
+ "additionalProperties": {
894
+ "type": "string"
895
+ },
896
+ "properties": {}
897
+ },
898
+ "responseFields": {
899
+ "type": "object",
900
+ "description": "The json object with response fields of the call to getDevice",
901
+ "additionalProperties": {
902
+ "type": "string"
903
+ },
904
+ "properties": {
905
+ "name": {
906
+ "type": "string",
907
+ "description": "The field in response to getDevice that contains the name of the device",
908
+ "default": "name"
909
+ },
910
+ "ostype": {
911
+ "type": "string",
912
+ "description": "The field in response to getDevice that contains the ostype of the device",
913
+ "default": "ostype"
914
+ },
915
+ "ostypePrefix": {
916
+ "type": "string",
917
+ "description": "Any prefix that should be added to the ostype of the device (e.g. aws-)",
918
+ "default": ""
919
+ },
920
+ "port": {
921
+ "type": "string",
922
+ "description": "The field in response to getDevice that contains the port of the device",
923
+ "default": ""
924
+ },
925
+ "ip": {
926
+ "type": "string",
927
+ "description": "The field in response to getDevice that contains the ip address of the device",
928
+ "default": ""
929
+ }
930
+ }
931
+ }
932
+ }
933
+ }
934
+ },
935
+ "getDevicesFiltered": {
936
+ "type": "array",
937
+ "description": "Broker call(s) to getDevicesFiltered",
938
+ "items": {
939
+ "properties": {
940
+ "path": {
941
+ "type": "string",
942
+ "description": "The fully qualified path of the call to getDevicesFiltered (e.g. /rest/api/device/{deviceid})",
943
+ "default": ""
944
+ },
945
+ "method": {
946
+ "type": "string",
947
+ "description": "The method of the call to getDevicesFiltered",
948
+ "default": "GET"
949
+ },
950
+ "query": {
951
+ "type": "object",
952
+ "description": "The json object with query parameters of the call to getDevicesFiltered",
953
+ "additionalProperties": {
954
+ "type": "string"
955
+ }
956
+ },
957
+ "body": {
958
+ "type": "object",
959
+ "description": "The json object with body of the call to getDevicesFiltered",
960
+ "additionalProperties": {
961
+ "type": "string"
962
+ }
963
+ },
964
+ "headers": {
965
+ "type": "object",
966
+ "description": "The json object with headers of the call to getDevicesFiltered",
967
+ "additionalProperties": {
968
+ "type": "string"
969
+ }
970
+ },
971
+ "handleFailure": {
972
+ "type": "string",
973
+ "enum": [
974
+ "ignore",
975
+ "fail"
976
+ ],
977
+ "description": "return failure or ignore failure",
978
+ "default": "ignore"
979
+ },
980
+ "responseFields": {
981
+ "type": "object",
982
+ "description": "The json object with response fields of the call to getDevicesFiltered",
983
+ "additionalProperties": {
984
+ "type": "string"
985
+ },
986
+ "properties": {
987
+ "name": {
988
+ "type": "string",
989
+ "description": "The field in response to getDevicesFiltered that contains the name of the device",
990
+ "default": "name"
991
+ },
992
+ "ostype": {
993
+ "type": "string",
994
+ "description": "The field in response to getDevicesFiltered that contains the ostype of the device",
995
+ "default": "ostype"
996
+ },
997
+ "ostypePrefix": {
998
+ "type": "string",
999
+ "description": "Any prefix that should be added to the ostype of the device (e.g. aws-)",
1000
+ "default": ""
1001
+ },
1002
+ "port_field": {
1003
+ "type": "string",
1004
+ "description": "The field in response to getDevicesFiltered that contains the port of the device",
1005
+ "default": ""
1006
+ },
1007
+ "ip_field": {
1008
+ "type": "string",
1009
+ "description": "The field in response to getDevicesFiltered that contains the ip address of the device",
1010
+ "default": ""
1011
+ }
1012
+ }
1013
+ }
1014
+ }
1015
+ }
1016
+ },
1017
+ "isAlive": {
1018
+ "type": "array",
1019
+ "description": "Broker call(s) to determine if the device isAlive",
1020
+ "items": {
1021
+ "properties": {
1022
+ "path": {
1023
+ "type": "string",
1024
+ "description": "The fully qualified path of the call to isAlive (e.g. /rest/api/device/{deviceid})",
1025
+ "default": ""
1026
+ },
1027
+ "method": {
1028
+ "type": "string",
1029
+ "description": "The method of the call to isAlive",
1030
+ "default": "GET"
1031
+ },
1032
+ "query": {
1033
+ "type": "object",
1034
+ "description": "The json object with query parameters of the call to isAlive",
1035
+ "additionalProperties": {
1036
+ "type": "string"
1037
+ }
1038
+ },
1039
+ "body": {
1040
+ "type": "object",
1041
+ "description": "The json object with body of the call to isAlive",
1042
+ "additionalProperties": {
1043
+ "type": "string"
1044
+ }
1045
+ },
1046
+ "headers": {
1047
+ "type": "object",
1048
+ "description": "The json object with headers of the call to isAlive",
1049
+ "additionalProperties": {
1050
+ "type": "string"
1051
+ }
1052
+ },
1053
+ "handleFailure": {
1054
+ "type": "string",
1055
+ "enum": [
1056
+ "ignore",
1057
+ "fail"
1058
+ ],
1059
+ "description": "return failure or ignore isAlive",
1060
+ "default": "ignore"
1061
+ },
1062
+ "statusValue": {
1063
+ "type": "string",
1064
+ "description": "The expected value in the status field",
1065
+ "default": "true"
1066
+ },
1067
+ "requestFields": {
1068
+ "type": "object",
1069
+ "description": "The json object with response fields of the call to getDevice",
1070
+ "additionalProperties": {
1071
+ "type": "string"
1072
+ },
1073
+ "properties": {}
1074
+ },
1075
+ "responseFields": {
1076
+ "type": "object",
1077
+ "description": "The json object with response fields of the call to isAlive",
1078
+ "additionalProperties": {
1079
+ "type": "string"
1080
+ },
1081
+ "properties": {
1082
+ "status": {
1083
+ "type": "string",
1084
+ "description": "The field in response to isAlive that contains the status of the device",
1085
+ "default": "name"
1086
+ }
1087
+ }
1088
+ }
1089
+ }
1090
+ }
1091
+ },
1092
+ "getConfig": {
1093
+ "type": "array",
1094
+ "description": "Broker call(s) to getConfig",
1095
+ "items": {
1096
+ "properties": {
1097
+ "path": {
1098
+ "type": "string",
1099
+ "description": "The fully qualified path of the call to getConfig (e.g. /rest/api/device/{deviceid})",
1100
+ "default": ""
1101
+ },
1102
+ "method": {
1103
+ "type": "string",
1104
+ "description": "The method of the call to getConfig",
1105
+ "default": "GET"
1106
+ },
1107
+ "query": {
1108
+ "type": "object",
1109
+ "description": "The json object with query parameters of the call to getConfig",
1110
+ "additionalProperties": {
1111
+ "type": "string"
1112
+ }
1113
+ },
1114
+ "body": {
1115
+ "type": "object",
1116
+ "description": "The json object with body of the call to getConfig",
1117
+ "additionalProperties": {
1118
+ "type": "string"
1119
+ }
1120
+ },
1121
+ "headers": {
1122
+ "type": "object",
1123
+ "description": "The json object with headers of the call to getConfig",
1124
+ "additionalProperties": {
1125
+ "type": "string"
1126
+ }
1127
+ },
1128
+ "handleFailure": {
1129
+ "type": "string",
1130
+ "enum": [
1131
+ "ignore",
1132
+ "fail"
1133
+ ],
1134
+ "description": "return failure or ignore getConfig",
1135
+ "default": "ignore"
1136
+ },
1137
+ "requestFields": {
1138
+ "type": "object",
1139
+ "description": "The json object with response fields of the call to getDevice",
1140
+ "additionalProperties": {
1141
+ "type": "string"
1142
+ },
1143
+ "properties": {}
1144
+ },
1145
+ "responseFields": {
1146
+ "type": "object",
1147
+ "description": "The json object with response fields of the call to getConfig",
1148
+ "additionalProperties": {
1149
+ "type": "string"
1150
+ },
1151
+ "properties": {}
1152
+ }
1153
+ }
1154
+ }
1155
+ },
1156
+ "getCount": {
1157
+ "type": "array",
1158
+ "description": "Broker call(s) to getCount",
1159
+ "items": {
1160
+ "properties": {
1161
+ "path": {
1162
+ "type": "string",
1163
+ "description": "The fully qualified path of the call to getCount (e.g. /rest/api/device/{deviceid})",
1164
+ "default": ""
1165
+ },
1166
+ "method": {
1167
+ "type": "string",
1168
+ "description": "The method of the call to getCount",
1169
+ "default": "GET"
1170
+ },
1171
+ "query": {
1172
+ "type": "object",
1173
+ "description": "The json object with query parameters of the call to getCount",
1174
+ "additionalProperties": {
1175
+ "type": "string"
1176
+ }
1177
+ },
1178
+ "body": {
1179
+ "type": "object",
1180
+ "description": "The json object with body of the call to getCount",
1181
+ "additionalProperties": {
1182
+ "type": "string"
1183
+ }
1184
+ },
1185
+ "headers": {
1186
+ "type": "object",
1187
+ "description": "The json object with headers of the call to getCount",
1188
+ "additionalProperties": {
1189
+ "type": "string"
1190
+ }
1191
+ },
1192
+ "handleFailure": {
1193
+ "type": "string",
1194
+ "enum": [
1195
+ "ignore",
1196
+ "fail"
1197
+ ],
1198
+ "description": "return failure or ignore getCount",
1199
+ "default": "ignore"
1200
+ }
1201
+ }
1202
+ }
1203
+ }
1204
+ }
823
1205
  }
824
1206
  }
825
1207
  }
Binary file
@@ -0,0 +1,114 @@
1
+ {
2
+ "errors": [
3
+ {
4
+ "propertiesSchemaJson": "propertiesSchema.json owner reporting - Create propertiesSchema caught: TypeError: Cannot read property 'properties' of undefined"
5
+ }
6
+ ],
7
+ "statistics": [
8
+ {
9
+ "owner": "errorJson",
10
+ "description": "New adapter errors available for use",
11
+ "value": 0
12
+ },
13
+ {
14
+ "owner": "errorJson",
15
+ "description": "Adapter errors no longer available for use",
16
+ "value": 0
17
+ },
18
+ {
19
+ "owner": "errorJson",
20
+ "description": "Adapter errors that have been updated (e.g. recommendation changes)",
21
+ "value": 31
22
+ },
23
+ {
24
+ "owner": "packageJson",
25
+ "description": "Number of production dependencies",
26
+ "value": 13
27
+ },
28
+ {
29
+ "owner": "packageJson",
30
+ "description": "Number of development dependencies",
31
+ "value": 7
32
+ },
33
+ {
34
+ "owner": "packageJson",
35
+ "description": "Number of npm scripts",
36
+ "value": 23
37
+ },
38
+ {
39
+ "owner": "packageJson",
40
+ "description": "Runtime Library dependency",
41
+ "value": "^4.45.4"
42
+ },
43
+ {
44
+ "owner": "markdown",
45
+ "description": "Number of lines in the README.md",
46
+ "value": 258
47
+ },
48
+ {
49
+ "owner": "markdown",
50
+ "description": "Number of lines in the SUMMARY.md",
51
+ "value": 9
52
+ },
53
+ {
54
+ "owner": "markdown",
55
+ "description": "Number of lines in the PROPERTIES.md",
56
+ "value": 248
57
+ },
58
+ {
59
+ "owner": "markdown",
60
+ "description": "Number of lines in the TROUBLESHOOT.md",
61
+ "value": 47
62
+ },
63
+ {
64
+ "owner": "markdown",
65
+ "description": "Number of lines in the ENHANCE.md",
66
+ "value": 70
67
+ },
68
+ {
69
+ "owner": "unitTestJS",
70
+ "description": "Number of lines of code in unit tests",
71
+ "value": 7130
72
+ },
73
+ {
74
+ "owner": "unitTestJS",
75
+ "description": "Number of unit tests",
76
+ "value": 443
77
+ },
78
+ {
79
+ "owner": "integrationTestJS",
80
+ "description": "Number of lines of code in integration tests",
81
+ "value": 5384
82
+ },
83
+ {
84
+ "owner": "integrationTestJS",
85
+ "description": "Number of integration tests",
86
+ "value": 174
87
+ },
88
+ {
89
+ "owner": "staticFile",
90
+ "description": "Number of lines of code in adapterBase.js",
91
+ "value": 1300
92
+ },
93
+ {
94
+ "owner": "staticFile",
95
+ "description": "Number of static files added",
96
+ "value": 35
97
+ },
98
+ {
99
+ "owner": "Overall",
100
+ "description": "Total lines of Code",
101
+ "value": 13814
102
+ },
103
+ {
104
+ "owner": "Overall",
105
+ "description": "Total Tests",
106
+ "value": 617
107
+ },
108
+ {
109
+ "owner": "Overall",
110
+ "description": "Total Files",
111
+ "value": 6
112
+ }
113
+ ]
114
+ }
@@ -21,7 +21,10 @@
21
21
  "invalid_token_error": 401,
22
22
  "auth_field": "header.headers.X-Auth-Token",
23
23
  "auth_field_format": "{token}",
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": "none",
@@ -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) => {
@@ -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');
@@ -13,7 +14,10 @@ const winston = require('winston');
13
14
  const { expect } = require('chai');
14
15
  const { use } = require('chai');
15
16
  const td = require('testdouble');
17
+ const util = require('util');
18
+ const pronghorn = require('../../pronghorn.json');
16
19
 
20
+ pronghorn.methodsByName = pronghorn.methods.reduce((result, meth) => ({ ...result, [meth.name]: meth }), {});
17
21
  const anything = td.matchers.anything();
18
22
 
19
23
  // stub and attemptTimeout are used throughout the code so set them here
@@ -63,7 +67,10 @@ global.pronghornProps = {
63
67
  invalid_token_error: 401,
64
68
  auth_field: 'header.headers.Authorization',
65
69
  auth_field_format: 'Basic {b64}{username}:{password}{/b64}',
66
- auth_logging: false
70
+ auth_logging: false,
71
+ client_id: '',
72
+ client_secret: '',
73
+ grant_type: ''
67
74
  },
68
75
  healthcheck: {
69
76
  type: 'startup',
@@ -310,7 +317,7 @@ function saveMockData(entityName, actionName, descriptor, responseData) {
310
317
  }
311
318
 
312
319
  // require the adapter that we are going to be using
313
- const DnaCenter = require('../../adapter.js');
320
+ const DnaCenter = require('../../adapter');
314
321
 
315
322
  // begin the testing - these should be pretty well defined between the describe and the it!
316
323
  describe('[integration] Dna_center Adapter Test', () => {
@@ -341,6 +348,8 @@ describe('[integration] Dna_center Adapter Test', () => {
341
348
  try {
342
349
  assert.notEqual(null, a);
343
350
  assert.notEqual(undefined, a);
351
+ const checkId = global.pronghornProps.adapterProps.adapters[0].id;
352
+ assert.equal(checkId, a.id);
344
353
  assert.notEqual(null, a.allProps);
345
354
  const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
346
355
  assert.equal(check, a.healthcheckType);
@@ -2178,6 +2187,62 @@ describe('[integration] Dna_center Adapter Test', () => {
2178
2187
  }).timeout(attemptTimeout);
2179
2188
  });
2180
2189
 
2190
+ describe('#postDnasystemapiv1sitesiteIddevice - errors', () => {
2191
+ it('should work if integrated or standalone with mockdata', (done) => {
2192
+ try {
2193
+ a.postDnasystemapiv1sitesiteIddevice('fakedata', 'fakedata', 'fakedata', 'fakedata', 'fakedata', (data, error) => {
2194
+ try {
2195
+ runCommonAsserts(data, error);
2196
+
2197
+ if (stub) {
2198
+ assert.equal('string', data.response.executionId);
2199
+ assert.equal('string', data.response.executionStatusUrl);
2200
+ assert.equal('string', data.response.message);
2201
+ } else {
2202
+ runCommonAsserts(data, error);
2203
+ }
2204
+
2205
+ done();
2206
+ } catch (err) {
2207
+ log.error(`Test Failure: ${err}`);
2208
+ done(err);
2209
+ }
2210
+ });
2211
+ } catch (error) {
2212
+ log.error(`Adapter Exception: ${error}`);
2213
+ done(error);
2214
+ }
2215
+ }).timeout(attemptTimeout);
2216
+ });
2217
+
2218
+ describe('#postDnaintentapiv1site - errors', () => {
2219
+ it('should work if integrated or standalone with mockdata', (done) => {
2220
+ try {
2221
+ a.postDnaintentapiv1site('fakedata', 'fakedata', 'fakedata', 'fakedata', (data, error) => {
2222
+ try {
2223
+ runCommonAsserts(data, error);
2224
+
2225
+ if (stub) {
2226
+ assert.equal('string', data.response.executionId);
2227
+ assert.equal('string', data.response.executionStatusUrl);
2228
+ assert.equal('string', data.response.message);
2229
+ } else {
2230
+ runCommonAsserts(data, error);
2231
+ }
2232
+
2233
+ done();
2234
+ } catch (err) {
2235
+ log.error(`Test Failure: ${err}`);
2236
+ done(err);
2237
+ }
2238
+ });
2239
+ } catch (error) {
2240
+ log.error(`Adapter Exception: ${error}`);
2241
+ done(error);
2242
+ }
2243
+ }).timeout(attemptTimeout);
2244
+ });
2245
+
2181
2246
  describe('#postDnasystemapiv1site - errors', () => {
2182
2247
  it('should work if integrated or standalone with mockdata', (done) => {
2183
2248
  try {