@itentialopensource/adapter-nokia_nsp_network_management 0.1.1 → 0.1.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.
package/adapter.js CHANGED
@@ -11105,6 +11105,1075 @@ class NokiaNspNetworkManagement extends AdapterBaseCl {
11105
11105
  return callback(null, errorObj);
11106
11106
  }
11107
11107
  }
11108
+
11109
+ /**
11110
+ * @function getNE
11111
+ * @pronghornType method
11112
+ * @name getNE
11113
+ * @summary getNE
11114
+ *
11115
+ * @param {number} [depth] - Optional depth query parameter
11116
+ * @param {string} [fields] - Optional fields param
11117
+ * @param {getCallback} callback - a callback function to return the result
11118
+ * @return {object} results - An object containing the response of the action
11119
+ *
11120
+ * @route {POST} /getNE
11121
+ * @roles admin
11122
+ * @task true
11123
+ */
11124
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11125
+ getNE(depth, fields, callback) {
11126
+ const meth = 'adapter-getNE';
11127
+ const origin = `${this.id}-${meth}`;
11128
+ log.trace(origin);
11129
+
11130
+ if (this.suspended && this.suspendMode === 'error') {
11131
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11132
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11133
+ return callback(null, errorObj);
11134
+ }
11135
+
11136
+ /* HERE IS WHERE YOU VALIDATE DATA */
11137
+
11138
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11139
+ const queryParamsAvailable = { depth, fields };
11140
+ const queryParams = {};
11141
+ const pathVars = [];
11142
+ const bodyVars = {};
11143
+
11144
+ // loop in template. long callback arg name to avoid identifier conflicts
11145
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11146
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11147
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11148
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11149
+ }
11150
+ });
11151
+
11152
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11153
+ // see adapter code documentation for more information on the request object's fields
11154
+ const reqObj = {
11155
+ payload: bodyVars,
11156
+ uriPathVars: pathVars,
11157
+ uriQuery: queryParams
11158
+ };
11159
+
11160
+ try {
11161
+ // Make the call -
11162
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11163
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getNE', reqObj, true, (irReturnData, irReturnError) => {
11164
+ // if we received an error or their is no response on the results
11165
+ // return an error
11166
+ if (irReturnError) {
11167
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11168
+ return callback(null, irReturnError);
11169
+ }
11170
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11171
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getNE'], null, null, null);
11172
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11173
+ return callback(null, errorObj);
11174
+ }
11175
+
11176
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11177
+ // return the response
11178
+ return callback(irReturnData, null);
11179
+ });
11180
+ } catch (ex) {
11181
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
11182
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11183
+ return callback(null, errorObj);
11184
+ }
11185
+ }
11186
+
11187
+ /**
11188
+ * @function getSpecificNE
11189
+ * @pronghornType method
11190
+ * @name getSpecificNE
11191
+ * @summary getSpecificNE
11192
+ *
11193
+ * @param {string} networkElement - networkElement param
11194
+ * @param {number} [depth] - Optional depth query parameter
11195
+ * @param {getCallback} callback - a callback function to return the result
11196
+ * @return {object} results - An object containing the response of the action
11197
+ *
11198
+ * @route {POST} /getSpecificNE
11199
+ * @roles admin
11200
+ * @task true
11201
+ */
11202
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11203
+ getSpecificNE(networkElement, depth, callback) {
11204
+ const meth = 'adapter-getSpecificNE';
11205
+ const origin = `${this.id}-${meth}`;
11206
+ log.trace(origin);
11207
+
11208
+ if (this.suspended && this.suspendMode === 'error') {
11209
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11210
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11211
+ return callback(null, errorObj);
11212
+ }
11213
+
11214
+ /* HERE IS WHERE YOU VALIDATE DATA */
11215
+ if (networkElement === undefined || networkElement === null || networkElement === '') {
11216
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElement'], null, null, null);
11217
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11218
+ return callback(null, errorObj);
11219
+ }
11220
+
11221
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11222
+ const queryParamsAvailable = { depth };
11223
+ const queryParams = {};
11224
+ const pathVars = [`network-element=${networkElement}`];
11225
+ const bodyVars = {};
11226
+
11227
+ // loop in template. long callback arg name to avoid identifier conflicts
11228
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11229
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11230
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11231
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11232
+ }
11233
+ });
11234
+
11235
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11236
+ // see adapter code documentation for more information on the request object's fields
11237
+ const reqObj = {
11238
+ payload: bodyVars,
11239
+ uriPathVars: pathVars,
11240
+ uriQuery: queryParams
11241
+ };
11242
+
11243
+ try {
11244
+ // Make the call -
11245
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11246
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getSpecificNE', reqObj, true, (irReturnData, irReturnError) => {
11247
+ // if we received an error or their is no response on the results
11248
+ // return an error
11249
+ if (irReturnError) {
11250
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11251
+ return callback(null, irReturnError);
11252
+ }
11253
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11254
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getSpecificNE'], null, null, null);
11255
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11256
+ return callback(null, errorObj);
11257
+ }
11258
+
11259
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11260
+ // return the response
11261
+ return callback(irReturnData, null);
11262
+ });
11263
+ } catch (ex) {
11264
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
11265
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11266
+ return callback(null, errorObj);
11267
+ }
11268
+ }
11269
+
11270
+ /**
11271
+ * @function getShelf
11272
+ * @pronghornType method
11273
+ * @name getShelf
11274
+ * @summary getShelf
11275
+ *
11276
+ * @param {getCallback} callback - a callback function to return the result
11277
+ * @return {object} results - An object containing the response of the action
11278
+ *
11279
+ * @route {GET} /getShelf
11280
+ * @roles admin
11281
+ * @task true
11282
+ */
11283
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11284
+ getShelf(callback) {
11285
+ const meth = 'adapter-getShelf';
11286
+ const origin = `${this.id}-${meth}`;
11287
+ log.trace(origin);
11288
+
11289
+ if (this.suspended && this.suspendMode === 'error') {
11290
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11291
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11292
+ return callback(null, errorObj);
11293
+ }
11294
+
11295
+ /* HERE IS WHERE YOU VALIDATE DATA */
11296
+
11297
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11298
+ const queryParamsAvailable = {};
11299
+ const queryParams = {};
11300
+ const pathVars = [];
11301
+ const bodyVars = {};
11302
+
11303
+ // loop in template. long callback arg name to avoid identifier conflicts
11304
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11305
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11306
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11307
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11308
+ }
11309
+ });
11310
+
11311
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11312
+ // see adapter code documentation for more information on the request object's fields
11313
+ const reqObj = {
11314
+ payload: bodyVars,
11315
+ uriPathVars: pathVars,
11316
+ uriQuery: queryParams
11317
+ };
11318
+
11319
+ try {
11320
+ // Make the call -
11321
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11322
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getShelf', reqObj, true, (irReturnData, irReturnError) => {
11323
+ // if we received an error or their is no response on the results
11324
+ // return an error
11325
+ if (irReturnError) {
11326
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11327
+ return callback(null, irReturnError);
11328
+ }
11329
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11330
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getShelf'], null, null, null);
11331
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11332
+ return callback(null, errorObj);
11333
+ }
11334
+
11335
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11336
+ // return the response
11337
+ return callback(irReturnData, null);
11338
+ });
11339
+ } catch (ex) {
11340
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
11341
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11342
+ return callback(null, errorObj);
11343
+ }
11344
+ }
11345
+
11346
+ /**
11347
+ * @function getSpecificShelf
11348
+ * @pronghornType method
11349
+ * @name getSpecificShelf
11350
+ * @summary getSpecificShelf
11351
+ *
11352
+ * @param {string} networkElement - networkElement param
11353
+ * @param {string} shelf - shelf param
11354
+ * @param {getCallback} callback - a callback function to return the result
11355
+ * @return {object} results - An object containing the response of the action
11356
+ *
11357
+ * @route {POST} /getSpecificShelf
11358
+ * @roles admin
11359
+ * @task true
11360
+ */
11361
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11362
+ getSpecificShelf(networkElement, shelf, callback) {
11363
+ const meth = 'adapter-getSpecificShelf';
11364
+ const origin = `${this.id}-${meth}`;
11365
+ log.trace(origin);
11366
+
11367
+ if (this.suspended && this.suspendMode === 'error') {
11368
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11369
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11370
+ return callback(null, errorObj);
11371
+ }
11372
+
11373
+ /* HERE IS WHERE YOU VALIDATE DATA */
11374
+ if (networkElement === undefined || networkElement === null || networkElement === '') {
11375
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElement'], null, null, null);
11376
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11377
+ return callback(null, errorObj);
11378
+ }
11379
+ if (shelf === undefined || shelf === null || shelf === '') {
11380
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelf'], null, null, null);
11381
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11382
+ return callback(null, errorObj);
11383
+ }
11384
+
11385
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11386
+ const queryParamsAvailable = {};
11387
+ const queryParams = {};
11388
+ const pathVars = [`network-element=${networkElement}`, `shelf=${shelf}`];
11389
+ const bodyVars = {};
11390
+
11391
+ // loop in template. long callback arg name to avoid identifier conflicts
11392
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11393
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11394
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11395
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11396
+ }
11397
+ });
11398
+
11399
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11400
+ // see adapter code documentation for more information on the request object's fields
11401
+ const reqObj = {
11402
+ payload: bodyVars,
11403
+ uriPathVars: pathVars,
11404
+ uriQuery: queryParams
11405
+ };
11406
+
11407
+ try {
11408
+ // Make the call -
11409
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11410
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getSpecificShelf', reqObj, true, (irReturnData, irReturnError) => {
11411
+ // if we received an error or their is no response on the results
11412
+ // return an error
11413
+ if (irReturnError) {
11414
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11415
+ return callback(null, irReturnError);
11416
+ }
11417
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11418
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getSpecificShelf'], null, null, null);
11419
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11420
+ return callback(null, errorObj);
11421
+ }
11422
+
11423
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11424
+ // return the response
11425
+ return callback(irReturnData, null);
11426
+ });
11427
+ } catch (ex) {
11428
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
11429
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11430
+ return callback(null, errorObj);
11431
+ }
11432
+ }
11433
+
11434
+ /**
11435
+ * @function getCard
11436
+ * @pronghornType method
11437
+ * @name getCard
11438
+ * @summary getCard
11439
+ *
11440
+ * @param {getCallback} callback - a callback function to return the result
11441
+ * @return {object} results - An object containing the response of the action
11442
+ *
11443
+ * @route {GET} /getCard
11444
+ * @roles admin
11445
+ * @task true
11446
+ */
11447
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11448
+ getCard(callback) {
11449
+ const meth = 'adapter-getCard';
11450
+ const origin = `${this.id}-${meth}`;
11451
+ log.trace(origin);
11452
+
11453
+ if (this.suspended && this.suspendMode === 'error') {
11454
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11455
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11456
+ return callback(null, errorObj);
11457
+ }
11458
+
11459
+ /* HERE IS WHERE YOU VALIDATE DATA */
11460
+
11461
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11462
+ const queryParamsAvailable = {};
11463
+ const queryParams = {};
11464
+ const pathVars = [];
11465
+ const bodyVars = {};
11466
+
11467
+ // loop in template. long callback arg name to avoid identifier conflicts
11468
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11469
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11470
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11471
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11472
+ }
11473
+ });
11474
+
11475
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11476
+ // see adapter code documentation for more information on the request object's fields
11477
+ const reqObj = {
11478
+ payload: bodyVars,
11479
+ uriPathVars: pathVars,
11480
+ uriQuery: queryParams
11481
+ };
11482
+
11483
+ try {
11484
+ // Make the call -
11485
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11486
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getCard', reqObj, true, (irReturnData, irReturnError) => {
11487
+ // if we received an error or their is no response on the results
11488
+ // return an error
11489
+ if (irReturnError) {
11490
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11491
+ return callback(null, irReturnError);
11492
+ }
11493
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11494
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getCard'], null, null, null);
11495
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11496
+ return callback(null, errorObj);
11497
+ }
11498
+
11499
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11500
+ // return the response
11501
+ return callback(irReturnData, null);
11502
+ });
11503
+ } catch (ex) {
11504
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
11505
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11506
+ return callback(null, errorObj);
11507
+ }
11508
+ }
11509
+
11510
+ /**
11511
+ * @function getSpecificNECards
11512
+ * @pronghornType method
11513
+ * @name getSpecificNECards
11514
+ * @summary getSpecificNECards
11515
+ *
11516
+ * @param {string} networkElement - networkElement param
11517
+ * @param {string} card - card param
11518
+ * @param {getCallback} callback - a callback function to return the result
11519
+ * @return {object} results - An object containing the response of the action
11520
+ *
11521
+ * @route {POST} /getSpecificNECards
11522
+ * @roles admin
11523
+ * @task true
11524
+ */
11525
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11526
+ getSpecificNECards(networkElement, card, callback) {
11527
+ const meth = 'adapter-getSpecificNECards';
11528
+ const origin = `${this.id}-${meth}`;
11529
+ log.trace(origin);
11530
+
11531
+ if (this.suspended && this.suspendMode === 'error') {
11532
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11533
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11534
+ return callback(null, errorObj);
11535
+ }
11536
+
11537
+ /* HERE IS WHERE YOU VALIDATE DATA */
11538
+ if (networkElement === undefined || networkElement === null || networkElement === '') {
11539
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElement'], null, null, null);
11540
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11541
+ return callback(null, errorObj);
11542
+ }
11543
+ if (card === undefined || card === null || card === '') {
11544
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['card'], null, null, null);
11545
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11546
+ return callback(null, errorObj);
11547
+ }
11548
+
11549
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11550
+ const queryParamsAvailable = {};
11551
+ const queryParams = {};
11552
+ const pathVars = [`network-element=${networkElement}`, `card=${card}`];
11553
+ const bodyVars = {};
11554
+
11555
+ // loop in template. long callback arg name to avoid identifier conflicts
11556
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11557
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11558
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11559
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11560
+ }
11561
+ });
11562
+
11563
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11564
+ // see adapter code documentation for more information on the request object's fields
11565
+ const reqObj = {
11566
+ payload: bodyVars,
11567
+ uriPathVars: pathVars,
11568
+ uriQuery: queryParams
11569
+ };
11570
+
11571
+ try {
11572
+ // Make the call -
11573
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11574
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getSpecificNECards', reqObj, true, (irReturnData, irReturnError) => {
11575
+ // if we received an error or their is no response on the results
11576
+ // return an error
11577
+ if (irReturnError) {
11578
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11579
+ return callback(null, irReturnError);
11580
+ }
11581
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11582
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getSpecificNECards'], null, null, null);
11583
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11584
+ return callback(null, errorObj);
11585
+ }
11586
+
11587
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11588
+ // return the response
11589
+ return callback(irReturnData, null);
11590
+ });
11591
+ } catch (ex) {
11592
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
11593
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11594
+ return callback(null, errorObj);
11595
+ }
11596
+ }
11597
+
11598
+ /**
11599
+ * @function getPort
11600
+ * @pronghornType method
11601
+ * @name getPort
11602
+ * @summary getPort
11603
+ *
11604
+ * @param {getCallback} callback - a callback function to return the result
11605
+ * @return {object} results - An object containing the response of the action
11606
+ *
11607
+ * @route {GET} /getPort
11608
+ * @roles admin
11609
+ * @task true
11610
+ */
11611
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11612
+ getPort(callback) {
11613
+ const meth = 'adapter-getPort';
11614
+ const origin = `${this.id}-${meth}`;
11615
+ log.trace(origin);
11616
+
11617
+ if (this.suspended && this.suspendMode === 'error') {
11618
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11619
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11620
+ return callback(null, errorObj);
11621
+ }
11622
+
11623
+ /* HERE IS WHERE YOU VALIDATE DATA */
11624
+
11625
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11626
+ const queryParamsAvailable = {};
11627
+ const queryParams = {};
11628
+ const pathVars = [];
11629
+ const bodyVars = {};
11630
+
11631
+ // loop in template. long callback arg name to avoid identifier conflicts
11632
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11633
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11634
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11635
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11636
+ }
11637
+ });
11638
+
11639
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11640
+ // see adapter code documentation for more information on the request object's fields
11641
+ const reqObj = {
11642
+ payload: bodyVars,
11643
+ uriPathVars: pathVars,
11644
+ uriQuery: queryParams
11645
+ };
11646
+
11647
+ try {
11648
+ // Make the call -
11649
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11650
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getPort', reqObj, true, (irReturnData, irReturnError) => {
11651
+ // if we received an error or their is no response on the results
11652
+ // return an error
11653
+ if (irReturnError) {
11654
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11655
+ return callback(null, irReturnError);
11656
+ }
11657
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11658
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getPort'], null, null, null);
11659
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11660
+ return callback(null, errorObj);
11661
+ }
11662
+
11663
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11664
+ // return the response
11665
+ return callback(irReturnData, null);
11666
+ });
11667
+ } catch (ex) {
11668
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
11669
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11670
+ return callback(null, errorObj);
11671
+ }
11672
+ }
11673
+
11674
+ /**
11675
+ * @function getPortFromSpecificNE
11676
+ * @pronghornType method
11677
+ * @name getPortFromSpecificNE
11678
+ * @summary getPortFromSpecificNE
11679
+ *
11680
+ * @param {string} networkElement - networkElement param
11681
+ * @param {string} port - port param
11682
+ * @param {getCallback} callback - a callback function to return the result
11683
+ * @return {object} results - An object containing the response of the action
11684
+ *
11685
+ * @route {POST} /getPortFromSpecificNE
11686
+ * @roles admin
11687
+ * @task true
11688
+ */
11689
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11690
+ getPortFromSpecificNE(networkElement, port, callback) {
11691
+ const meth = 'adapter-getPortFromSpecificNE';
11692
+ const origin = `${this.id}-${meth}`;
11693
+ log.trace(origin);
11694
+
11695
+ if (this.suspended && this.suspendMode === 'error') {
11696
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11697
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11698
+ return callback(null, errorObj);
11699
+ }
11700
+
11701
+ /* HERE IS WHERE YOU VALIDATE DATA */
11702
+ if (networkElement === undefined || networkElement === null || networkElement === '') {
11703
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElement'], null, null, null);
11704
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11705
+ return callback(null, errorObj);
11706
+ }
11707
+ if (port === undefined || port === null || port === '') {
11708
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['port'], null, null, null);
11709
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11710
+ return callback(null, errorObj);
11711
+ }
11712
+
11713
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11714
+ const queryParamsAvailable = {};
11715
+ const queryParams = {};
11716
+ const pathVars = [`network-element=${networkElement}`, `port=${port}`];
11717
+ const bodyVars = {};
11718
+
11719
+ // loop in template. long callback arg name to avoid identifier conflicts
11720
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11721
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11722
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11723
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11724
+ }
11725
+ });
11726
+
11727
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11728
+ // see adapter code documentation for more information on the request object's fields
11729
+ const reqObj = {
11730
+ payload: bodyVars,
11731
+ uriPathVars: pathVars,
11732
+ uriQuery: queryParams
11733
+ };
11734
+
11735
+ try {
11736
+ // Make the call -
11737
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11738
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getPortFromSpecificNE', reqObj, true, (irReturnData, irReturnError) => {
11739
+ // if we received an error or their is no response on the results
11740
+ // return an error
11741
+ if (irReturnError) {
11742
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11743
+ return callback(null, irReturnError);
11744
+ }
11745
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11746
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getPortFromSpecificNE'], null, null, null);
11747
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11748
+ return callback(null, errorObj);
11749
+ }
11750
+
11751
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11752
+ // return the response
11753
+ return callback(irReturnData, null);
11754
+ });
11755
+ } catch (ex) {
11756
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
11757
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11758
+ return callback(null, errorObj);
11759
+ }
11760
+ }
11761
+
11762
+ /**
11763
+ * @function getPortFromSpecificNETransceiverDetails
11764
+ * @pronghornType method
11765
+ * @name getPortFromSpecificNETransceiverDetails
11766
+ * @summary getPortFromSpecificNETransceiverDetails
11767
+ *
11768
+ * @param {string} networkElement - networkElement param
11769
+ * @param {string} port - port param
11770
+ * @param {getCallback} callback - a callback function to return the result
11771
+ * @return {object} results - An object containing the response of the action
11772
+ *
11773
+ * @route {POST} /getPortFromSpecificNETransceiverDetails
11774
+ * @roles admin
11775
+ * @task true
11776
+ */
11777
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11778
+ getPortFromSpecificNETransceiverDetails(networkElement, port, callback) {
11779
+ const meth = 'adapter-getPortFromSpecificNETransceiverDetails';
11780
+ const origin = `${this.id}-${meth}`;
11781
+ log.trace(origin);
11782
+
11783
+ if (this.suspended && this.suspendMode === 'error') {
11784
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11785
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11786
+ return callback(null, errorObj);
11787
+ }
11788
+
11789
+ /* HERE IS WHERE YOU VALIDATE DATA */
11790
+ if (networkElement === undefined || networkElement === null || networkElement === '') {
11791
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElement'], null, null, null);
11792
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11793
+ return callback(null, errorObj);
11794
+ }
11795
+ if (port === undefined || port === null || port === '') {
11796
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['port'], null, null, null);
11797
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11798
+ return callback(null, errorObj);
11799
+ }
11800
+
11801
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11802
+ const queryParamsAvailable = {};
11803
+ const queryParams = {};
11804
+ const pathVars = [`network-element=${networkElement}`, `port=${port}`];
11805
+ const bodyVars = {};
11806
+
11807
+ // loop in template. long callback arg name to avoid identifier conflicts
11808
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11809
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11810
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11811
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11812
+ }
11813
+ });
11814
+
11815
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11816
+ // see adapter code documentation for more information on the request object's fields
11817
+ const reqObj = {
11818
+ payload: bodyVars,
11819
+ uriPathVars: pathVars,
11820
+ uriQuery: queryParams
11821
+ };
11822
+
11823
+ try {
11824
+ // Make the call -
11825
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11826
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getPortFromSpecificNETransceiverDetails', reqObj, true, (irReturnData, irReturnError) => {
11827
+ // if we received an error or their is no response on the results
11828
+ // return an error
11829
+ if (irReturnError) {
11830
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11831
+ return callback(null, irReturnError);
11832
+ }
11833
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11834
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getPortFromSpecificNETransceiverDetails'], null, null, null);
11835
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11836
+ return callback(null, errorObj);
11837
+ }
11838
+
11839
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11840
+ // return the response
11841
+ return callback(irReturnData, null);
11842
+ });
11843
+ } catch (ex) {
11844
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
11845
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11846
+ return callback(null, errorObj);
11847
+ }
11848
+ }
11849
+
11850
+ /**
11851
+ * @function getLags
11852
+ * @pronghornType method
11853
+ * @name getLags
11854
+ * @summary getLags
11855
+ *
11856
+ * @param {getCallback} callback - a callback function to return the result
11857
+ * @return {object} results - An object containing the response of the action
11858
+ *
11859
+ * @route {GET} /getLags
11860
+ * @roles admin
11861
+ * @task true
11862
+ */
11863
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11864
+ getLags(callback) {
11865
+ const meth = 'adapter-getLags';
11866
+ const origin = `${this.id}-${meth}`;
11867
+ log.trace(origin);
11868
+
11869
+ if (this.suspended && this.suspendMode === 'error') {
11870
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11871
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11872
+ return callback(null, errorObj);
11873
+ }
11874
+
11875
+ /* HERE IS WHERE YOU VALIDATE DATA */
11876
+
11877
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11878
+ const queryParamsAvailable = {};
11879
+ const queryParams = {};
11880
+ const pathVars = [];
11881
+ const bodyVars = {};
11882
+
11883
+ // loop in template. long callback arg name to avoid identifier conflicts
11884
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11885
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11886
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11887
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11888
+ }
11889
+ });
11890
+
11891
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11892
+ // see adapter code documentation for more information on the request object's fields
11893
+ const reqObj = {
11894
+ payload: bodyVars,
11895
+ uriPathVars: pathVars,
11896
+ uriQuery: queryParams
11897
+ };
11898
+
11899
+ try {
11900
+ // Make the call -
11901
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11902
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getLags', reqObj, true, (irReturnData, irReturnError) => {
11903
+ // if we received an error or their is no response on the results
11904
+ // return an error
11905
+ if (irReturnError) {
11906
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11907
+ return callback(null, irReturnError);
11908
+ }
11909
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11910
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getLags'], null, null, null);
11911
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11912
+ return callback(null, errorObj);
11913
+ }
11914
+
11915
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11916
+ // return the response
11917
+ return callback(irReturnData, null);
11918
+ });
11919
+ } catch (ex) {
11920
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
11921
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11922
+ return callback(null, errorObj);
11923
+ }
11924
+ }
11925
+
11926
+ /**
11927
+ * @function getSpecificNELag
11928
+ * @pronghornType method
11929
+ * @name getSpecificNELag
11930
+ * @summary getSpecificNELag
11931
+ *
11932
+ * @param {string} networkElement - networkElement param
11933
+ * @param {getCallback} callback - a callback function to return the result
11934
+ * @return {object} results - An object containing the response of the action
11935
+ *
11936
+ * @route {POST} /getSpecificNELag
11937
+ * @roles admin
11938
+ * @task true
11939
+ */
11940
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
11941
+ getSpecificNELag(networkElement, callback) {
11942
+ const meth = 'adapter-getSpecificNELag';
11943
+ const origin = `${this.id}-${meth}`;
11944
+ log.trace(origin);
11945
+
11946
+ if (this.suspended && this.suspendMode === 'error') {
11947
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
11948
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11949
+ return callback(null, errorObj);
11950
+ }
11951
+
11952
+ /* HERE IS WHERE YOU VALIDATE DATA */
11953
+ if (networkElement === undefined || networkElement === null || networkElement === '') {
11954
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElement'], null, null, null);
11955
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11956
+ return callback(null, errorObj);
11957
+ }
11958
+
11959
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
11960
+ const queryParamsAvailable = {};
11961
+ const queryParams = {};
11962
+ const pathVars = [`network-element=${networkElement}`];
11963
+ const bodyVars = {};
11964
+
11965
+ // loop in template. long callback arg name to avoid identifier conflicts
11966
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
11967
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
11968
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
11969
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
11970
+ }
11971
+ });
11972
+
11973
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
11974
+ // see adapter code documentation for more information on the request object's fields
11975
+ const reqObj = {
11976
+ payload: bodyVars,
11977
+ uriPathVars: pathVars,
11978
+ uriQuery: queryParams
11979
+ };
11980
+
11981
+ try {
11982
+ // Make the call -
11983
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
11984
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getSpecificNELag', reqObj, true, (irReturnData, irReturnError) => {
11985
+ // if we received an error or their is no response on the results
11986
+ // return an error
11987
+ if (irReturnError) {
11988
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
11989
+ return callback(null, irReturnError);
11990
+ }
11991
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
11992
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getSpecificNELag'], null, null, null);
11993
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
11994
+ return callback(null, errorObj);
11995
+ }
11996
+
11997
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
11998
+ // return the response
11999
+ return callback(irReturnData, null);
12000
+ });
12001
+ } catch (ex) {
12002
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
12003
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
12004
+ return callback(null, errorObj);
12005
+ }
12006
+ }
12007
+
12008
+ /**
12009
+ * @function getSpecificNELagWithFields
12010
+ * @pronghornType method
12011
+ * @name getSpecificNELagWithFields
12012
+ * @summary getSpecificNELagWithFields
12013
+ *
12014
+ * @param {string} fields - fields param
12015
+ * @param {string} networkElement - networkElement param
12016
+ * @param {string} lag - lag param
12017
+ * @param {getCallback} callback - a callback function to return the result
12018
+ * @return {object} results - An object containing the response of the action
12019
+ *
12020
+ * @route {POST} /getSpecificNELagWithFields
12021
+ * @roles admin
12022
+ * @task true
12023
+ */
12024
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
12025
+ getSpecificNELagWithFields(fields, networkElement, lag, callback) {
12026
+ const meth = 'adapter-getSpecificNELagWithFields';
12027
+ const origin = `${this.id}-${meth}`;
12028
+ log.trace(origin);
12029
+
12030
+ if (this.suspended && this.suspendMode === 'error') {
12031
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
12032
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
12033
+ return callback(null, errorObj);
12034
+ }
12035
+
12036
+ /* HERE IS WHERE YOU VALIDATE DATA */
12037
+ if (fields === undefined || fields === null || fields === '') {
12038
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['fields'], null, null, null);
12039
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
12040
+ return callback(null, errorObj);
12041
+ }
12042
+ if (networkElement === undefined || networkElement === null || networkElement === '') {
12043
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElement'], null, null, null);
12044
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
12045
+ return callback(null, errorObj);
12046
+ }
12047
+ if (lag === undefined || lag === null || lag === '') {
12048
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['lag'], null, null, null);
12049
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
12050
+ return callback(null, errorObj);
12051
+ }
12052
+
12053
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
12054
+ const queryParamsAvailable = { fields };
12055
+ const queryParams = {};
12056
+ const pathVars = [`network-element=${networkElement}`, `lag=${lag}`];
12057
+ const bodyVars = {};
12058
+
12059
+ // loop in template. long callback arg name to avoid identifier conflicts
12060
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
12061
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
12062
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
12063
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
12064
+ }
12065
+ });
12066
+
12067
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
12068
+ // see adapter code documentation for more information on the request object's fields
12069
+ const reqObj = {
12070
+ payload: bodyVars,
12071
+ uriPathVars: pathVars,
12072
+ uriQuery: queryParams
12073
+ };
12074
+
12075
+ try {
12076
+ // Make the call -
12077
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
12078
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getSpecificNELagWithFields', reqObj, true, (irReturnData, irReturnError) => {
12079
+ // if we received an error or their is no response on the results
12080
+ // return an error
12081
+ if (irReturnError) {
12082
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
12083
+ return callback(null, irReturnError);
12084
+ }
12085
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
12086
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getSpecificNELagWithFields'], null, null, null);
12087
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
12088
+ return callback(null, errorObj);
12089
+ }
12090
+
12091
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
12092
+ // return the response
12093
+ return callback(irReturnData, null);
12094
+ });
12095
+ } catch (ex) {
12096
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
12097
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
12098
+ return callback(null, errorObj);
12099
+ }
12100
+ }
12101
+
12102
+ /**
12103
+ * @function getRadio
12104
+ * @pronghornType method
12105
+ * @name getRadio
12106
+ * @summary getRadio
12107
+ *
12108
+ * @param {getCallback} callback - a callback function to return the result
12109
+ * @return {object} results - An object containing the response of the action
12110
+ *
12111
+ * @route {GET} /getRadio
12112
+ * @roles admin
12113
+ * @task true
12114
+ */
12115
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
12116
+ getRadio(callback) {
12117
+ const meth = 'adapter-getRadio';
12118
+ const origin = `${this.id}-${meth}`;
12119
+ log.trace(origin);
12120
+
12121
+ if (this.suspended && this.suspendMode === 'error') {
12122
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
12123
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
12124
+ return callback(null, errorObj);
12125
+ }
12126
+
12127
+ /* HERE IS WHERE YOU VALIDATE DATA */
12128
+
12129
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
12130
+ const queryParamsAvailable = {};
12131
+ const queryParams = {};
12132
+ const pathVars = [];
12133
+ const bodyVars = {};
12134
+
12135
+ // loop in template. long callback arg name to avoid identifier conflicts
12136
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
12137
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
12138
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
12139
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
12140
+ }
12141
+ });
12142
+
12143
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
12144
+ // see adapter code documentation for more information on the request object's fields
12145
+ const reqObj = {
12146
+ payload: bodyVars,
12147
+ uriPathVars: pathVars,
12148
+ uriQuery: queryParams
12149
+ };
12150
+
12151
+ try {
12152
+ // Make the call -
12153
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
12154
+ return this.requestHandlerInst.identifyRequest('NetworkInventoryRestconfAPI', 'getRadio', reqObj, true, (irReturnData, irReturnError) => {
12155
+ // if we received an error or their is no response on the results
12156
+ // return an error
12157
+ if (irReturnError) {
12158
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
12159
+ return callback(null, irReturnError);
12160
+ }
12161
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
12162
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRadio'], null, null, null);
12163
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
12164
+ return callback(null, errorObj);
12165
+ }
12166
+
12167
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
12168
+ // return the response
12169
+ return callback(irReturnData, null);
12170
+ });
12171
+ } catch (ex) {
12172
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
12173
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
12174
+ return callback(null, errorObj);
12175
+ }
12176
+ }
11108
12177
  }
11109
12178
 
11110
12179
  module.exports = NokiaNspNetworkManagement;