@itentialopensource/adapter-viptela 0.10.4 → 0.10.6

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 CHANGED
@@ -1,4 +1,20 @@
1
1
 
2
+ ## 0.10.6 [05-10-2023]
3
+
4
+ * Migrate adapterBase.js with broker integration changes
5
+
6
+ See merge request itentialopensource/adapters/sd-wan/adapter-viptela!26
7
+
8
+ ---
9
+
10
+ ## 0.10.5 [04-06-2023]
11
+
12
+ * Added new calls
13
+
14
+ See merge request itentialopensource/adapters/sd-wan/adapter-viptela!23
15
+
16
+ ---
17
+
2
18
  ## 0.10.4 [03-28-2023]
3
19
 
4
20
  * Added new calls
package/adapterBase.js CHANGED
@@ -17,6 +17,8 @@ const jsonQuery = require('json-query');
17
17
  const EventEmitterCl = require('events').EventEmitter;
18
18
  const { execSync } = require('child_process');
19
19
 
20
+ const sampleProperties = require(`${__dirname}/sampleProperties.json`).properties;
21
+
20
22
  /* The schema validator */
21
23
  const AjvCl = require('ajv');
22
24
 
@@ -24,11 +26,15 @@ const AjvCl = require('ajv');
24
26
  const PropUtilCl = require('@itentialopensource/adapter-utils').PropertyUtility;
25
27
  const RequestHandlerCl = require('@itentialopensource/adapter-utils').RequestHandler;
26
28
 
29
+ const TransUtilCl = require(path.join(__dirname, 'node_modules/@itentialopensource/adapter-utils/lib/translatorUtil.js'));
30
+
27
31
  const entitiesToDB = require(path.join(__dirname, 'utils/entitiesToDB'));
28
32
  const troubleshootingAdapter = require(path.join(__dirname, 'utils/troubleshootingAdapter'));
29
33
  const tbUtils = require(path.join(__dirname, 'utils/tbUtils'));
30
34
 
31
35
  let propUtil = null;
36
+ let transUtil = null;
37
+ let choosepath = null;
32
38
 
33
39
  /*
34
40
  * INTERNAL FUNCTION: force fail the adapter - generally done to cause restart
@@ -101,7 +107,7 @@ function updateSchema(entityPath, configFile, changes) {
101
107
  /*
102
108
  * INTERNAL FUNCTION: update the mock data file
103
109
  */
104
- function updateMock(mockPath, configFile, changes) {
110
+ function updateMock(mockPath, configFile, changes, replace) {
105
111
  // if the mock file does not exist - create it
106
112
  const mockFile = path.join(mockPath, `/${configFile}`);
107
113
  if (!fs.existsSync(mockFile)) {
@@ -113,7 +119,11 @@ function updateMock(mockPath, configFile, changes) {
113
119
  let mock = require(path.resolve(mockPath, configFile));
114
120
 
115
121
  // merge the changes into the mock file
116
- mock = propUtil.mergeProperties(changes, mock);
122
+ if (replace === true) {
123
+ mock = changes;
124
+ } else {
125
+ mock = propUtil.mergeProperties(changes, mock);
126
+ }
117
127
 
118
128
  fs.writeFileSync(mockFile, JSON.stringify(mock, null, 2));
119
129
  return null;
@@ -166,6 +176,28 @@ function getDataFromSources(loopField, sources) {
166
176
  return fieldValue;
167
177
  }
168
178
 
179
+ /*
180
+ * INTERNAL FUNCTION: update allprops device broker array with service config and sample props
181
+ */
182
+ function getDeviceBrokerArray(sampleProps, allProps) {
183
+ const brokerCallsArr = ['getDevice', 'getDevicesFiltered', 'isAlive', 'getConfig', 'getCount'];
184
+ const deviceBroker = allProps.devicebroker;
185
+ for (let i = 0; i < brokerCallsArr.length; i += 1) {
186
+ if (!allProps.devicebroker || !allProps.devicebroker[brokerCallsArr[i]] || allProps.devicebroker[brokerCallsArr[i]].length === 0 || !allProps.devicebroker[brokerCallsArr[i]][0].path) {
187
+ // if not in service config check sample props
188
+ if (!sampleProps.devicebroker || !sampleProps.devicebroker[brokerCallsArr[i]] || sampleProps.devicebroker[brokerCallsArr[i]].length === 0 || !sampleProps.devicebroker[brokerCallsArr[i]][0].path) {
189
+ deviceBroker[brokerCallsArr[i]] = [];
190
+ } else {
191
+ log.info('Updating device broker with sample props');
192
+ deviceBroker[brokerCallsArr[i]] = sampleProps.devicebroker[brokerCallsArr[i]];
193
+ }
194
+ }
195
+ }
196
+
197
+ log.info('Device broker array', JSON.stringify(deviceBroker, null, 3));
198
+ return deviceBroker;
199
+ }
200
+
169
201
  /* GENERAL ADAPTER FUNCTIONS THESE SHOULD NOT BE DIRECTLY MODIFIED */
170
202
  /* IF YOU NEED MODIFICATIONS, REDEFINE THEM IN adapter.js!!! */
171
203
  class AdapterBase extends EventEmitterCl {
@@ -185,6 +217,10 @@ class AdapterBase extends EventEmitterCl {
185
217
  this.id = prongid;
186
218
  this.propUtilInst = new PropUtilCl(prongid, __dirname);
187
219
  propUtil = this.propUtilInst;
220
+ this.transUtilInst = new TransUtilCl(prongid, this.propUtilInst);
221
+ transUtil = this.transUtilInst;
222
+ this.transUtilInst = new TransUtilCl(prongid, this.propUtilInst);
223
+ transUtil = this.transUtilInst;
188
224
  this.initProps = properties;
189
225
  this.alive = false;
190
226
  this.healthy = false;
@@ -197,6 +233,8 @@ class AdapterBase extends EventEmitterCl {
197
233
 
198
234
  // set up the properties I care about
199
235
  this.refreshProperties(properties);
236
+ // update deviceBroker based on service config and sample props
237
+ this.allProps.devicebroker = getDeviceBrokerArray(sampleProperties, this.allProps);
200
238
 
201
239
  // Instantiate the other components for this Adapter
202
240
  this.requestHandlerInst = new RequestHandlerCl(this.id, this.allProps, __dirname);
@@ -379,9 +417,15 @@ class AdapterBase extends EventEmitterCl {
379
417
  this.emit('OFFLINE', { id: this.id });
380
418
  this.emit('DEGRADED', { id: this.id });
381
419
  this.healthy = false;
382
- log.error(`${origin}: HEALTH CHECK - Error ${error}`);
383
- } else {
420
+ if (typeof error === 'object') {
421
+ log.error(`${origin}: HEALTH CHECK - Error ${JSON.stringify(error)}`);
422
+ } else {
423
+ log.error(`${origin}: HEALTH CHECK - Error ${error}`);
424
+ }
425
+ } else if (typeof error === 'object') {
384
426
  // still log but set the level to trace
427
+ log.trace(`${origin}: HEALTH CHECK - Still Errors ${JSON.stringify(error)}`);
428
+ } else {
385
429
  log.trace(`${origin}: HEALTH CHECK - Still Errors ${error}`);
386
430
  }
387
431
 
@@ -527,16 +571,17 @@ class AdapterBase extends EventEmitterCl {
527
571
  * @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
528
572
  * @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
529
573
  * @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
574
+ * @param {boolean} replace - true to replace entire mock data, false to merge/append (optional)
530
575
  * @param {Callback} callback - The results of the call
531
576
  */
532
- iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
577
+ iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, replace, callback) {
533
578
  const meth = 'adapterBase-iapUpdateAdapterConfiguration';
534
579
  const origin = `${this.id}-${meth}`;
535
580
  log.trace(origin);
536
581
 
537
582
  // verify the parameters are valid
538
583
  if (changes === undefined || changes === null || typeof changes !== 'object'
539
- || Object.keys(changes).length === 0) {
584
+ || Object.keys(changes).length === 0) {
540
585
  const result = {
541
586
  response: 'No configuration updates to make'
542
587
  };
@@ -621,8 +666,14 @@ class AdapterBase extends EventEmitterCl {
621
666
  if (!fs.existsSync(mpath)) {
622
667
  fs.mkdirSync(mpath);
623
668
  }
669
+ // this means we are changing a mock data file so replace is required
670
+ if (replace === undefined || replace === null || replace === '') {
671
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['replace'], null, null, null);
672
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
673
+ return callback(null, errorObj);
674
+ }
675
+ const mres = updateMock(mpath, configFile, changes, replace);
624
676
 
625
- const mres = updateMock(mpath, configFile, changes);
626
677
  if (mres) {
627
678
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, `Incomplete Configuration Change: ${mres}`, [], null, null, null);
628
679
  log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
@@ -659,6 +710,10 @@ class AdapterBase extends EventEmitterCl {
659
710
  return callback(null, result);
660
711
  }
661
712
 
713
+ if (typeof this.allProps.choosepath === 'string') {
714
+ choosepath = this.allProps.choosepath;
715
+ }
716
+
662
717
  // make sure the entities directory exists
663
718
  const entitydir = path.join(__dirname, 'entities');
664
719
  if (!fs.statSync(entitydir).isDirectory()) {
@@ -683,7 +738,25 @@ class AdapterBase extends EventEmitterCl {
683
738
 
684
739
  // go through all of the actions set the appropriate info in the newActions
685
740
  for (let a = 0; a < actions.actions.length; a += 1) {
686
- if (actions.actions[a].entitypath.indexOf(apiPath) >= 0) {
741
+ if (actions.actions[a].entitypath && typeof actions.actions[a].entitypath === 'object') {
742
+ const entityKeys = Object.keys(actions.actions[a].entitypath);
743
+ if (entityKeys.length > 0) {
744
+ for (let entityKey = 0; entityKey < entityKeys.length; entityKey += 1) {
745
+ if (choosepath && entityKeys[entityKey] === choosepath && actions.actions[a].entitypath[entityKeys[entityKey]].indexOf(apiPath) >= 0) {
746
+ log.info(` Found - entity: ${entities[e]} action: ${actions.actions[a].name}`);
747
+ log.info(` method: ${actions.actions[a].method} path: ${actions.actions[a].entitypath[entityKeys[entityKey]]}`);
748
+ const fitem = {
749
+ entity: entities[e],
750
+ action: actions.actions[a].name,
751
+ method: actions.actions[a].method,
752
+ path: actions.actions[a].entitypath[entityKeys[entityKey]]
753
+ };
754
+ fitems.push(fitem);
755
+ break;
756
+ }
757
+ }
758
+ }
759
+ } else if (actions.actions[a].entitypath.indexOf(apiPath) >= 0) {
687
760
  log.info(` Found - entity: ${entities[e]} action: ${actions.actions[a].name}`);
688
761
  log.info(` method: ${actions.actions[a].method} path: ${actions.actions[a].entitypath}`);
689
762
  const fitem = {
@@ -831,7 +904,7 @@ class AdapterBase extends EventEmitterCl {
831
904
  if (result) {
832
905
  return callback(result);
833
906
  }
834
- return callback(null, result);
907
+ return callback(null, 'Healthcheck failed');
835
908
  } catch (error) {
836
909
  return callback(null, error);
837
910
  }
@@ -846,8 +919,7 @@ class AdapterBase extends EventEmitterCl {
846
919
  */
847
920
  async iapRunAdapterConnectivity(callback) {
848
921
  try {
849
- const { serviceItem } = await tbUtils.getAdapterConfig();
850
- const { host } = serviceItem.properties.properties;
922
+ const { host } = this.allProps;
851
923
  const result = tbUtils.runConnectivity(host, false);
852
924
  if (result.failCount > 0) {
853
925
  return callback(null, result);
@@ -918,7 +990,7 @@ class AdapterBase extends EventEmitterCl {
918
990
  const entityIds = [];
919
991
 
920
992
  if (entities && Object.hasOwnProperty.call(entities, 'response')
921
- && Array.isArray(entities.response)) {
993
+ && Array.isArray(entities.response)) {
922
994
  for (let e = 0; e < entities.response.length; e += 1) {
923
995
  entityIds.push(entities.response[e][key]);
924
996
  }
@@ -1155,75 +1227,73 @@ class AdapterBase extends EventEmitterCl {
1155
1227
  uriMethod = callProps.method;
1156
1228
  }
1157
1229
  if (callProps.query) {
1158
- callQuery = callProps.query;
1159
-
1230
+ callQuery = { ...callProps.query };
1160
1231
  // go through the query params to check for variable values
1161
1232
  const cpKeys = Object.keys(callQuery);
1162
1233
  for (let cp = 0; cp < cpKeys.length; cp += 1) {
1163
- if (callQuery[cpKeys[cp]].startsWith('{') && callQuery[cpKeys[cp]].endsWith('}')) {
1164
- // make any necessary changes to the query params
1165
- if (devResp !== null && callProps.requestFields && Object.keys(callProps.requestFields).length > 0) {
1166
- const rqKeys = Object.keys(callProps.requestFields);
1167
-
1168
- // get the field from the provided device
1169
- for (let rq = 0; rq < rqKeys.length; rq += 1) {
1170
- if (cpKeys[cp] === rqKeys[rq]) {
1171
- const fieldValue = getDataFromSources(callProps.requestFields[rqKeys[rq]], devResp);
1172
-
1173
- // put the value into the query - if it has been specified in the query
1174
- callQuery[cpKeys[cp]] = fieldValue;
1175
- }
1234
+ // if (callQuery[cpKeys[cp]].startsWith('{') && callQuery[cpKeys[cp]].endsWith('}')) {
1235
+ // make any necessary changes to the query params
1236
+ if (devResp !== null && callProps.requestFields && Object.keys(callProps.requestFields).length > 0) {
1237
+ const rqKeys = Object.keys(callProps.requestFields);
1238
+
1239
+ // get the field from the provided device
1240
+ for (let rq = 0; rq < rqKeys.length; rq += 1) {
1241
+ if (callQuery[cpKeys[cp]] === rqKeys[rq]) {
1242
+ const fieldValue = getDataFromSources(callProps.requestFields[rqKeys[rq]], devResp);
1243
+ // put the value into the query - if it has been specified in the query
1244
+ callQuery[cpKeys[cp]] = fieldValue;
1176
1245
  }
1177
1246
  }
1178
1247
  }
1248
+ // }
1179
1249
  }
1180
1250
  }
1181
1251
  if (callProps.body) {
1182
- callBody = callProps.body;
1252
+ callBody = { ...callProps.body };
1183
1253
 
1184
1254
  // go through the body fields to check for variable values
1185
1255
  const cbKeys = Object.keys(callBody);
1186
1256
  for (let cb = 0; cb < cbKeys.length; cb += 1) {
1187
- if (callBody[cbKeys[cb]].startsWith('{') && callBody[cbKeys[cb]].endsWith('}')) {
1188
- // make any necessary changes to the query params
1189
- if (devResp !== null && callProps.requestFields && Object.keys(callProps.requestFields).length > 0) {
1190
- const rqKeys = Object.keys(callProps.requestFields);
1191
-
1192
- // get the field from the provided device
1193
- for (let rq = 0; rq < rqKeys.length; rq += 1) {
1194
- if (cbKeys[cb] === rqKeys[rq]) {
1195
- const fieldValue = getDataFromSources(callProps.requestFields[rqKeys[rq]], devResp);
1196
-
1197
- // put the value into the query - if it has been specified in the query
1198
- callBody[cbKeys[cb]] = fieldValue;
1199
- }
1257
+ // if (callBody[cbKeys[cb]].startsWith('{') && callBody[cbKeys[cb]].endsWith('}')) {
1258
+ // make any necessary changes to the query params
1259
+ if (devResp !== null && callProps.requestFields && Object.keys(callProps.requestFields).length > 0) {
1260
+ const rqKeys = Object.keys(callProps.requestFields);
1261
+
1262
+ // get the field from the provided device
1263
+ for (let rq = 0; rq < rqKeys.length; rq += 1) {
1264
+ if (callBody[cbKeys[cb]] === rqKeys[rq]) {
1265
+ const fieldValue = getDataFromSources(callProps.requestFields[rqKeys[rq]], devResp);
1266
+
1267
+ // put the value into the query - if it has been specified in the query
1268
+ callBody[cbKeys[cb]] = fieldValue;
1200
1269
  }
1201
1270
  }
1202
1271
  }
1272
+ // }
1203
1273
  }
1204
1274
  }
1205
1275
  if (callProps.headers) {
1206
- callHeaders = callProps.headers;
1276
+ callHeaders = { ...callProps.headers };
1207
1277
 
1208
1278
  // go through the body fields to check for variable values
1209
1279
  const chKeys = Object.keys(callHeaders);
1210
1280
  for (let ch = 0; ch < chKeys.length; ch += 1) {
1211
- if (callHeaders[chKeys[ch]].startsWith('{') && callHeaders[chKeys[ch]].endsWith('}')) {
1212
- // make any necessary changes to the query params
1213
- if (devResp !== null && callProps.requestFields && Object.keys(callProps.requestFields).length > 0) {
1214
- const rqKeys = Object.keys(callProps.requestFields);
1215
-
1216
- // get the field from the provided device
1217
- for (let rq = 0; rq < rqKeys.length; rq += 1) {
1218
- if (chKeys[ch] === rqKeys[rq]) {
1219
- const fieldValue = getDataFromSources(callProps.requestFields[rqKeys[rq]], devResp);
1220
-
1221
- // put the value into the query - if it has been specified in the query
1222
- callHeaders[chKeys[ch]] = fieldValue;
1223
- }
1281
+ // if (callHeaders[chKeys[ch]].startsWith('{') && callHeaders[chKeys[ch]].endsWith('}')) {
1282
+ // make any necessary changes to the query params
1283
+ if (devResp !== null && callProps.requestFields && Object.keys(callProps.requestFields).length > 0) {
1284
+ const rqKeys = Object.keys(callProps.requestFields);
1285
+
1286
+ // get the field from the provided device
1287
+ for (let rq = 0; rq < rqKeys.length; rq += 1) {
1288
+ if (callHeaders[chKeys[ch]] === rqKeys[rq]) {
1289
+ const fieldValue = getDataFromSources(callProps.requestFields[rqKeys[rq]], devResp);
1290
+
1291
+ // put the value into the query - if it has been specified in the query
1292
+ callHeaders[chKeys[ch]] = fieldValue;
1224
1293
  }
1225
1294
  }
1226
1295
  }
1296
+ // }
1227
1297
  }
1228
1298
  }
1229
1299
  if (callProps.handleFailure) {
@@ -1422,7 +1492,7 @@ class AdapterBase extends EventEmitterCl {
1422
1492
  // Perform component calls here.
1423
1493
  callPromises.push(
1424
1494
  new Promise((resolve, reject) => {
1425
- this.iapMakeBrokerCall('getDevice', this.allProps.devicebroker.getDevice[i], [devs.list[0]], null, (callRet, callErr) => {
1495
+ this.iapMakeBrokerCall('getDevice', this.allProps.devicebroker.getDevice[i], [devs.list[0]], [deviceName], (callRet, callErr) => {
1426
1496
  // return an error
1427
1497
  if (callErr) {
1428
1498
  reject(callErr);
@@ -1703,7 +1773,13 @@ class AdapterBase extends EventEmitterCl {
1703
1773
  return Promise.all(callPromises).then((results) => {
1704
1774
  let myResult = {};
1705
1775
  results.forEach((result) => {
1706
- myResult = { ...myResult, ...result };
1776
+ if (typeof result === 'string') {
1777
+ myResult = { ...myResult, result };
1778
+ } else if (Array.isArray(result)) {
1779
+ myResult = result[0];
1780
+ } else {
1781
+ myResult = { ...myResult, ...result };
1782
+ }
1707
1783
  });
1708
1784
 
1709
1785
  // return the result
@@ -1748,7 +1824,7 @@ class AdapterBase extends EventEmitterCl {
1748
1824
  // Perform component calls here.
1749
1825
  callPromises.push(
1750
1826
  new Promise((resolve, reject) => {
1751
- this.iapMakeBrokerCall('getCount', this.allProps.devicebroker.getCount[i], null, null, (callRet, callErr) => {
1827
+ this.iapMakeBrokerCall('getCount', this.allProps.devicebroker.getCount[i], [{ fake: 'fakedata' }], null, (callRet, callErr) => {
1752
1828
  // return an error
1753
1829
  if (callErr) {
1754
1830
  reject(callErr);
@@ -1769,7 +1845,7 @@ class AdapterBase extends EventEmitterCl {
1769
1845
  });
1770
1846
 
1771
1847
  // return the result
1772
- return callback({ count: myResult.length });
1848
+ return callback({ count: Object.keys(myResult).length });
1773
1849
  });
1774
1850
  } catch (ex) {
1775
1851
  const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-viptela",
3
- "version": "0.10.4",
3
+ "version": "0.10.6",
4
4
  "description": "This adapter integrates with system Viptela",
5
5
  "main": "adapter.js",
6
6
  "systemName": "Cisco Viptela",
@@ -53,7 +53,7 @@
53
53
  "author": "Itential",
54
54
  "homepage": "https://gitlab.com/itentialopensource/adapters/sd-wan/adapter-viptela#readme",
55
55
  "dependencies": {
56
- "@itentialopensource/adapter-utils": "^4.48.10",
56
+ "@itentialopensource/adapter-utils": "^4.48.13",
57
57
  "ajv": "^6.12.0",
58
58
  "axios": "^0.21.0",
59
59
  "commander": "^2.20.0",
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.10.2",
2
+ "version": "0.10.3",
3
3
  "configLines": 20359,
4
4
  "scriptLines": 1707,
5
- "codeLines": 45295,
5
+ "codeLines": 45371,
6
6
  "testLines": 27464,
7
7
  "testCases": 1439,
8
- "totalCodeLines": 74466,
8
+ "totalCodeLines": 74542,
9
9
  "wfTasks": 570
10
10
  }
@@ -108,81 +108,87 @@
108
108
  "devicebroker": {
109
109
  "getDevice": [
110
110
  {
111
- "path": "/get/devices/{id}",
111
+ "path": "/device",
112
112
  "method": "GET",
113
113
  "query": {},
114
114
  "body": {},
115
115
  "headers": {},
116
116
  "handleFailure": "ignore",
117
- "requestFields": {
118
- "id": "name"
119
- },
117
+ "responseDatakey": "data",
120
118
  "responseFields": {
121
- "name": "host",
122
- "ostype": "os",
123
- "ostypePrefix": "system-",
124
- "ipaddress": "attributes.ipaddr",
125
- "port": "443"
119
+ "name": "host-name",
120
+ "ostype": "device-type",
121
+ "ostypePrefix": "viptela-",
122
+ "port": "platform",
123
+ "ip": "deviceId",
124
+ "ipaddress": "system-ip"
126
125
  }
127
126
  }
128
127
  ],
129
128
  "getDevicesFiltered": [
130
129
  {
131
- "path": "/get/devices",
130
+ "path": "/device",
132
131
  "method": "GET",
133
132
  "query": {},
134
133
  "body": {},
135
134
  "headers": {},
136
135
  "handleFailure": "ignore",
137
- "requestFields": {},
136
+ "responseDatakey": "data",
138
137
  "responseFields": {
139
- "name": "host",
140
- "ostype": "os",
141
- "ostypePrefix": "system-",
142
- "ipaddress": "attributes.ipaddr",
143
- "port": "443"
138
+ "name": "host-name",
139
+ "ostype": "device-type",
140
+ "ostypePrefix": "viptela-",
141
+ "port": "platform",
142
+ "ip": "deviceId",
143
+ "ipaddress": "system-ip"
144
144
  }
145
145
  }
146
146
  ],
147
147
  "isAlive": [
148
148
  {
149
- "path": "/get/devices/{id}/status",
149
+ "path": "/device",
150
150
  "method": "GET",
151
151
  "query": {},
152
152
  "body": {},
153
153
  "headers": {},
154
+ "requestFields": {},
155
+ "responseDatakey": "data",
154
156
  "handleFailure": "ignore",
155
- "statusValue": "online",
156
- "requestFields": {
157
- "id": "name"
158
- },
159
157
  "responseFields": {
160
- "status": "status"
158
+ "status": "reachability",
159
+ "statusValue": "reachable"
161
160
  }
162
161
  }
163
162
  ],
164
163
  "getConfig": [
165
164
  {
166
- "path": "/get/devices/{id}/configPart1",
165
+ "path": "/device/config",
167
166
  "method": "GET",
168
- "query": {},
167
+ "query": {
168
+ "deviceId": "ipaddress"
169
+ },
169
170
  "body": {},
170
- "headers": {},
171
- "handleFailure": "ignore",
171
+ "headers": {
172
+ "Accept": "/"
173
+ },
172
174
  "requestFields": {
173
- "id": "name"
175
+ "ipaddress": "ipaddress"
174
176
  },
177
+ "handleFailure": "ignore",
175
178
  "responseFields": {}
176
179
  }
177
180
  ],
178
181
  "getCount": [
179
182
  {
180
- "path": "/get/devices",
183
+ "path": "/device/counters",
181
184
  "method": "GET",
182
185
  "query": {},
183
186
  "body": {},
184
187
  "headers": {},
185
- "handleFailure": "ignore"
188
+ "requestFields": {},
189
+ "responseDatakey": "data",
190
+ "handleFailure": "ignore",
191
+ "responseFields": {}
186
192
  }
187
193
  ]
188
194
  }
@@ -862,7 +862,7 @@ describe('[unit] Adapter Base Test', () => {
862
862
  });
863
863
  it('should return no updated if no changes are provided', (done) => {
864
864
  try {
865
- a.iapUpdateAdapterConfiguration(null, null, null, null, null, (data, error) => {
865
+ a.iapUpdateAdapterConfiguration(null, null, null, null, null, null, (data, error) => {
866
866
  try {
867
867
  assert.equal('No configuration updates to make', data.response);
868
868
  done();
@@ -878,7 +878,7 @@ describe('[unit] Adapter Base Test', () => {
878
878
  }).timeout(attemptTimeout);
879
879
  it('should throw an error if missing configuration file', (done) => {
880
880
  try {
881
- a.iapUpdateAdapterConfiguration(null, { name: 'fakeChange' }, null, null, null, (data, error) => {
881
+ a.iapUpdateAdapterConfiguration(null, { name: 'fakeChange' }, null, null, null, null, (data, error) => {
882
882
  try {
883
883
  const displayE = 'configFile is required';
884
884
  runErrorAsserts(data, error, 'AD.300', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
@@ -895,7 +895,7 @@ describe('[unit] Adapter Base Test', () => {
895
895
  }).timeout(attemptTimeout);
896
896
  it('if not package.json, entity is required', (done) => {
897
897
  try {
898
- a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, null, null, null, (data, error) => {
898
+ a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, null, null, null, null, (data, error) => {
899
899
  try {
900
900
  const displayE = 'Unsupported Configuration Change or Missing Entity';
901
901
  runErrorAsserts(data, error, 'AD.999', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
@@ -912,7 +912,7 @@ describe('[unit] Adapter Base Test', () => {
912
912
  }).timeout(attemptTimeout);
913
913
  it('if not package.json, type is required', (done) => {
914
914
  try {
915
- a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, 'entity', null, null, (data, error) => {
915
+ a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, 'entity', null, null, null, (data, error) => {
916
916
  try {
917
917
  const displayE = 'type is required';
918
918
  runErrorAsserts(data, error, 'AD.300', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);
@@ -929,7 +929,7 @@ describe('[unit] Adapter Base Test', () => {
929
929
  }).timeout(attemptTimeout);
930
930
  it('if not package.json, entity must be valid', (done) => {
931
931
  try {
932
- a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, 'fakeEntity', 'fakeType', null, (data, error) => {
932
+ a.iapUpdateAdapterConfiguration('notPackage', { name: 'fakeChange' }, 'fakeEntity', 'fakeType', null, null, (data, error) => {
933
933
  try {
934
934
  const displayE = 'Incomplete Configuration Change: Invalid Entity - fakeEntity';
935
935
  runErrorAsserts(data, error, 'AD.999', 'Test-Base-adapterBase-iapUpdateAdapterConfiguration', displayE);