cisco-perfmon 1.3.3 → 1.3.4
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/main.js +89 -89
- package/package.json +2 -2
package/main.js
CHANGED
|
@@ -146,15 +146,15 @@ class perfMonService {
|
|
|
146
146
|
return new Promise((resolve, reject) => {
|
|
147
147
|
// Set up our promise results
|
|
148
148
|
var promiseResults = {
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
cookie: "",
|
|
150
|
+
results: "",
|
|
151
151
|
};
|
|
152
152
|
// We fetch the API endpoint
|
|
153
153
|
fetch(`https://${server}:8443/perfmonservice2/services/PerfmonService/`, options)
|
|
154
154
|
.then(async (response) => {
|
|
155
155
|
try {
|
|
156
156
|
var data = []; // create an array to save chunked data from server
|
|
157
|
-
promiseResults.
|
|
157
|
+
promiseResults.cookie = response.headers.get("set-cookie") ? response.headers.get("set-cookie") : "";
|
|
158
158
|
// response.body is a ReadableStream
|
|
159
159
|
const reader = response.body.getReader();
|
|
160
160
|
for await (const chunk of readChunks(reader)) {
|
|
@@ -205,25 +205,25 @@ class perfMonService {
|
|
|
205
205
|
cstatus: returnResults.CStatus,
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
-
promiseResults.
|
|
208
|
+
promiseResults.results = clean(newOutput);
|
|
209
209
|
resolve(promiseResults);
|
|
210
210
|
} else {
|
|
211
|
-
promiseResults.
|
|
211
|
+
promiseResults.results = { response: "empty" };
|
|
212
212
|
resolve(promiseResults);
|
|
213
213
|
}
|
|
214
214
|
} else {
|
|
215
|
-
promiseResults.
|
|
215
|
+
promiseResults.results = { response: "empty" };
|
|
216
216
|
resolve(promiseResults);
|
|
217
217
|
}
|
|
218
218
|
} else {
|
|
219
219
|
// Error checking. If the response contains a fault, we return the fault.
|
|
220
220
|
if (keyExists(output, "Fault")) {
|
|
221
221
|
if (output.Body.Fault.faultcode.includes("RateControl")) {
|
|
222
|
-
promiseResults.
|
|
222
|
+
promiseResults.results = { faultcode: "RateControl", faultstring: output.Body.Fault.faultstring };
|
|
223
223
|
} else if (output.Body.Fault.faultcode.includes("generalException")) {
|
|
224
|
-
promiseResults.
|
|
224
|
+
promiseResults.results = { faultcode: "generalException", faultstring: output.Body.Fault.faultstring };
|
|
225
225
|
} else {
|
|
226
|
-
promiseResults.
|
|
226
|
+
promiseResults.results = { faultcode: output.Body.Fault.faultcode, faultstring: output.Body.Fault.faultstring };
|
|
227
227
|
}
|
|
228
228
|
resolve(promiseResults);
|
|
229
229
|
} else {
|
|
@@ -232,12 +232,12 @@ class perfMonService {
|
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
} catch (e) {
|
|
235
|
-
promiseResults.
|
|
235
|
+
promiseResults.results = e;
|
|
236
236
|
reject(promiseResults);
|
|
237
237
|
}
|
|
238
238
|
})
|
|
239
239
|
.catch((error) => {
|
|
240
|
-
promiseResults.
|
|
240
|
+
promiseResults.results = error;
|
|
241
241
|
reject(promiseResults);
|
|
242
242
|
}); // catches the error and logs it
|
|
243
243
|
});
|
|
@@ -269,15 +269,15 @@ class perfMonService {
|
|
|
269
269
|
return new Promise((resolve, reject) => {
|
|
270
270
|
// Set up our promise results
|
|
271
271
|
var promiseResults = {
|
|
272
|
-
|
|
273
|
-
|
|
272
|
+
cookie: "",
|
|
273
|
+
results: "",
|
|
274
274
|
};
|
|
275
275
|
// We fetch the API endpoint
|
|
276
276
|
fetch(`https://${server}:8443/perfmonservice2/services/PerfmonService/`, options)
|
|
277
277
|
.then(async (response) => {
|
|
278
278
|
try {
|
|
279
279
|
var data = []; // create an array to save chunked data from server
|
|
280
|
-
promiseResults.
|
|
280
|
+
promiseResults.cookie = response.headers.get("set-cookie") ? response.headers.get("set-cookie") : "";
|
|
281
281
|
// response.body is a ReadableStream
|
|
282
282
|
const reader = response.body.getReader();
|
|
283
283
|
for await (const chunk of readChunks(reader)) {
|
|
@@ -327,25 +327,25 @@ class perfMonService {
|
|
|
327
327
|
cstatus: returnResults.CStatus,
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
|
-
promiseResults.
|
|
330
|
+
promiseResults.results = clean(newOutput);
|
|
331
331
|
resolve(promiseResults);
|
|
332
332
|
} else {
|
|
333
|
-
promiseResults.
|
|
333
|
+
promiseResults.results = { response: "empty" };
|
|
334
334
|
resolve(promiseResults);
|
|
335
335
|
}
|
|
336
336
|
} else {
|
|
337
|
-
promiseResults.
|
|
337
|
+
promiseResults.results = { response: "empty" };
|
|
338
338
|
resolve(promiseResults);
|
|
339
339
|
}
|
|
340
340
|
} else {
|
|
341
341
|
// Error checking. If the response contains a fault, we return the fault.
|
|
342
342
|
if (keyExists(output, "Fault")) {
|
|
343
343
|
if (output.Body.Fault.faultcode.includes("RateControl")) {
|
|
344
|
-
promiseResults.
|
|
344
|
+
promiseResults.results = { faultcode: "RateControl", faultstring: output.Body.Fault.faultstring };
|
|
345
345
|
} else if (output.Body.Fault.faultcode.includes("generalException")) {
|
|
346
|
-
promiseResults.
|
|
346
|
+
promiseResults.results = { faultcode: "generalException", faultstring: output.Body.Fault.faultstring };
|
|
347
347
|
} else {
|
|
348
|
-
promiseResults.
|
|
348
|
+
promiseResults.results = { faultcode: output.Body.Fault.faultcode, faultstring: output.Body.Fault.faultstring };
|
|
349
349
|
}
|
|
350
350
|
resolve(promiseResults);
|
|
351
351
|
} else {
|
|
@@ -354,12 +354,12 @@ class perfMonService {
|
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
} catch (e) {
|
|
357
|
-
promiseResults.
|
|
357
|
+
promiseResults.results = e;
|
|
358
358
|
reject(promiseResults);
|
|
359
359
|
}
|
|
360
360
|
})
|
|
361
361
|
.catch((error) => {
|
|
362
|
-
promiseResults.
|
|
362
|
+
promiseResults.results = error;
|
|
363
363
|
reject(promiseResults);
|
|
364
364
|
}); // catches the error and logs it
|
|
365
365
|
});
|
|
@@ -391,15 +391,15 @@ class perfMonService {
|
|
|
391
391
|
return new Promise((resolve, reject) => {
|
|
392
392
|
// Set up our promise results
|
|
393
393
|
var promiseResults = {
|
|
394
|
-
|
|
395
|
-
|
|
394
|
+
cookie: "",
|
|
395
|
+
results: "",
|
|
396
396
|
};
|
|
397
397
|
// We fetch the API endpoint
|
|
398
398
|
fetch(`https://${server}:8443/perfmonservice2/services/PerfmonService/`, options)
|
|
399
399
|
.then(async (response) => {
|
|
400
400
|
try {
|
|
401
401
|
var data = []; // create an array to save chunked data from server
|
|
402
|
-
promiseResults.
|
|
402
|
+
promiseResults.cookie = response.headers.get("set-cookie") ? response.headers.get("set-cookie") : "";
|
|
403
403
|
// response.body is a ReadableStream
|
|
404
404
|
const reader = response.body.getReader();
|
|
405
405
|
for await (const chunk of readChunks(reader)) {
|
|
@@ -415,25 +415,25 @@ class perfMonService {
|
|
|
415
415
|
if (keyExists(output, "perfmonListCounterReturn")) {
|
|
416
416
|
var returnResults = output.Body.perfmonListCounterResponse.perfmonListCounterReturn;
|
|
417
417
|
if (returnResults) {
|
|
418
|
-
promiseResults.
|
|
418
|
+
promiseResults.results = clean(returnResults);
|
|
419
419
|
resolve(promiseResults);
|
|
420
420
|
} else {
|
|
421
|
-
promiseResults.
|
|
421
|
+
promiseResults.results = { response: "empty" };
|
|
422
422
|
resolve(promiseResults);
|
|
423
423
|
}
|
|
424
424
|
} else {
|
|
425
|
-
promiseResults.
|
|
425
|
+
promiseResults.results = { response: "empty" };
|
|
426
426
|
resolve(promiseResults);
|
|
427
427
|
}
|
|
428
428
|
} else {
|
|
429
429
|
// Error checking. If the response contains a fault, we return the fault.
|
|
430
430
|
if (keyExists(output, "Fault")) {
|
|
431
431
|
if (output.Body.Fault.faultcode.includes("RateControl")) {
|
|
432
|
-
promiseResults.
|
|
432
|
+
promiseResults.results = { faultcode: "RateControl", faultstring: output.Body.Fault.faultstring };
|
|
433
433
|
} else if (output.Body.Fault.faultcode.includes("generalException")) {
|
|
434
|
-
promiseResults.
|
|
434
|
+
promiseResults.results = { faultcode: "generalException", faultstring: output.Body.Fault.faultstring };
|
|
435
435
|
} else {
|
|
436
|
-
promiseResults.
|
|
436
|
+
promiseResults.results = { faultcode: output.Body.Fault.faultcode, faultstring: output.Body.Fault.faultstring };
|
|
437
437
|
}
|
|
438
438
|
resolve(promiseResults);
|
|
439
439
|
} else {
|
|
@@ -442,12 +442,12 @@ class perfMonService {
|
|
|
442
442
|
}
|
|
443
443
|
}
|
|
444
444
|
} catch (e) {
|
|
445
|
-
promiseResults.
|
|
445
|
+
promiseResults.results = e;
|
|
446
446
|
reject(promiseResults);
|
|
447
447
|
}
|
|
448
448
|
})
|
|
449
449
|
.catch((error) => {
|
|
450
|
-
promiseResults.
|
|
450
|
+
promiseResults.results = error;
|
|
451
451
|
reject(promiseResults);
|
|
452
452
|
}); // catches the error and logs it
|
|
453
453
|
});
|
|
@@ -480,15 +480,15 @@ class perfMonService {
|
|
|
480
480
|
return new Promise((resolve, reject) => {
|
|
481
481
|
// Set up our promise results
|
|
482
482
|
var promiseResults = {
|
|
483
|
-
|
|
484
|
-
|
|
483
|
+
cookie: "",
|
|
484
|
+
results: "",
|
|
485
485
|
};
|
|
486
486
|
// We fetch the API endpoint
|
|
487
487
|
fetch(`https://${server}:8443/perfmonservice2/services/PerfmonService/`, options)
|
|
488
488
|
.then(async (response) => {
|
|
489
489
|
try {
|
|
490
490
|
var data = []; // create an array to save chunked data from server
|
|
491
|
-
promiseResults.
|
|
491
|
+
promiseResults.cookie = response.headers.get("set-cookie") ? response.headers.get("set-cookie") : "";
|
|
492
492
|
// response.body is a ReadableStream
|
|
493
493
|
const reader = response.body.getReader();
|
|
494
494
|
for await (const chunk of readChunks(reader)) {
|
|
@@ -504,25 +504,25 @@ class perfMonService {
|
|
|
504
504
|
if (keyExists(output, "perfmonListInstanceReturn")) {
|
|
505
505
|
var returnResults = output.Body.perfmonListInstanceResponse.perfmonListInstanceReturn;
|
|
506
506
|
if (returnResults) {
|
|
507
|
-
promiseResults.
|
|
507
|
+
promiseResults.results = clean(returnResults);
|
|
508
508
|
resolve(promiseResults);
|
|
509
509
|
} else {
|
|
510
|
-
promiseResults.
|
|
510
|
+
promiseResults.results = { response: "empty" };
|
|
511
511
|
resolve(promiseResults);
|
|
512
512
|
}
|
|
513
513
|
} else {
|
|
514
|
-
promiseResults.
|
|
514
|
+
promiseResults.results = { response: "empty" };
|
|
515
515
|
resolve(promiseResults);
|
|
516
516
|
}
|
|
517
517
|
} else {
|
|
518
518
|
// Error checking. If the response contains a fault, we return the fault.
|
|
519
519
|
if (keyExists(output, "Fault")) {
|
|
520
520
|
if (output.Body.Fault.faultcode.includes("RateControl")) {
|
|
521
|
-
promiseResults.
|
|
521
|
+
promiseResults.results = { faultcode: "RateControl", faultstring: output.Body.Fault.faultstring };
|
|
522
522
|
} else if (output.Body.Fault.faultcode.includes("generalException")) {
|
|
523
|
-
promiseResults.
|
|
523
|
+
promiseResults.results = { faultcode: "generalException", faultstring: output.Body.Fault.faultstring };
|
|
524
524
|
} else {
|
|
525
|
-
promiseResults.
|
|
525
|
+
promiseResults.results = { faultcode: output.Body.Fault.faultcode, faultstring: output.Body.Fault.faultstring };
|
|
526
526
|
}
|
|
527
527
|
resolve(promiseResults);
|
|
528
528
|
} else {
|
|
@@ -531,12 +531,12 @@ class perfMonService {
|
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
533
|
} catch (e) {
|
|
534
|
-
promiseResults.
|
|
534
|
+
promiseResults.results = e;
|
|
535
535
|
reject(promiseResults);
|
|
536
536
|
}
|
|
537
537
|
})
|
|
538
538
|
.catch((error) => {
|
|
539
|
-
promiseResults.
|
|
539
|
+
promiseResults.results = error;
|
|
540
540
|
reject(promiseResults);
|
|
541
541
|
}); // catches the error and logs it
|
|
542
542
|
});
|
|
@@ -566,15 +566,15 @@ class perfMonService {
|
|
|
566
566
|
return new Promise((resolve, reject) => {
|
|
567
567
|
// Set up our promise results
|
|
568
568
|
var promiseResults = {
|
|
569
|
-
|
|
570
|
-
|
|
569
|
+
cookie: "",
|
|
570
|
+
results: "",
|
|
571
571
|
};
|
|
572
572
|
// We fetch the API endpoint
|
|
573
573
|
fetch(`https://${server}:8443/perfmonservice2/services/PerfmonService/`, options)
|
|
574
574
|
.then(async (response) => {
|
|
575
575
|
try {
|
|
576
576
|
var data = []; // create an array to save chunked data from server
|
|
577
|
-
promiseResults.
|
|
577
|
+
promiseResults.cookie = response.headers.get("set-cookie") ? response.headers.get("set-cookie") : "";
|
|
578
578
|
// response.body is a ReadableStream
|
|
579
579
|
const reader = response.body.getReader();
|
|
580
580
|
for await (const chunk of readChunks(reader)) {
|
|
@@ -590,25 +590,25 @@ class perfMonService {
|
|
|
590
590
|
if (keyExists(output, "perfmonOpenSessionReturn")) {
|
|
591
591
|
var returnResults = output.Body.perfmonOpenSessionResponse.perfmonOpenSessionReturn;
|
|
592
592
|
if (returnResults) {
|
|
593
|
-
promiseResults.
|
|
593
|
+
promiseResults.results = clean(returnResults);
|
|
594
594
|
resolve(promiseResults);
|
|
595
595
|
} else {
|
|
596
|
-
promiseResults.
|
|
596
|
+
promiseResults.results = { response: "empty" };
|
|
597
597
|
resolve(promiseResults);
|
|
598
598
|
}
|
|
599
599
|
} else {
|
|
600
|
-
promiseResults.
|
|
600
|
+
promiseResults.results = { response: "empty" };
|
|
601
601
|
resolve(promiseResults);
|
|
602
602
|
}
|
|
603
603
|
} else {
|
|
604
604
|
// Error checking. If the response contains a fault, we return the fault.
|
|
605
605
|
if (keyExists(output, "Fault")) {
|
|
606
606
|
if (output.Body.Fault.faultcode.includes("RateControl")) {
|
|
607
|
-
promiseResults.
|
|
607
|
+
promiseResults.results = { faultcode: "RateControl", faultstring: output.Body.Fault.faultstring };
|
|
608
608
|
} else if (output.Body.Fault.faultcode.includes("generalException")) {
|
|
609
|
-
promiseResults.
|
|
609
|
+
promiseResults.results = { faultcode: "generalException", faultstring: output.Body.Fault.faultstring };
|
|
610
610
|
} else {
|
|
611
|
-
promiseResults.
|
|
611
|
+
promiseResults.results = { faultcode: output.Body.Fault.faultcode, faultstring: output.Body.Fault.faultstring };
|
|
612
612
|
}
|
|
613
613
|
resolve(promiseResults);
|
|
614
614
|
} else {
|
|
@@ -617,12 +617,12 @@ class perfMonService {
|
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
} catch (e) {
|
|
620
|
-
promiseResults.
|
|
620
|
+
promiseResults.results = e;
|
|
621
621
|
reject(promiseResults);
|
|
622
622
|
}
|
|
623
623
|
})
|
|
624
624
|
.catch((error) => {
|
|
625
|
-
promiseResults.
|
|
625
|
+
promiseResults.results = error;
|
|
626
626
|
reject(promiseResults);
|
|
627
627
|
}); // catches the error and logs it
|
|
628
628
|
});
|
|
@@ -653,15 +653,15 @@ class perfMonService {
|
|
|
653
653
|
return new Promise((resolve, reject) => {
|
|
654
654
|
// Set up our promise results
|
|
655
655
|
var promiseResults = {
|
|
656
|
-
|
|
657
|
-
|
|
656
|
+
cookie: "",
|
|
657
|
+
results: "",
|
|
658
658
|
};
|
|
659
659
|
// We fetch the API endpoint
|
|
660
660
|
fetch(`https://${server}:8443/perfmonservice2/services/PerfmonService/`, options)
|
|
661
661
|
.then(async (response) => {
|
|
662
662
|
try {
|
|
663
663
|
var data = []; // create an array to save chunked data from server
|
|
664
|
-
promiseResults.
|
|
664
|
+
promiseResults.cookie = response.headers.get("set-cookie") ? response.headers.get("set-cookie") : "";
|
|
665
665
|
// response.body is a ReadableStream
|
|
666
666
|
const reader = response.body.getReader();
|
|
667
667
|
for await (const chunk of readChunks(reader)) {
|
|
@@ -676,21 +676,21 @@ class perfMonService {
|
|
|
676
676
|
if (keyExists(output, "perfmonCloseSessionResponse")) {
|
|
677
677
|
var returnResults = output.Body.perfmonCloseSessionResponse;
|
|
678
678
|
if (returnResults) {
|
|
679
|
-
promiseResults.
|
|
679
|
+
promiseResults.results = { response: "success" };
|
|
680
680
|
resolve(promiseResults);
|
|
681
681
|
} else {
|
|
682
|
-
promiseResults.
|
|
682
|
+
promiseResults.results = { response: "unknow" };
|
|
683
683
|
reject(promiseResults);
|
|
684
684
|
}
|
|
685
685
|
} else {
|
|
686
686
|
// Error checking. If the response contains a fault, we return the fault.
|
|
687
687
|
if (keyExists(output, "Fault")) {
|
|
688
688
|
if (output.Body.Fault.faultcode.includes("RateControl")) {
|
|
689
|
-
promiseResults.
|
|
689
|
+
promiseResults.results = { faultcode: "RateControl", faultstring: output.Body.Fault.faultstring };
|
|
690
690
|
} else if (output.Body.Fault.faultcode.includes("generalException")) {
|
|
691
|
-
promiseResults.
|
|
691
|
+
promiseResults.results = { faultcode: "generalException", faultstring: output.Body.Fault.faultstring };
|
|
692
692
|
} else {
|
|
693
|
-
promiseResults.
|
|
693
|
+
promiseResults.results = { faultcode: output.Body.Fault.faultcode, faultstring: output.Body.Fault.faultstring };
|
|
694
694
|
}
|
|
695
695
|
resolve(promiseResults);
|
|
696
696
|
} else {
|
|
@@ -699,12 +699,12 @@ class perfMonService {
|
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
701
|
} catch (e) {
|
|
702
|
-
promiseResults.
|
|
702
|
+
promiseResults.results = e;
|
|
703
703
|
reject(promiseResults);
|
|
704
704
|
}
|
|
705
705
|
})
|
|
706
706
|
.catch((error) => {
|
|
707
|
-
promiseResults.
|
|
707
|
+
promiseResults.results = error;
|
|
708
708
|
reject(promiseResults);
|
|
709
709
|
}); // catches the error and logs it
|
|
710
710
|
});
|
|
@@ -764,17 +764,17 @@ class perfMonService {
|
|
|
764
764
|
removeKeys(output, "$");
|
|
765
765
|
|
|
766
766
|
if (keyExists(output, "perfmonAddCounterResponse")) {
|
|
767
|
-
promiseResults.
|
|
767
|
+
promiseResults.results = { response: "success" };
|
|
768
768
|
resolve(promiseResults);
|
|
769
769
|
} else {
|
|
770
770
|
// Error checking. If the response contains a fault, we return the fault.
|
|
771
771
|
if (keyExists(output, "Fault")) {
|
|
772
772
|
if (output.Body.Fault.faultcode.includes("RateControl")) {
|
|
773
|
-
promiseResults.
|
|
773
|
+
promiseResults.results = { faultcode: "RateControl", faultstring: output.Body.Fault.faultstring };
|
|
774
774
|
} else if (output.Body.Fault.faultcode.includes("generalException")) {
|
|
775
|
-
promiseResults.
|
|
775
|
+
promiseResults.results = { faultcode: "generalException", faultstring: output.Body.Fault.faultstring };
|
|
776
776
|
} else {
|
|
777
|
-
promiseResults.
|
|
777
|
+
promiseResults.results = { faultcode: output.Body.Fault.faultcode, faultstring: output.Body.Fault.faultstring };
|
|
778
778
|
}
|
|
779
779
|
resolve(promiseResults);
|
|
780
780
|
} else {
|
|
@@ -783,12 +783,12 @@ class perfMonService {
|
|
|
783
783
|
}
|
|
784
784
|
}
|
|
785
785
|
} catch (e) {
|
|
786
|
-
promiseResults.
|
|
786
|
+
promiseResults.results = e;
|
|
787
787
|
reject(promiseResults);
|
|
788
788
|
}
|
|
789
789
|
})
|
|
790
790
|
.catch((error) => {
|
|
791
|
-
promiseResults.
|
|
791
|
+
promiseResults.results = error;
|
|
792
792
|
reject(promiseResults);
|
|
793
793
|
}); // catches the error and logs it
|
|
794
794
|
});
|
|
@@ -850,21 +850,21 @@ class perfMonService {
|
|
|
850
850
|
if (keyExists(output, "perfmonRemoveCounterResponse")) {
|
|
851
851
|
var returnResults = output.Body.perfmonRemoveCounterResponse;
|
|
852
852
|
if (returnResults) {
|
|
853
|
-
promiseResults.
|
|
853
|
+
promiseResults.results = { response: "success" };
|
|
854
854
|
resolve(promiseResults);
|
|
855
855
|
} else {
|
|
856
|
-
promiseResults.
|
|
856
|
+
promiseResults.results = { response: "unknown" };
|
|
857
857
|
resolve(promiseResults);
|
|
858
858
|
}
|
|
859
859
|
} else {
|
|
860
860
|
// Error checking. If the response contains a fault, we return the fault.
|
|
861
861
|
if (keyExists(output, "Fault")) {
|
|
862
862
|
if (output.Body.Fault.faultcode.includes("RateControl")) {
|
|
863
|
-
promiseResults.
|
|
863
|
+
promiseResults.results = { faultcode: "RateControl", faultstring: output.Body.Fault.faultstring };
|
|
864
864
|
} else if (output.Body.Fault.faultcode.includes("generalException")) {
|
|
865
|
-
promiseResults.
|
|
865
|
+
promiseResults.results = { faultcode: "generalException", faultstring: output.Body.Fault.faultstring };
|
|
866
866
|
} else {
|
|
867
|
-
promiseResults.
|
|
867
|
+
promiseResults.results = { faultcode: output.Body.Fault.faultcode, faultstring: output.Body.Fault.faultstring };
|
|
868
868
|
}
|
|
869
869
|
resolve(promiseResults);
|
|
870
870
|
} else {
|
|
@@ -873,12 +873,12 @@ class perfMonService {
|
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
} catch (e) {
|
|
876
|
-
promiseResults.
|
|
876
|
+
promiseResults.results = e;
|
|
877
877
|
reject(promiseResults);
|
|
878
878
|
}
|
|
879
879
|
})
|
|
880
880
|
.catch((error) => {
|
|
881
|
-
promiseResults.
|
|
881
|
+
promiseResults.results = error;
|
|
882
882
|
reject(promiseResults);
|
|
883
883
|
}); // catches the error and logs it
|
|
884
884
|
});
|
|
@@ -912,15 +912,15 @@ class perfMonService {
|
|
|
912
912
|
return new Promise((resolve, reject) => {
|
|
913
913
|
// Set up our promise results
|
|
914
914
|
var promiseResults = {
|
|
915
|
-
|
|
916
|
-
|
|
915
|
+
cookie: "",
|
|
916
|
+
results: "",
|
|
917
917
|
};
|
|
918
918
|
// We fetch the API endpoint
|
|
919
919
|
fetch(`https://${server}:8443/perfmonservice2/services/PerfmonService/`, options)
|
|
920
920
|
.then(async (response) => {
|
|
921
921
|
try {
|
|
922
922
|
var data = []; // create an array to save chunked data from server
|
|
923
|
-
promiseResults.
|
|
923
|
+
promiseResults.cookie = response.headers.get("set-cookie") ? response.headers.get("set-cookie") : "";
|
|
924
924
|
// response.body is a ReadableStream
|
|
925
925
|
const reader = response.body.getReader();
|
|
926
926
|
for await (const chunk of readChunks(reader)) {
|
|
@@ -937,25 +937,25 @@ class perfMonService {
|
|
|
937
937
|
if (keyExists(output, "perfmonQueryCounterDescriptionReturn")) {
|
|
938
938
|
var returnResults = output.Body.perfmonQueryCounterDescriptionResponse.perfmonQueryCounterDescriptionReturn;
|
|
939
939
|
if (returnResults) {
|
|
940
|
-
promiseResults.
|
|
940
|
+
promiseResults.results = clean(returnResults);
|
|
941
941
|
resolve(promiseResults);
|
|
942
942
|
} else {
|
|
943
|
-
promiseResults.
|
|
943
|
+
promiseResults.results = { response: "empty" };
|
|
944
944
|
resolve(promiseResults);
|
|
945
945
|
}
|
|
946
946
|
} else {
|
|
947
|
-
promiseResults.
|
|
947
|
+
promiseResults.results = { response: "empty" };
|
|
948
948
|
resolve(promiseResults);
|
|
949
949
|
}
|
|
950
950
|
} else {
|
|
951
951
|
// Error checking. If the response contains a fault, we return the fault.
|
|
952
952
|
if (keyExists(output, "Fault")) {
|
|
953
953
|
if (output.Body.Fault.faultcode.includes("RateControl")) {
|
|
954
|
-
promiseResults.
|
|
954
|
+
promiseResults.results = { faultcode: "RateControl", faultstring: output.Body.Fault.faultstring };
|
|
955
955
|
} else if (output.Body.Fault.faultcode.includes("generalException")) {
|
|
956
|
-
promiseResults.
|
|
956
|
+
promiseResults.results = { faultcode: "generalException", faultstring: output.Body.Fault.faultstring };
|
|
957
957
|
} else {
|
|
958
|
-
promiseResults.
|
|
958
|
+
promiseResults.results = { faultcode: output.Body.Fault.faultcode, faultstring: output.Body.Fault.faultstring };
|
|
959
959
|
}
|
|
960
960
|
resolve(promiseResults);
|
|
961
961
|
} else {
|
|
@@ -964,12 +964,12 @@ class perfMonService {
|
|
|
964
964
|
}
|
|
965
965
|
}
|
|
966
966
|
} catch (e) {
|
|
967
|
-
promiseResults.
|
|
967
|
+
promiseResults.results = e;
|
|
968
968
|
reject(promiseResults);
|
|
969
969
|
}
|
|
970
970
|
})
|
|
971
971
|
.catch((error) => {
|
|
972
|
-
promiseResults.
|
|
972
|
+
promiseResults.results = error;
|
|
973
973
|
reject(promiseResults);
|
|
974
974
|
}); // catches the error and logs it
|
|
975
975
|
});
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cisco-perfmon",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "A library to pull Perfmon data from Cisco VOS applications via SOAP",
|
|
5
5
|
"main": "main.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_ENV=
|
|
7
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_ENV=development node ./test/tests.js",
|
|
8
8
|
"development": "NODE_OPTIONS=--experimental-vm-modules NODE_NO_WARNINGS=1 NODE_TLS_REJECT_UNAUTHORIZED=0 NODE_ENV=development node ./test/tests.js"
|
|
9
9
|
},
|
|
10
10
|
"repository": {
|