@itentialopensource/adapter-nokia_nsp_device_configurator 0.2.3 → 0.3.1

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.
@@ -26,7 +26,7 @@
26
26
  "auth_logging": false,
27
27
  "client_id": "",
28
28
  "client_secret": "",
29
- "grant_type": "",
29
+ "grant_type": "client_credentials",
30
30
  "sensitive": [],
31
31
  "sso": {
32
32
  "protocol": "",
@@ -116,30 +116,32 @@
116
116
  }
117
117
  },
118
118
  "devicebroker": {
119
+ "enabled": false,
119
120
  "getDevice": [
120
121
  {
121
- "path": "/get/devices/{id}",
122
+ "path": "/not/mapped",
122
123
  "method": "GET",
123
124
  "query": {},
124
125
  "body": {},
125
126
  "headers": {},
126
127
  "handleFailure": "ignore",
127
128
  "requestFields": {
128
- "id": "name"
129
+ "insample": "{port}"
129
130
  },
130
131
  "responseDatakey": "",
131
132
  "responseFields": {
132
- "name": "host",
133
- "ostype": "os",
134
- "ostypePrefix": "system-",
135
- "ipaddress": "attributes.ipaddr",
136
- "port": "443"
133
+ "name": "{this}{||}{that}",
134
+ "ostype": "{osfield}",
135
+ "ostypePrefix": "meraki-",
136
+ "port": "{port}",
137
+ "ipaddress": "{ip_addr}",
138
+ "serial" : "{serial}"
137
139
  }
138
140
  }
139
141
  ],
140
142
  "getDevicesFiltered": [
141
143
  {
142
- "path": "/get/devices",
144
+ "path": "/not/mapped",
143
145
  "method": "GET",
144
146
  "pagination": {
145
147
  "offsetVar": "",
@@ -154,42 +156,44 @@
154
156
  "requestFields": {},
155
157
  "responseDatakey": "",
156
158
  "responseFields": {
157
- "name": "host",
158
- "ostype": "os",
159
- "ostypePrefix": "system-",
160
- "ipaddress": "attributes.ipaddr",
161
- "port": "443"
159
+ "name": "{this}{||}{that}",
160
+ "ostype": "{osfield}",
161
+ "ostypePrefix": "meraki-",
162
+ "port": "{port}",
163
+ "ipaddress": "{ip_addr}",
164
+ "serial" : "{serial}",
165
+ "id": "{myid}"
162
166
  }
163
167
  }
164
168
  ],
165
169
  "isAlive": [
166
170
  {
167
- "path": "/get/devices/{id}/status",
171
+ "path": "/not/mapped/{devID}",
168
172
  "method": "GET",
169
173
  "query": {},
170
174
  "body": {},
171
175
  "headers": {},
172
176
  "handleFailure": "ignore",
173
177
  "requestFields": {
174
- "id": "name"
178
+ "devID": "{id}"
175
179
  },
176
180
  "responseDatakey": "",
177
181
  "responseFields": {
178
- "status": "status",
179
- "statusValue": "online"
182
+ "status": "return2xx",
183
+ "statusValue": "AD.200"
180
184
  }
181
185
  }
182
186
  ],
183
187
  "getConfig": [
184
188
  {
185
- "path": "/get/devices/{id}/configPart1",
189
+ "path": "/not/mapped/{devID}",
186
190
  "method": "GET",
187
191
  "query": {},
188
192
  "body": {},
189
193
  "headers": {},
190
194
  "handleFailure": "ignore",
191
195
  "requestFields": {
192
- "id": "name"
196
+ "devID": "{id}"
193
197
  },
194
198
  "responseDatakey": "",
195
199
  "responseFields": {}
@@ -197,7 +201,7 @@
197
201
  ],
198
202
  "getCount": [
199
203
  {
200
- "path": "/get/devices",
204
+ "path": "/not/mapped",
201
205
  "method": "GET",
202
206
  "query": {},
203
207
  "body": {},
@@ -213,15 +217,15 @@
213
217
  "enabled": false,
214
218
  "entities": [
215
219
  {
216
- "entityType": "",
217
- "frequency": 1440,
220
+ "entityType": "device",
221
+ "frequency": 3600,
218
222
  "flushOnFail": false,
219
- "limit": 1000,
223
+ "limit": 10000,
220
224
  "retryAttempts": 5,
221
225
  "sort": true,
222
226
  "populate": [
223
227
  {
224
- "path": "",
228
+ "path": "/not/mapped",
225
229
  "method": "GET",
226
230
  "pagination": {
227
231
  "offsetVar": "",
@@ -235,7 +239,15 @@
235
239
  "handleFailure": "ignore",
236
240
  "requestFields": {},
237
241
  "responseDatakey": "",
238
- "responseFields": {}
242
+ "responseFields": {
243
+ "name": "{this}{||}{that}",
244
+ "ostype": "{osfield}",
245
+ "ostypePrefix": "meraki-",
246
+ "port": "{port}",
247
+ "ipaddress": "{ip_addr}",
248
+ "serial" : "{serial}",
249
+ "id": "{myid}"
250
+ }
239
251
  }
240
252
  ],
241
253
  "cachedTasks": [
@@ -46,6 +46,7 @@ samProps.ssl.accept_invalid_cert = false;
46
46
  if (samProps.request.attempt_timeout < 30000) {
47
47
  samProps.request.attempt_timeout = 30000;
48
48
  }
49
+ samProps.devicebroker.enabled = true;
49
50
  const attemptTimeout = samProps.request.attempt_timeout;
50
51
  const { stub } = samProps;
51
52
 
@@ -954,12 +955,11 @@ describe('[integration] Nokia_nsp_device_configurator Adapter Test', () => {
954
955
  }).timeout(attemptTimeout);
955
956
  });
956
957
 
957
- const searchNeType = 'fakedata';
958
- const searchNeVersion = 'fakedata';
959
- describe('#fieldquerytoretrieveasinglechildnodeunderthetargetresource - errors', () => {
958
+ const searchPort = 'fakedata';
959
+ describe('#fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource - errors', () => {
960
960
  it('should work if integrated or standalone with mockdata', (done) => {
961
961
  try {
962
- a.fieldquerytoretrieveasinglechildnodeunderthetargetresource(searchNeType, searchNeVersion, (data, error) => {
962
+ a.fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource(searchFields, searchNeId, searchPort, (data, error) => {
963
963
  try {
964
964
  if (stub) {
965
965
  runCommonAsserts(data, error);
@@ -967,7 +967,7 @@ describe('[integration] Nokia_nsp_device_configurator Adapter Test', () => {
967
967
  } else {
968
968
  runCommonAsserts(data, error);
969
969
  }
970
- saveMockData('Search', 'fieldquerytoretrieveasinglechildnodeunderthetargetresource', 'default', data);
970
+ saveMockData('Search', 'fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource', 'default', data);
971
971
  done();
972
972
  } catch (err) {
973
973
  log.error(`Test Failure: ${err}`);
@@ -284,7 +284,6 @@ describe('[unit] Nokia_nsp_device_configurator Adapter Test', () => {
284
284
  assert.equal('mocha test/unit/adapterBaseTestUnit.js --LOG=error', packageDotJson.scripts['test:baseunit']);
285
285
  assert.equal('mocha test/unit/adapterTestUnit.js --LOG=error', packageDotJson.scripts['test:unit']);
286
286
  assert.equal('mocha test/integration/adapterTestIntegration.js --LOG=error', packageDotJson.scripts['test:integration']);
287
- assert.equal('nyc --reporter html --reporter text mocha --reporter dot test/*', packageDotJson.scripts['test:cover']);
288
287
  assert.equal('npm run test:baseunit && npm run test:unit && npm run test:integration', packageDotJson.scripts.test);
289
288
  assert.equal('npm publish --registry=https://registry.npmjs.org --access=public', packageDotJson.scripts.deploy);
290
289
  assert.equal('npm run deploy', packageDotJson.scripts.build);
@@ -321,7 +320,6 @@ describe('[unit] Nokia_nsp_device_configurator Adapter Test', () => {
321
320
  assert.equal('^11.1.1', packageDotJson.dependencies['fs-extra']);
322
321
  assert.equal('^10.3.0', packageDotJson.dependencies.mocha);
323
322
  assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
324
- assert.equal('^15.1.0', packageDotJson.dependencies.nyc);
325
323
  assert.equal('^0.4.4', packageDotJson.dependencies.ping);
326
324
  assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
327
325
  assert.equal('^7.5.3', packageDotJson.dependencies.semver);
@@ -2265,22 +2263,39 @@ describe('[unit] Nokia_nsp_device_configurator Adapter Test', () => {
2265
2263
  }).timeout(attemptTimeout);
2266
2264
  });
2267
2265
 
2268
- describe('#fieldquerytoretrieveasinglechildnodeunderthetargetresource - errors', () => {
2269
- it('should have a fieldquerytoretrieveasinglechildnodeunderthetargetresource function', (done) => {
2266
+ describe('#fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource - errors', () => {
2267
+ it('should have a fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource function', (done) => {
2270
2268
  try {
2271
- assert.equal(true, typeof a.fieldquerytoretrieveasinglechildnodeunderthetargetresource === 'function');
2269
+ assert.equal(true, typeof a.fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource === 'function');
2272
2270
  done();
2273
2271
  } catch (error) {
2274
2272
  log.error(`Test Failure: ${error}`);
2275
2273
  done(error);
2276
2274
  }
2277
2275
  }).timeout(attemptTimeout);
2278
- it('should error if - missing neType', (done) => {
2276
+ it('should error if - missing fields', (done) => {
2279
2277
  try {
2280
- a.fieldquerytoretrieveasinglechildnodeunderthetargetresource(null, null, (data, error) => {
2278
+ a.fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource(null, null, null, (data, error) => {
2281
2279
  try {
2282
- const displayE = 'neType is required';
2283
- runErrorAsserts(data, error, 'AD.300', 'Test-nokia_nsp_device_configurator-adapter-fieldquerytoretrieveasinglechildnodeunderthetargetresource', displayE);
2280
+ const displayE = 'fields is required';
2281
+ runErrorAsserts(data, error, 'AD.300', 'Test-nokia_nsp_device_configurator-adapter-fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource', displayE);
2282
+ done();
2283
+ } catch (err) {
2284
+ log.error(`Test Failure: ${err}`);
2285
+ done(err);
2286
+ }
2287
+ });
2288
+ } catch (error) {
2289
+ log.error(`Adapter Exception: ${error}`);
2290
+ done(error);
2291
+ }
2292
+ }).timeout(attemptTimeout);
2293
+ it('should error if - missing neId', (done) => {
2294
+ try {
2295
+ a.fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource('fakeparam', null, null, (data, error) => {
2296
+ try {
2297
+ const displayE = 'neId is required';
2298
+ runErrorAsserts(data, error, 'AD.300', 'Test-nokia_nsp_device_configurator-adapter-fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource', displayE);
2284
2299
  done();
2285
2300
  } catch (err) {
2286
2301
  log.error(`Test Failure: ${err}`);
@@ -2292,12 +2307,12 @@ describe('[unit] Nokia_nsp_device_configurator Adapter Test', () => {
2292
2307
  done(error);
2293
2308
  }
2294
2309
  }).timeout(attemptTimeout);
2295
- it('should error if - missing neVersion', (done) => {
2310
+ it('should error if - missing port', (done) => {
2296
2311
  try {
2297
- a.fieldquerytoretrieveasinglechildnodeunderthetargetresource('fakeparam', null, (data, error) => {
2312
+ a.fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource('fakeparam', 'neId', null, (data, error) => {
2298
2313
  try {
2299
- const displayE = 'neVersion is required';
2300
- runErrorAsserts(data, error, 'AD.300', 'Test-nokia_nsp_device_configurator-adapter-fieldquerytoretrieveasinglechildnodeunderthetargetresource', displayE);
2314
+ const displayE = 'port is required';
2315
+ runErrorAsserts(data, error, 'AD.300', 'Test-nokia_nsp_device_configurator-adapter-fieldQueryToRetrieveASingleChildNodeUnderTheTargetResource', displayE);
2301
2316
  done();
2302
2317
  } catch (err) {
2303
2318
  log.error(`Test Failure: ${err}`);