@itentialopensource/adapter-viptela 0.10.5 → 0.10.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.
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);
@@ -905,7 +905,7 @@
905
905
  ]
906
906
  },
907
907
  {
908
- "name": "generateTemplateList__v3",
908
+ "name": "generateMasterTemplateList",
909
909
  "protocol": "REST",
910
910
  "method": "GET",
911
911
  "entitypath": "{base_path}/{version}/template/device?{query}",
@@ -921,12 +921,12 @@
921
921
  {
922
922
  "type": "default",
923
923
  "key": "",
924
- "mockFile": ""
924
+ "mockFile": "mockdatafiles/generateMasterTemplateList-default.json"
925
925
  }
926
926
  ]
927
927
  },
928
928
  {
929
- "name": "editTemplate__v3",
929
+ "name": "editMasterTemplate",
930
930
  "protocol": "REST",
931
931
  "method": "PUT",
932
932
  "entitypath": "{base_path}/{version}/template/device/{pathv1}?{query}",
@@ -934,27 +934,6 @@
934
934
  "responseSchema": "schema.json",
935
935
  "timeout": 0,
936
936
  "sendEmpty": false,
937
- "requestDatatype": "PLAIN",
938
- "responseDatatype": "JSON",
939
- "headers": {},
940
- "responseObjects": [
941
- {
942
- "type": "default",
943
- "key": "",
944
- "mockFile": ""
945
- }
946
- ]
947
- },
948
- {
949
- "name": "generateTemplateList__v4",
950
- "protocol": "REST",
951
- "method": "GET",
952
- "entitypath": "{base_path}/{version}/template/device?{query}",
953
- "requestSchema": "schema.json",
954
- "responseSchema": "schema.json",
955
- "timeout": 0,
956
- "sendEmpty": false,
957
- "sendGetBody": false,
958
937
  "requestDatatype": "JSON",
959
938
  "responseDatatype": "JSON",
960
939
  "headers": {},
@@ -966,26 +945,6 @@
966
945
  }
967
946
  ]
968
947
  },
969
- {
970
- "name": "editTemplate__v4",
971
- "protocol": "REST",
972
- "method": "PUT",
973
- "entitypath": "{base_path}/{version}/template/device/{pathv1}?{query}",
974
- "requestSchema": "schema.json",
975
- "responseSchema": "schema.json",
976
- "timeout": 0,
977
- "sendEmpty": false,
978
- "requestDatatype": "PLAIN",
979
- "responseDatatype": "JSON",
980
- "headers": {},
981
- "responseObjects": [
982
- {
983
- "type": "default",
984
- "key": "",
985
- "mockFile": ""
986
- }
987
- ]
988
- },
989
948
  {
990
949
  "name": "getRunningConfig",
991
950
  "protocol": "REST",
@@ -1255,28 +1214,7 @@
1255
1214
  ]
1256
1215
  },
1257
1216
  {
1258
- "name": "generateTemplateList__v5",
1259
- "protocol": "REST",
1260
- "method": "GET",
1261
- "entitypath": "{base_path}/{version}/template/policy/vsmart?{query}",
1262
- "requestSchema": "schema.json",
1263
- "responseSchema": "schema.json",
1264
- "timeout": 0,
1265
- "sendEmpty": false,
1266
- "sendGetBody": false,
1267
- "requestDatatype": "JSON",
1268
- "responseDatatype": "JSON",
1269
- "headers": {},
1270
- "responseObjects": [
1271
- {
1272
- "type": "default",
1273
- "key": "",
1274
- "mockFile": ""
1275
- }
1276
- ]
1277
- },
1278
- {
1279
- "name": "createTemplate__v3",
1217
+ "name": "createVSmartTemplate",
1280
1218
  "protocol": "REST",
1281
1219
  "method": "POST",
1282
1220
  "entitypath": "{base_path}/{version}/template/policy/vsmart?{query}",
@@ -1284,88 +1222,6 @@
1284
1222
  "responseSchema": "schema.json",
1285
1223
  "timeout": 0,
1286
1224
  "sendEmpty": false,
1287
- "requestDatatype": "PLAIN",
1288
- "responseDatatype": "JSON",
1289
- "headers": {},
1290
- "responseObjects": [
1291
- {
1292
- "type": "default",
1293
- "key": "",
1294
- "mockFile": ""
1295
- }
1296
- ]
1297
- },
1298
- {
1299
- "name": "getTemplate__v3",
1300
- "protocol": "REST",
1301
- "method": "GET",
1302
- "entitypath": "{base_path}/{version}/template/policy/vsmart/definition/{pathv1}?{query}",
1303
- "requestSchema": "schema.json",
1304
- "responseSchema": "schema.json",
1305
- "timeout": 0,
1306
- "sendEmpty": false,
1307
- "sendGetBody": false,
1308
- "requestDatatype": "JSON",
1309
- "responseDatatype": "JSON",
1310
- "headers": {},
1311
- "responseObjects": [
1312
- {
1313
- "type": "default",
1314
- "key": "",
1315
- "mockFile": ""
1316
- }
1317
- ]
1318
- },
1319
- {
1320
- "name": "editTemplate__v5",
1321
- "protocol": "REST",
1322
- "method": "PUT",
1323
- "entitypath": "{base_path}/{version}/template/policy/vsmart/{pathv1}?{query}",
1324
- "requestSchema": "schema.json",
1325
- "responseSchema": "schema.json",
1326
- "timeout": 0,
1327
- "sendEmpty": false,
1328
- "requestDatatype": "PLAIN",
1329
- "responseDatatype": "JSON",
1330
- "headers": {},
1331
- "responseObjects": [
1332
- {
1333
- "type": "default",
1334
- "key": "",
1335
- "mockFile": ""
1336
- }
1337
- ]
1338
- },
1339
- {
1340
- "name": "deleteTemplate__v3",
1341
- "protocol": "REST",
1342
- "method": "DELETE",
1343
- "entitypath": "{base_path}/{version}/template/policy/vsmart/{pathv1}?{query}",
1344
- "requestSchema": "schema.json",
1345
- "responseSchema": "schema.json",
1346
- "timeout": 0,
1347
- "sendEmpty": false,
1348
- "requestDatatype": "JSON",
1349
- "responseDatatype": "JSON",
1350
- "headers": {},
1351
- "responseObjects": [
1352
- {
1353
- "type": "default",
1354
- "key": "",
1355
- "mockFile": ""
1356
- }
1357
- ]
1358
- },
1359
- {
1360
- "name": "generateTemplateList__v6",
1361
- "protocol": "REST",
1362
- "method": "GET",
1363
- "entitypath": "{base_path}/{version}/template/policy/vsmart?{query}",
1364
- "requestSchema": "schema.json",
1365
- "responseSchema": "schema.json",
1366
- "timeout": 0,
1367
- "sendEmpty": false,
1368
- "sendGetBody": false,
1369
1225
  "requestDatatype": "JSON",
1370
1226
  "responseDatatype": "JSON",
1371
1227
  "headers": {},
@@ -1378,27 +1234,7 @@
1378
1234
  ]
1379
1235
  },
1380
1236
  {
1381
- "name": "createTemplate__v4",
1382
- "protocol": "REST",
1383
- "method": "POST",
1384
- "entitypath": "{base_path}/{version}/template/policy/vsmart?{query}",
1385
- "requestSchema": "schema.json",
1386
- "responseSchema": "schema.json",
1387
- "timeout": 0,
1388
- "sendEmpty": false,
1389
- "requestDatatype": "PLAIN",
1390
- "responseDatatype": "JSON",
1391
- "headers": {},
1392
- "responseObjects": [
1393
- {
1394
- "type": "default",
1395
- "key": "",
1396
- "mockFile": ""
1397
- }
1398
- ]
1399
- },
1400
- {
1401
- "name": "getTemplate__v4",
1237
+ "name": "getTemplateByPolicyId",
1402
1238
  "protocol": "REST",
1403
1239
  "method": "GET",
1404
1240
  "entitypath": "{base_path}/{version}/template/policy/vsmart/definition/{pathv1}?{query}",
@@ -1419,7 +1255,7 @@
1419
1255
  ]
1420
1256
  },
1421
1257
  {
1422
- "name": "editTemplate__v6",
1258
+ "name": "editVSmartTemplate",
1423
1259
  "protocol": "REST",
1424
1260
  "method": "PUT",
1425
1261
  "entitypath": "{base_path}/{version}/template/policy/vsmart/{pathv1}?{query}",
@@ -1427,19 +1263,19 @@
1427
1263
  "responseSchema": "schema.json",
1428
1264
  "timeout": 0,
1429
1265
  "sendEmpty": false,
1430
- "requestDatatype": "PLAIN",
1266
+ "requestDatatype": "JSON",
1431
1267
  "responseDatatype": "JSON",
1432
1268
  "headers": {},
1433
1269
  "responseObjects": [
1434
1270
  {
1435
1271
  "type": "default",
1436
1272
  "key": "",
1437
- "mockFile": ""
1273
+ "mockFile": "mockdatafiles/editVSmartTemplate-default.json"
1438
1274
  }
1439
1275
  ]
1440
1276
  },
1441
1277
  {
1442
- "name": "deleteTemplate__v4",
1278
+ "name": "deleteVSmartTemplate",
1443
1279
  "protocol": "REST",
1444
1280
  "method": "DELETE",
1445
1281
  "entitypath": "{base_path}/{version}/template/policy/vsmart/{pathv1}?{query}",
@@ -54,10 +54,8 @@
54
54
  "createMasterTemplate",
55
55
  "createCLITemplate",
56
56
  "getMasterTemplateDefinition",
57
- "generateTemplateList__v3",
58
- "editTemplate__v3",
59
- "generateTemplateList__v4",
60
- "editTemplate__v4",
57
+ "generateMasterTemplateList",
58
+ "editMasterTemplate",
61
59
  "getRunningConfig",
62
60
  "uploadConfig",
63
61
  "getAttachedConfig",
@@ -71,16 +69,10 @@
71
69
  "deActivatePolicy",
72
70
  "activatePolicy",
73
71
  "checkVSmartConnectivityStatus",
74
- "generateTemplateList__v5",
75
- "createTemplate__v3",
76
- "getTemplate__v3",
77
- "editTemplate__v5",
78
- "deleteTemplate__v3",
79
- "generateTemplateList__v6",
80
- "createTemplate__v4",
81
- "getTemplate__v4",
82
- "editTemplate__v6",
83
- "deleteTemplate__v4"
72
+ "createVSmartTemplate",
73
+ "getTemplateByPolicyId",
74
+ "editVSmartTemplate",
75
+ "deleteVSmartTemplate"
84
76
  ],
85
77
  "external_name": "ph_request_type"
86
78
  }