@itentialopensource/adapter-meraki 0.7.3 → 0.8.2

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.
@@ -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,95 @@
1
+ {
2
+ "errors": [],
3
+ "statistics": [
4
+ {
5
+ "owner": "errorJson",
6
+ "description": "New adapter errors available for use",
7
+ "value": 1
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": 29
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": 13271
53
+ },
54
+ {
55
+ "owner": "unitTestJS",
56
+ "description": "Number of unit tests",
57
+ "value": 852
58
+ },
59
+ {
60
+ "owner": "integrationTestJS",
61
+ "description": "Number of lines of code in integration tests",
62
+ "value": 9674
63
+ },
64
+ {
65
+ "owner": "integrationTestJS",
66
+ "description": "Number of integration tests",
67
+ "value": 334
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": 23974
83
+ },
84
+ {
85
+ "owner": "Overall",
86
+ "description": "Total Tests",
87
+ "value": 1186
88
+ },
89
+ {
90
+ "owner": "Overall",
91
+ "description": "Total Files",
92
+ "value": 6
93
+ }
94
+ ]
95
+ }
@@ -0,0 +1,115 @@
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": 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.45.4"
38
+ },
39
+ {
40
+ "owner": "propertiesSchemaJson",
41
+ "description": "Adapter properties defined in the propertiesSchema file",
42
+ "value": 69
43
+ },
44
+ {
45
+ "owner": "markdown",
46
+ "description": "Number of lines in the README.md",
47
+ "value": 258
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": 248
58
+ },
59
+ {
60
+ "owner": "markdown",
61
+ "description": "Number of lines in the TROUBLESHOOT.md",
62
+ "value": 47
63
+ },
64
+ {
65
+ "owner": "markdown",
66
+ "description": "Number of lines in the ENHANCE.md",
67
+ "value": 70
68
+ },
69
+ {
70
+ "owner": "unitTestJS",
71
+ "description": "Number of lines of code in unit tests",
72
+ "value": 13280
73
+ },
74
+ {
75
+ "owner": "unitTestJS",
76
+ "description": "Number of unit tests",
77
+ "value": 852
78
+ },
79
+ {
80
+ "owner": "integrationTestJS",
81
+ "description": "Number of lines of code in integration tests",
82
+ "value": 9678
83
+ },
84
+ {
85
+ "owner": "integrationTestJS",
86
+ "description": "Number of integration tests",
87
+ "value": 334
88
+ },
89
+ {
90
+ "owner": "staticFile",
91
+ "description": "Number of lines of code in adapterBase.js",
92
+ "value": 1294
93
+ },
94
+ {
95
+ "owner": "staticFile",
96
+ "description": "Number of static files added",
97
+ "value": 35
98
+ },
99
+ {
100
+ "owner": "Overall",
101
+ "description": "Total lines of Code",
102
+ "value": 24252
103
+ },
104
+ {
105
+ "owner": "Overall",
106
+ "description": "Total Tests",
107
+ "value": 1186
108
+ },
109
+ {
110
+ "owner": "Overall",
111
+ "description": "Total Files",
112
+ "value": 6
113
+ }
114
+ ]
115
+ }
@@ -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": "none",
@@ -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: 'none',
@@ -341,6 +348,8 @@ describe('[integration] Meraki 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);