@itentialopensource/adapter-nokia_altiplano 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/adapter.js +436 -0
- package/entities/Intent/action.json +116 -0
- package/entities/Intent/schema.json +6 -1
- package/package.json +1 -1
- package/pronghorn.json +211 -0
- package/refs?service=git-upload-pack +0 -0
- package/test/integration/adapterTestIntegration.js +125 -0
- package/test/unit/adapterTestUnit.js +162 -0
package/CHANGELOG.md
CHANGED
package/adapter.js
CHANGED
|
@@ -2337,6 +2337,442 @@ class NokiaAltiplano extends AdapterBaseCl {
|
|
|
2337
2337
|
return callback(null, errorObj);
|
|
2338
2338
|
}
|
|
2339
2339
|
}
|
|
2340
|
+
|
|
2341
|
+
/**
|
|
2342
|
+
* @function getIbnIntent
|
|
2343
|
+
* @pronghornType method
|
|
2344
|
+
* @name getIbnIntent
|
|
2345
|
+
* @summary GET ibn intent
|
|
2346
|
+
*
|
|
2347
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
2348
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2349
|
+
* @return {object} results - An object containing the response of the action
|
|
2350
|
+
*
|
|
2351
|
+
* @route {POST} /getIbnIntent
|
|
2352
|
+
* @roles admin
|
|
2353
|
+
* @task true
|
|
2354
|
+
*/
|
|
2355
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2356
|
+
getIbnIntent(intent, callback) {
|
|
2357
|
+
const meth = 'adapter-getIbnIntent';
|
|
2358
|
+
const origin = `${this.id}-${meth}`;
|
|
2359
|
+
log.trace(origin);
|
|
2360
|
+
|
|
2361
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2362
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2363
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2364
|
+
return callback(null, errorObj);
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2368
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
2369
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
2370
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2371
|
+
return callback(null, errorObj);
|
|
2372
|
+
}
|
|
2373
|
+
let newIntent = intent;
|
|
2374
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2375
|
+
newIntent = `intent=${intent}`;
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2379
|
+
const queryParamsAvailable = {};
|
|
2380
|
+
const queryParams = {};
|
|
2381
|
+
const pathVars = [newIntent];
|
|
2382
|
+
const bodyVars = {};
|
|
2383
|
+
|
|
2384
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2385
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2386
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2387
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2388
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2389
|
+
}
|
|
2390
|
+
});
|
|
2391
|
+
|
|
2392
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2393
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2394
|
+
const reqObj = {
|
|
2395
|
+
payload: bodyVars,
|
|
2396
|
+
uriPathVars: pathVars,
|
|
2397
|
+
uriQuery: queryParams
|
|
2398
|
+
};
|
|
2399
|
+
|
|
2400
|
+
try {
|
|
2401
|
+
// Make the call -
|
|
2402
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2403
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'getIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
|
|
2404
|
+
// if we received an error or their is no response on the results
|
|
2405
|
+
// return an error
|
|
2406
|
+
if (irReturnError) {
|
|
2407
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2408
|
+
return callback(null, irReturnError);
|
|
2409
|
+
}
|
|
2410
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2411
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getIbnIntent'], null, null, null);
|
|
2412
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2413
|
+
return callback(null, errorObj);
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2417
|
+
// return the response
|
|
2418
|
+
return callback(irReturnData, null);
|
|
2419
|
+
});
|
|
2420
|
+
} catch (ex) {
|
|
2421
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2422
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2423
|
+
return callback(null, errorObj);
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
/**
|
|
2428
|
+
* @function modifyIbnIntent
|
|
2429
|
+
* @pronghornType method
|
|
2430
|
+
* @name modifyIbnIntent
|
|
2431
|
+
* @summary Modify ibn intent
|
|
2432
|
+
*
|
|
2433
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
2434
|
+
* @param {object} body - body param
|
|
2435
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2436
|
+
* @return {object} results - An object containing the response of the action
|
|
2437
|
+
*
|
|
2438
|
+
* @route {POST} /modifyIbnIntent
|
|
2439
|
+
* @roles admin
|
|
2440
|
+
* @task true
|
|
2441
|
+
*/
|
|
2442
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2443
|
+
modifyIbnIntent(intent, body, callback) {
|
|
2444
|
+
const meth = 'adapter-modifyIbnIntent';
|
|
2445
|
+
const origin = `${this.id}-${meth}`;
|
|
2446
|
+
log.trace(origin);
|
|
2447
|
+
|
|
2448
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2449
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2450
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2451
|
+
return callback(null, errorObj);
|
|
2452
|
+
}
|
|
2453
|
+
|
|
2454
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2455
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
2456
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
2457
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2458
|
+
return callback(null, errorObj);
|
|
2459
|
+
}
|
|
2460
|
+
if (body === undefined || body === null || body === '') {
|
|
2461
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
2462
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2463
|
+
return callback(null, errorObj);
|
|
2464
|
+
}
|
|
2465
|
+
let newIntent = intent;
|
|
2466
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2467
|
+
newIntent = `intent=${intent}`;
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2471
|
+
const queryParamsAvailable = {};
|
|
2472
|
+
const queryParams = {};
|
|
2473
|
+
const pathVars = [newIntent];
|
|
2474
|
+
const bodyVars = body;
|
|
2475
|
+
|
|
2476
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2477
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2478
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2479
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2480
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2481
|
+
}
|
|
2482
|
+
});
|
|
2483
|
+
|
|
2484
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2485
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2486
|
+
const reqObj = {
|
|
2487
|
+
payload: bodyVars,
|
|
2488
|
+
uriPathVars: pathVars,
|
|
2489
|
+
uriQuery: queryParams
|
|
2490
|
+
};
|
|
2491
|
+
|
|
2492
|
+
try {
|
|
2493
|
+
// Make the call -
|
|
2494
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2495
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'modifyIbnIntent', reqObj, false, (irReturnData, irReturnError) => {
|
|
2496
|
+
// if we received an error or their is no response on the results
|
|
2497
|
+
// return an error
|
|
2498
|
+
if (irReturnError) {
|
|
2499
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2500
|
+
return callback(null, irReturnError);
|
|
2501
|
+
}
|
|
2502
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2503
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['modifyIbnIntent'], null, null, null);
|
|
2504
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2505
|
+
return callback(null, errorObj);
|
|
2506
|
+
}
|
|
2507
|
+
|
|
2508
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2509
|
+
// return the response
|
|
2510
|
+
return callback(irReturnData, null);
|
|
2511
|
+
});
|
|
2512
|
+
} catch (ex) {
|
|
2513
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2514
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2515
|
+
return callback(null, errorObj);
|
|
2516
|
+
}
|
|
2517
|
+
}
|
|
2518
|
+
|
|
2519
|
+
/**
|
|
2520
|
+
* @function deleteIbnIntent
|
|
2521
|
+
* @pronghornType method
|
|
2522
|
+
* @name deleteIbnIntent
|
|
2523
|
+
* @summary Delete ibn intent
|
|
2524
|
+
*
|
|
2525
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
2526
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2527
|
+
* @return {object} results - An object containing the response of the action
|
|
2528
|
+
*
|
|
2529
|
+
* @route {POST} /deleteIbnIntent
|
|
2530
|
+
* @roles admin
|
|
2531
|
+
* @task true
|
|
2532
|
+
*/
|
|
2533
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2534
|
+
deleteIbnIntent(intent, callback) {
|
|
2535
|
+
const meth = 'adapter-deleteIbnIntent';
|
|
2536
|
+
const origin = `${this.id}-${meth}`;
|
|
2537
|
+
log.trace(origin);
|
|
2538
|
+
|
|
2539
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2540
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2541
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2542
|
+
return callback(null, errorObj);
|
|
2543
|
+
}
|
|
2544
|
+
|
|
2545
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2546
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
2547
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
2548
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2549
|
+
return callback(null, errorObj);
|
|
2550
|
+
}
|
|
2551
|
+
let newIntent = intent;
|
|
2552
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2553
|
+
newIntent = `intent=${intent}`;
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2557
|
+
const queryParamsAvailable = {};
|
|
2558
|
+
const queryParams = {};
|
|
2559
|
+
const pathVars = [newIntent];
|
|
2560
|
+
const bodyVars = {};
|
|
2561
|
+
|
|
2562
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2563
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2564
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2565
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2566
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2567
|
+
}
|
|
2568
|
+
});
|
|
2569
|
+
|
|
2570
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2571
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2572
|
+
const reqObj = {
|
|
2573
|
+
payload: bodyVars,
|
|
2574
|
+
uriPathVars: pathVars,
|
|
2575
|
+
uriQuery: queryParams
|
|
2576
|
+
};
|
|
2577
|
+
|
|
2578
|
+
try {
|
|
2579
|
+
// Make the call -
|
|
2580
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2581
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'deleteIbnIntent', reqObj, false, (irReturnData, irReturnError) => {
|
|
2582
|
+
// if we received an error or their is no response on the results
|
|
2583
|
+
// return an error
|
|
2584
|
+
if (irReturnError) {
|
|
2585
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2586
|
+
return callback(null, irReturnError);
|
|
2587
|
+
}
|
|
2588
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2589
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteIbnIntent'], null, null, null);
|
|
2590
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2591
|
+
return callback(null, errorObj);
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2595
|
+
// return the response
|
|
2596
|
+
return callback(irReturnData, null);
|
|
2597
|
+
});
|
|
2598
|
+
} catch (ex) {
|
|
2599
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2600
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2601
|
+
return callback(null, errorObj);
|
|
2602
|
+
}
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
/**
|
|
2606
|
+
* @function synchronizeIbnIntent
|
|
2607
|
+
* @pronghornType method
|
|
2608
|
+
* @name synchronizeIbnIntent
|
|
2609
|
+
* @summary Synchronize ibn intent
|
|
2610
|
+
*
|
|
2611
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
2612
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2613
|
+
* @return {object} results - An object containing the response of the action
|
|
2614
|
+
*
|
|
2615
|
+
* @route {POST} /synchronizeIbnIntent
|
|
2616
|
+
* @roles admin
|
|
2617
|
+
* @task true
|
|
2618
|
+
*/
|
|
2619
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2620
|
+
synchronizeIbnIntent(intent, callback) {
|
|
2621
|
+
const meth = 'adapter-synchronizeIbnIntent';
|
|
2622
|
+
const origin = `${this.id}-${meth}`;
|
|
2623
|
+
log.trace(origin);
|
|
2624
|
+
|
|
2625
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2626
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2627
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2628
|
+
return callback(null, errorObj);
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2632
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
2633
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
2634
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2635
|
+
return callback(null, errorObj);
|
|
2636
|
+
}
|
|
2637
|
+
let newIntent = intent;
|
|
2638
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2639
|
+
newIntent = `intent=${intent}`;
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2643
|
+
const queryParamsAvailable = {};
|
|
2644
|
+
const queryParams = {};
|
|
2645
|
+
const pathVars = [newIntent];
|
|
2646
|
+
const bodyVars = {};
|
|
2647
|
+
|
|
2648
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2649
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2650
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2651
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2652
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2653
|
+
}
|
|
2654
|
+
});
|
|
2655
|
+
|
|
2656
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2657
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2658
|
+
const reqObj = {
|
|
2659
|
+
payload: bodyVars,
|
|
2660
|
+
uriPathVars: pathVars,
|
|
2661
|
+
uriQuery: queryParams
|
|
2662
|
+
};
|
|
2663
|
+
|
|
2664
|
+
try {
|
|
2665
|
+
// Make the call -
|
|
2666
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2667
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'synchronizeIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
|
|
2668
|
+
// if we received an error or their is no response on the results
|
|
2669
|
+
// return an error
|
|
2670
|
+
if (irReturnError) {
|
|
2671
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2672
|
+
return callback(null, irReturnError);
|
|
2673
|
+
}
|
|
2674
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2675
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['synchronizeIbnIntent'], null, null, null);
|
|
2676
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2677
|
+
return callback(null, errorObj);
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2681
|
+
// return the response
|
|
2682
|
+
return callback(irReturnData, null);
|
|
2683
|
+
});
|
|
2684
|
+
} catch (ex) {
|
|
2685
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2686
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2687
|
+
return callback(null, errorObj);
|
|
2688
|
+
}
|
|
2689
|
+
}
|
|
2690
|
+
|
|
2691
|
+
/**
|
|
2692
|
+
* @function auditIbnIntent
|
|
2693
|
+
* @pronghornType method
|
|
2694
|
+
* @name auditIbnIntent
|
|
2695
|
+
* @summary Audit ibn intent
|
|
2696
|
+
*
|
|
2697
|
+
* @param {string} intent - the intent value, type (MYINTONT1,ont)
|
|
2698
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2699
|
+
* @return {object} results - An object containing the response of the action
|
|
2700
|
+
*
|
|
2701
|
+
* @route {POST} /auditIbnIntent
|
|
2702
|
+
* @roles admin
|
|
2703
|
+
* @task true
|
|
2704
|
+
*/
|
|
2705
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2706
|
+
auditIbnIntent(intent, callback) {
|
|
2707
|
+
const meth = 'adapter-auditIbnIntent';
|
|
2708
|
+
const origin = `${this.id}-${meth}`;
|
|
2709
|
+
log.trace(origin);
|
|
2710
|
+
|
|
2711
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2712
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2713
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2714
|
+
return callback(null, errorObj);
|
|
2715
|
+
}
|
|
2716
|
+
|
|
2717
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2718
|
+
if (intent === undefined || intent === null || intent === '') {
|
|
2719
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['intent'], null, null, null);
|
|
2720
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2721
|
+
return callback(null, errorObj);
|
|
2722
|
+
}
|
|
2723
|
+
let newIntent = intent;
|
|
2724
|
+
if (intent.indexOf('intent=') !== 0) {
|
|
2725
|
+
newIntent = `intent=${intent}`;
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2729
|
+
const queryParamsAvailable = {};
|
|
2730
|
+
const queryParams = {};
|
|
2731
|
+
const pathVars = [newIntent];
|
|
2732
|
+
const bodyVars = {};
|
|
2733
|
+
|
|
2734
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2735
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2736
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2737
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2738
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2739
|
+
}
|
|
2740
|
+
});
|
|
2741
|
+
|
|
2742
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2743
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2744
|
+
const reqObj = {
|
|
2745
|
+
payload: bodyVars,
|
|
2746
|
+
uriPathVars: pathVars,
|
|
2747
|
+
uriQuery: queryParams
|
|
2748
|
+
};
|
|
2749
|
+
|
|
2750
|
+
try {
|
|
2751
|
+
// Make the call -
|
|
2752
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2753
|
+
return this.requestHandlerInst.identifyRequest('Intent', 'auditIbnIntent', reqObj, true, (irReturnData, irReturnError) => {
|
|
2754
|
+
// if we received an error or their is no response on the results
|
|
2755
|
+
// return an error
|
|
2756
|
+
if (irReturnError) {
|
|
2757
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2758
|
+
return callback(null, irReturnError);
|
|
2759
|
+
}
|
|
2760
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2761
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['auditIbnIntent'], null, null, null);
|
|
2762
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2763
|
+
return callback(null, errorObj);
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2767
|
+
// return the response
|
|
2768
|
+
return callback(irReturnData, null);
|
|
2769
|
+
});
|
|
2770
|
+
} catch (ex) {
|
|
2771
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2772
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2773
|
+
return callback(null, errorObj);
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2340
2776
|
}
|
|
2341
2777
|
|
|
2342
2778
|
module.exports = NokiaAltiplano;
|
|
@@ -346,6 +346,122 @@
|
|
|
346
346
|
"mockFile": ""
|
|
347
347
|
}
|
|
348
348
|
]
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"name": "getIbnIntent",
|
|
352
|
+
"protocol": "REST",
|
|
353
|
+
"method": "GET",
|
|
354
|
+
"entitypath": "{base_path}/{version}/restconf/data/ibn:ibn/{pathv1}?{query}",
|
|
355
|
+
"requestSchema": "schema.json",
|
|
356
|
+
"responseSchema": "schema.json",
|
|
357
|
+
"timeout": 0,
|
|
358
|
+
"sendEmpty": false,
|
|
359
|
+
"sendGetBody": false,
|
|
360
|
+
"requestDatatype": "JSON",
|
|
361
|
+
"responseDatatype": "JSON",
|
|
362
|
+
"headers": {
|
|
363
|
+
"Content-Type": "application/yang-data+json",
|
|
364
|
+
"Accept": "application/yang-data+json"
|
|
365
|
+
},
|
|
366
|
+
"responseObjects": [
|
|
367
|
+
{
|
|
368
|
+
"type": "default",
|
|
369
|
+
"key": "",
|
|
370
|
+
"mockFile": ""
|
|
371
|
+
}
|
|
372
|
+
]
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"name": "modifyIbnIntent",
|
|
376
|
+
"protocol": "REST",
|
|
377
|
+
"method": "PATCH",
|
|
378
|
+
"entitypath": "{base_path}/{version}/restconf/data/ibn:ibn/{pathv1}?{query}",
|
|
379
|
+
"requestSchema": "schema.json",
|
|
380
|
+
"responseSchema": "schema.json",
|
|
381
|
+
"timeout": 0,
|
|
382
|
+
"sendEmpty": false,
|
|
383
|
+
"requestDatatype": "JSON",
|
|
384
|
+
"responseDatatype": "JSON",
|
|
385
|
+
"headers": {
|
|
386
|
+
"Content-Type": "application/yang-data+json",
|
|
387
|
+
"Accept": "application/yang-data+json"
|
|
388
|
+
},
|
|
389
|
+
"responseObjects": [
|
|
390
|
+
{
|
|
391
|
+
"type": "default",
|
|
392
|
+
"key": "",
|
|
393
|
+
"mockFile": ""
|
|
394
|
+
}
|
|
395
|
+
]
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
"name": "deleteIbnIntent",
|
|
399
|
+
"protocol": "REST",
|
|
400
|
+
"method": "DELETE",
|
|
401
|
+
"entitypath": "{base_path}/{version}/restconf/data/ibn:ibn/{pathv1}?{query}",
|
|
402
|
+
"requestSchema": "schema.json",
|
|
403
|
+
"responseSchema": "schema.json",
|
|
404
|
+
"timeout": 0,
|
|
405
|
+
"sendEmpty": false,
|
|
406
|
+
"requestDatatype": "JSON",
|
|
407
|
+
"responseDatatype": "JSON",
|
|
408
|
+
"headers": {
|
|
409
|
+
"Content-Type": "application/yang-data+json",
|
|
410
|
+
"Accept": "application/yang-data+json"
|
|
411
|
+
},
|
|
412
|
+
"responseObjects": [
|
|
413
|
+
{
|
|
414
|
+
"type": "default",
|
|
415
|
+
"key": "",
|
|
416
|
+
"mockFile": ""
|
|
417
|
+
}
|
|
418
|
+
]
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"name": "synchronizeIbnIntent",
|
|
422
|
+
"protocol": "REST",
|
|
423
|
+
"method": "POST",
|
|
424
|
+
"entitypath": "{base_path}/{version}/restconf/data/ibn:ibn/{pathv1}/synchronize?{query}",
|
|
425
|
+
"requestSchema": "schema.json",
|
|
426
|
+
"responseSchema": "schema.json",
|
|
427
|
+
"timeout": 0,
|
|
428
|
+
"sendEmpty": false,
|
|
429
|
+
"requestDatatype": "JSON",
|
|
430
|
+
"responseDatatype": "JSON",
|
|
431
|
+
"headers": {
|
|
432
|
+
"Content-Type": "application/yang-data+json",
|
|
433
|
+
"Accept": "application/yang-data+json"
|
|
434
|
+
},
|
|
435
|
+
"responseObjects": [
|
|
436
|
+
{
|
|
437
|
+
"type": "default",
|
|
438
|
+
"key": "",
|
|
439
|
+
"mockFile": ""
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"name": "auditIbnIntent",
|
|
445
|
+
"protocol": "REST",
|
|
446
|
+
"method": "POST",
|
|
447
|
+
"entitypath": "{base_path}/{version}/restconf/data/ibn:ibn/{pathv1}/audit?{query}",
|
|
448
|
+
"requestSchema": "schema.json",
|
|
449
|
+
"responseSchema": "schema.json",
|
|
450
|
+
"timeout": 0,
|
|
451
|
+
"sendEmpty": false,
|
|
452
|
+
"requestDatatype": "JSON",
|
|
453
|
+
"responseDatatype": "JSON",
|
|
454
|
+
"headers": {
|
|
455
|
+
"Content-Type": "application/yang-data+json",
|
|
456
|
+
"Accept": "application/yang-data+json"
|
|
457
|
+
},
|
|
458
|
+
"responseObjects": [
|
|
459
|
+
{
|
|
460
|
+
"type": "default",
|
|
461
|
+
"key": "",
|
|
462
|
+
"mockFile": ""
|
|
463
|
+
}
|
|
464
|
+
]
|
|
349
465
|
}
|
|
350
466
|
]
|
|
351
467
|
}
|
package/package.json
CHANGED
package/pronghorn.json
CHANGED
|
@@ -1636,6 +1636,217 @@
|
|
|
1636
1636
|
"path": "/auditl2User"
|
|
1637
1637
|
},
|
|
1638
1638
|
"task": true
|
|
1639
|
+
},
|
|
1640
|
+
{
|
|
1641
|
+
"name": "getIbnIntent",
|
|
1642
|
+
"summary": "GET ibn intent",
|
|
1643
|
+
"description": "GET ibn intent",
|
|
1644
|
+
"input": [
|
|
1645
|
+
{
|
|
1646
|
+
"name": "intent",
|
|
1647
|
+
"type": "string",
|
|
1648
|
+
"info": "the intent value, type (MYINTONT1,ont)",
|
|
1649
|
+
"required": true,
|
|
1650
|
+
"schema": {
|
|
1651
|
+
"title": "intent",
|
|
1652
|
+
"type": "string"
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
],
|
|
1656
|
+
"output": {
|
|
1657
|
+
"name": "result",
|
|
1658
|
+
"type": "object",
|
|
1659
|
+
"description": "A JSON Object containing status, code and the result",
|
|
1660
|
+
"schema": {
|
|
1661
|
+
"title": "result",
|
|
1662
|
+
"type": "object"
|
|
1663
|
+
}
|
|
1664
|
+
},
|
|
1665
|
+
"roles": [
|
|
1666
|
+
"admin"
|
|
1667
|
+
],
|
|
1668
|
+
"route": {
|
|
1669
|
+
"verb": "POST",
|
|
1670
|
+
"path": "/getIbnIntent"
|
|
1671
|
+
},
|
|
1672
|
+
"task": true
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
"name": "modifyIbnIntent",
|
|
1676
|
+
"summary": "Modify ibn intent",
|
|
1677
|
+
"description": "This request sample is used to modify intent state.\r\nThe value of required-network-state can be active or suspend or delete",
|
|
1678
|
+
"input": [
|
|
1679
|
+
{
|
|
1680
|
+
"name": "intent",
|
|
1681
|
+
"type": "string",
|
|
1682
|
+
"info": "the intent value, type (MYINTONT1,ont)",
|
|
1683
|
+
"required": true,
|
|
1684
|
+
"schema": {
|
|
1685
|
+
"title": "intent",
|
|
1686
|
+
"type": "string"
|
|
1687
|
+
}
|
|
1688
|
+
},
|
|
1689
|
+
{
|
|
1690
|
+
"name": "body",
|
|
1691
|
+
"type": "object",
|
|
1692
|
+
"info": ": {\"ibn:intent\": {\"intent-type-version\": 123, \"required-network-state\": \"string\"}}",
|
|
1693
|
+
"required": true,
|
|
1694
|
+
"schema": {
|
|
1695
|
+
"title": "LockontRequest",
|
|
1696
|
+
"required": [
|
|
1697
|
+
"ibn:intent"
|
|
1698
|
+
],
|
|
1699
|
+
"type": "object",
|
|
1700
|
+
"properties": {
|
|
1701
|
+
"ibn:intent": {
|
|
1702
|
+
"title": "IbnIntent3",
|
|
1703
|
+
"required": [
|
|
1704
|
+
"intent-type-version",
|
|
1705
|
+
"required-network-state"
|
|
1706
|
+
],
|
|
1707
|
+
"type": "object",
|
|
1708
|
+
"properties": {
|
|
1709
|
+
"intent-type-version": {
|
|
1710
|
+
"type": "integer"
|
|
1711
|
+
},
|
|
1712
|
+
"required-network-state": {
|
|
1713
|
+
"type": "string"
|
|
1714
|
+
}
|
|
1715
|
+
},
|
|
1716
|
+
"example": {
|
|
1717
|
+
"intent-type-version": 4,
|
|
1718
|
+
"required-network-state": "suspend"
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
},
|
|
1722
|
+
"example": {
|
|
1723
|
+
"ibn:intent": {
|
|
1724
|
+
"intent-type-version": 4,
|
|
1725
|
+
"required-network-state": "suspend"
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
],
|
|
1731
|
+
"output": {
|
|
1732
|
+
"name": "result",
|
|
1733
|
+
"type": "object",
|
|
1734
|
+
"description": "A JSON Object containing status, code and the result",
|
|
1735
|
+
"schema": {
|
|
1736
|
+
"title": "result",
|
|
1737
|
+
"type": "object"
|
|
1738
|
+
}
|
|
1739
|
+
},
|
|
1740
|
+
"roles": [
|
|
1741
|
+
"admin"
|
|
1742
|
+
],
|
|
1743
|
+
"route": {
|
|
1744
|
+
"verb": "POST",
|
|
1745
|
+
"path": "/modifyIbnIntent"
|
|
1746
|
+
},
|
|
1747
|
+
"task": true
|
|
1748
|
+
},
|
|
1749
|
+
{
|
|
1750
|
+
"name": "deleteIbnIntent",
|
|
1751
|
+
"summary": "Delete ibn intent",
|
|
1752
|
+
"description": "This request sample is used to delete an intent.",
|
|
1753
|
+
"input": [
|
|
1754
|
+
{
|
|
1755
|
+
"name": "intent",
|
|
1756
|
+
"type": "string",
|
|
1757
|
+
"info": "the intent value, type (MYINTONT1,ont)",
|
|
1758
|
+
"required": true,
|
|
1759
|
+
"schema": {
|
|
1760
|
+
"title": "intent",
|
|
1761
|
+
"type": "string"
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
],
|
|
1765
|
+
"output": {
|
|
1766
|
+
"name": "result",
|
|
1767
|
+
"type": "object",
|
|
1768
|
+
"description": "A JSON Object containing status, code and the result",
|
|
1769
|
+
"schema": {
|
|
1770
|
+
"title": "result",
|
|
1771
|
+
"type": "object"
|
|
1772
|
+
}
|
|
1773
|
+
},
|
|
1774
|
+
"roles": [
|
|
1775
|
+
"admin"
|
|
1776
|
+
],
|
|
1777
|
+
"route": {
|
|
1778
|
+
"verb": "POST",
|
|
1779
|
+
"path": "/deleteIbnIntent"
|
|
1780
|
+
},
|
|
1781
|
+
"task": true
|
|
1782
|
+
},
|
|
1783
|
+
{
|
|
1784
|
+
"name": "synchronizeIbnIntent",
|
|
1785
|
+
"summary": "Synchronize ibn intent",
|
|
1786
|
+
"description": "Synchronize ibn intent",
|
|
1787
|
+
"input": [
|
|
1788
|
+
{
|
|
1789
|
+
"name": "intent",
|
|
1790
|
+
"type": "string",
|
|
1791
|
+
"info": "the intent value, type (MYINTONT1,ont)",
|
|
1792
|
+
"required": true,
|
|
1793
|
+
"schema": {
|
|
1794
|
+
"title": "intent",
|
|
1795
|
+
"type": "string"
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
],
|
|
1799
|
+
"output": {
|
|
1800
|
+
"name": "result",
|
|
1801
|
+
"type": "object",
|
|
1802
|
+
"description": "A JSON Object containing status, code and the result",
|
|
1803
|
+
"schema": {
|
|
1804
|
+
"title": "result",
|
|
1805
|
+
"type": "object"
|
|
1806
|
+
}
|
|
1807
|
+
},
|
|
1808
|
+
"roles": [
|
|
1809
|
+
"admin"
|
|
1810
|
+
],
|
|
1811
|
+
"route": {
|
|
1812
|
+
"verb": "POST",
|
|
1813
|
+
"path": "/synchronizeIbnIntent"
|
|
1814
|
+
},
|
|
1815
|
+
"task": true
|
|
1816
|
+
},
|
|
1817
|
+
{
|
|
1818
|
+
"name": "auditIbnIntent",
|
|
1819
|
+
"summary": "Audit ibn intent",
|
|
1820
|
+
"description": "Audit ibn intent",
|
|
1821
|
+
"input": [
|
|
1822
|
+
{
|
|
1823
|
+
"name": "intent",
|
|
1824
|
+
"type": "string",
|
|
1825
|
+
"info": "the intent value, type (MYINTONT1,ont)",
|
|
1826
|
+
"required": true,
|
|
1827
|
+
"schema": {
|
|
1828
|
+
"title": "intent",
|
|
1829
|
+
"type": "string"
|
|
1830
|
+
}
|
|
1831
|
+
}
|
|
1832
|
+
],
|
|
1833
|
+
"output": {
|
|
1834
|
+
"name": "result",
|
|
1835
|
+
"type": "object",
|
|
1836
|
+
"description": "A JSON Object containing status, code and the result",
|
|
1837
|
+
"schema": {
|
|
1838
|
+
"title": "result",
|
|
1839
|
+
"type": "object"
|
|
1840
|
+
}
|
|
1841
|
+
},
|
|
1842
|
+
"roles": [
|
|
1843
|
+
"admin"
|
|
1844
|
+
],
|
|
1845
|
+
"route": {
|
|
1846
|
+
"verb": "POST",
|
|
1847
|
+
"path": "/auditIbnIntent"
|
|
1848
|
+
},
|
|
1849
|
+
"task": true
|
|
1639
1850
|
}
|
|
1640
1851
|
],
|
|
1641
1852
|
"views": []
|
|
Binary file
|
|
@@ -648,6 +648,56 @@ describe('[integration] Nokia_altiplano Adapter Test', () => {
|
|
|
648
648
|
}).timeout(attemptTimeout);
|
|
649
649
|
});
|
|
650
650
|
|
|
651
|
+
describe('#auditIbnIntent - errors', () => {
|
|
652
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
653
|
+
try {
|
|
654
|
+
a.auditIbnIntent(intentIntent, (data, error) => {
|
|
655
|
+
try {
|
|
656
|
+
if (stub) {
|
|
657
|
+
const displayE = 'Error 400 received on request';
|
|
658
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
|
|
659
|
+
} else {
|
|
660
|
+
runCommonAsserts(data, error);
|
|
661
|
+
}
|
|
662
|
+
saveMockData('Intent', 'auditIbnIntent', 'default', data);
|
|
663
|
+
done();
|
|
664
|
+
} catch (err) {
|
|
665
|
+
log.error(`Test Failure: ${err}`);
|
|
666
|
+
done(err);
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
} catch (error) {
|
|
670
|
+
log.error(`Adapter Exception: ${error}`);
|
|
671
|
+
done(error);
|
|
672
|
+
}
|
|
673
|
+
}).timeout(attemptTimeout);
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
describe('#synchronizeIbnIntent - errors', () => {
|
|
677
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
678
|
+
try {
|
|
679
|
+
a.synchronizeIbnIntent(intentIntent, (data, error) => {
|
|
680
|
+
try {
|
|
681
|
+
if (stub) {
|
|
682
|
+
const displayE = 'Error 400 received on request';
|
|
683
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
|
|
684
|
+
} else {
|
|
685
|
+
runCommonAsserts(data, error);
|
|
686
|
+
}
|
|
687
|
+
saveMockData('Intent', 'synchronizeIbnIntent', 'default', data);
|
|
688
|
+
done();
|
|
689
|
+
} catch (err) {
|
|
690
|
+
log.error(`Test Failure: ${err}`);
|
|
691
|
+
done(err);
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
} catch (error) {
|
|
695
|
+
log.error(`Adapter Exception: ${error}`);
|
|
696
|
+
done(error);
|
|
697
|
+
}
|
|
698
|
+
}).timeout(attemptTimeout);
|
|
699
|
+
});
|
|
700
|
+
|
|
651
701
|
describe('#dependentsSummaryForDevice - errors', () => {
|
|
652
702
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
653
703
|
try {
|
|
@@ -831,6 +881,56 @@ describe('[integration] Nokia_altiplano Adapter Test', () => {
|
|
|
831
881
|
}).timeout(attemptTimeout);
|
|
832
882
|
});
|
|
833
883
|
|
|
884
|
+
describe('#modifyIbnIntent - errors', () => {
|
|
885
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
886
|
+
try {
|
|
887
|
+
a.modifyIbnIntent(intentIntent, intentLockOntBodyParam, (data, error) => {
|
|
888
|
+
try {
|
|
889
|
+
if (stub) {
|
|
890
|
+
const displayE = 'Error 400 received on request';
|
|
891
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
|
|
892
|
+
} else {
|
|
893
|
+
runCommonAsserts(data, error);
|
|
894
|
+
}
|
|
895
|
+
saveMockData('Intent', 'modifyIbnIntent', 'default', data);
|
|
896
|
+
done();
|
|
897
|
+
} catch (err) {
|
|
898
|
+
log.error(`Test Failure: ${err}`);
|
|
899
|
+
done(err);
|
|
900
|
+
}
|
|
901
|
+
});
|
|
902
|
+
} catch (error) {
|
|
903
|
+
log.error(`Adapter Exception: ${error}`);
|
|
904
|
+
done(error);
|
|
905
|
+
}
|
|
906
|
+
}).timeout(attemptTimeout);
|
|
907
|
+
});
|
|
908
|
+
|
|
909
|
+
describe('#getIbnIntent - errors', () => {
|
|
910
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
911
|
+
try {
|
|
912
|
+
a.getIbnIntent(intentIntent, (data, error) => {
|
|
913
|
+
try {
|
|
914
|
+
if (stub) {
|
|
915
|
+
const displayE = 'Error 400 received on request';
|
|
916
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
|
|
917
|
+
} else {
|
|
918
|
+
runCommonAsserts(data, error);
|
|
919
|
+
}
|
|
920
|
+
saveMockData('Intent', 'getIbnIntent', 'default', data);
|
|
921
|
+
done();
|
|
922
|
+
} catch (err) {
|
|
923
|
+
log.error(`Test Failure: ${err}`);
|
|
924
|
+
done(err);
|
|
925
|
+
}
|
|
926
|
+
});
|
|
927
|
+
} catch (error) {
|
|
928
|
+
log.error(`Adapter Exception: ${error}`);
|
|
929
|
+
done(error);
|
|
930
|
+
}
|
|
931
|
+
}).timeout(attemptTimeout);
|
|
932
|
+
});
|
|
933
|
+
|
|
834
934
|
describe('#deletel2User - errors', () => {
|
|
835
935
|
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
836
936
|
try {
|
|
@@ -880,5 +980,30 @@ describe('[integration] Nokia_altiplano Adapter Test', () => {
|
|
|
880
980
|
}
|
|
881
981
|
}).timeout(attemptTimeout);
|
|
882
982
|
});
|
|
983
|
+
|
|
984
|
+
describe('#deleteIbnIntent - errors', () => {
|
|
985
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
986
|
+
try {
|
|
987
|
+
a.deleteIbnIntent(intentIntent, (data, error) => {
|
|
988
|
+
try {
|
|
989
|
+
if (stub) {
|
|
990
|
+
const displayE = 'Error 400 received on request';
|
|
991
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-nokia_altiplano-connectorRest-handleEndResponse', displayE);
|
|
992
|
+
} else {
|
|
993
|
+
runCommonAsserts(data, error);
|
|
994
|
+
}
|
|
995
|
+
saveMockData('Intent', 'deleteIbnIntent', 'default', data);
|
|
996
|
+
done();
|
|
997
|
+
} catch (err) {
|
|
998
|
+
log.error(`Test Failure: ${err}`);
|
|
999
|
+
done(err);
|
|
1000
|
+
}
|
|
1001
|
+
});
|
|
1002
|
+
} catch (error) {
|
|
1003
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1004
|
+
done(error);
|
|
1005
|
+
}
|
|
1006
|
+
}).timeout(attemptTimeout);
|
|
1007
|
+
});
|
|
883
1008
|
});
|
|
884
1009
|
});
|
|
@@ -1846,5 +1846,167 @@ describe('[unit] Nokia_altiplano Adapter Test', () => {
|
|
|
1846
1846
|
}
|
|
1847
1847
|
}).timeout(attemptTimeout);
|
|
1848
1848
|
});
|
|
1849
|
+
|
|
1850
|
+
describe('#getIbnIntent - errors', () => {
|
|
1851
|
+
it('should have a getIbnIntent function', (done) => {
|
|
1852
|
+
try {
|
|
1853
|
+
assert.equal(true, typeof a.getIbnIntent === 'function');
|
|
1854
|
+
done();
|
|
1855
|
+
} catch (error) {
|
|
1856
|
+
log.error(`Test Failure: ${error}`);
|
|
1857
|
+
done(error);
|
|
1858
|
+
}
|
|
1859
|
+
}).timeout(attemptTimeout);
|
|
1860
|
+
it('should error if - missing intent', (done) => {
|
|
1861
|
+
try {
|
|
1862
|
+
a.getIbnIntent(null, (data, error) => {
|
|
1863
|
+
try {
|
|
1864
|
+
const displayE = 'intent is required';
|
|
1865
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-nokia_altiplano-adapter-getIbnIntent', displayE);
|
|
1866
|
+
done();
|
|
1867
|
+
} catch (err) {
|
|
1868
|
+
log.error(`Test Failure: ${err}`);
|
|
1869
|
+
done(err);
|
|
1870
|
+
}
|
|
1871
|
+
});
|
|
1872
|
+
} catch (error) {
|
|
1873
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1874
|
+
done(error);
|
|
1875
|
+
}
|
|
1876
|
+
}).timeout(attemptTimeout);
|
|
1877
|
+
});
|
|
1878
|
+
|
|
1879
|
+
describe('#modifyIbnIntent - errors', () => {
|
|
1880
|
+
it('should have a modifyIbnIntent function', (done) => {
|
|
1881
|
+
try {
|
|
1882
|
+
assert.equal(true, typeof a.modifyIbnIntent === 'function');
|
|
1883
|
+
done();
|
|
1884
|
+
} catch (error) {
|
|
1885
|
+
log.error(`Test Failure: ${error}`);
|
|
1886
|
+
done(error);
|
|
1887
|
+
}
|
|
1888
|
+
}).timeout(attemptTimeout);
|
|
1889
|
+
it('should error if - missing intent', (done) => {
|
|
1890
|
+
try {
|
|
1891
|
+
a.modifyIbnIntent(null, null, (data, error) => {
|
|
1892
|
+
try {
|
|
1893
|
+
const displayE = 'intent is required';
|
|
1894
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-nokia_altiplano-adapter-modifyIbnIntent', displayE);
|
|
1895
|
+
done();
|
|
1896
|
+
} catch (err) {
|
|
1897
|
+
log.error(`Test Failure: ${err}`);
|
|
1898
|
+
done(err);
|
|
1899
|
+
}
|
|
1900
|
+
});
|
|
1901
|
+
} catch (error) {
|
|
1902
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1903
|
+
done(error);
|
|
1904
|
+
}
|
|
1905
|
+
}).timeout(attemptTimeout);
|
|
1906
|
+
it('should error if - missing body', (done) => {
|
|
1907
|
+
try {
|
|
1908
|
+
a.modifyIbnIntent('fakeparam', null, (data, error) => {
|
|
1909
|
+
try {
|
|
1910
|
+
const displayE = 'body is required';
|
|
1911
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-nokia_altiplano-adapter-modifyIbnIntent', displayE);
|
|
1912
|
+
done();
|
|
1913
|
+
} catch (err) {
|
|
1914
|
+
log.error(`Test Failure: ${err}`);
|
|
1915
|
+
done(err);
|
|
1916
|
+
}
|
|
1917
|
+
});
|
|
1918
|
+
} catch (error) {
|
|
1919
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1920
|
+
done(error);
|
|
1921
|
+
}
|
|
1922
|
+
}).timeout(attemptTimeout);
|
|
1923
|
+
});
|
|
1924
|
+
|
|
1925
|
+
describe('#deleteIbnIntent - errors', () => {
|
|
1926
|
+
it('should have a deleteIbnIntent function', (done) => {
|
|
1927
|
+
try {
|
|
1928
|
+
assert.equal(true, typeof a.deleteIbnIntent === 'function');
|
|
1929
|
+
done();
|
|
1930
|
+
} catch (error) {
|
|
1931
|
+
log.error(`Test Failure: ${error}`);
|
|
1932
|
+
done(error);
|
|
1933
|
+
}
|
|
1934
|
+
}).timeout(attemptTimeout);
|
|
1935
|
+
it('should error if - missing intent', (done) => {
|
|
1936
|
+
try {
|
|
1937
|
+
a.deleteIbnIntent(null, (data, error) => {
|
|
1938
|
+
try {
|
|
1939
|
+
const displayE = 'intent is required';
|
|
1940
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-nokia_altiplano-adapter-deleteIbnIntent', displayE);
|
|
1941
|
+
done();
|
|
1942
|
+
} catch (err) {
|
|
1943
|
+
log.error(`Test Failure: ${err}`);
|
|
1944
|
+
done(err);
|
|
1945
|
+
}
|
|
1946
|
+
});
|
|
1947
|
+
} catch (error) {
|
|
1948
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1949
|
+
done(error);
|
|
1950
|
+
}
|
|
1951
|
+
}).timeout(attemptTimeout);
|
|
1952
|
+
});
|
|
1953
|
+
|
|
1954
|
+
describe('#synchronizeIbnIntent - errors', () => {
|
|
1955
|
+
it('should have a synchronizeIbnIntent function', (done) => {
|
|
1956
|
+
try {
|
|
1957
|
+
assert.equal(true, typeof a.synchronizeIbnIntent === 'function');
|
|
1958
|
+
done();
|
|
1959
|
+
} catch (error) {
|
|
1960
|
+
log.error(`Test Failure: ${error}`);
|
|
1961
|
+
done(error);
|
|
1962
|
+
}
|
|
1963
|
+
}).timeout(attemptTimeout);
|
|
1964
|
+
it('should error if - missing intent', (done) => {
|
|
1965
|
+
try {
|
|
1966
|
+
a.synchronizeIbnIntent(null, (data, error) => {
|
|
1967
|
+
try {
|
|
1968
|
+
const displayE = 'intent is required';
|
|
1969
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-nokia_altiplano-adapter-synchronizeIbnIntent', displayE);
|
|
1970
|
+
done();
|
|
1971
|
+
} catch (err) {
|
|
1972
|
+
log.error(`Test Failure: ${err}`);
|
|
1973
|
+
done(err);
|
|
1974
|
+
}
|
|
1975
|
+
});
|
|
1976
|
+
} catch (error) {
|
|
1977
|
+
log.error(`Adapter Exception: ${error}`);
|
|
1978
|
+
done(error);
|
|
1979
|
+
}
|
|
1980
|
+
}).timeout(attemptTimeout);
|
|
1981
|
+
});
|
|
1982
|
+
|
|
1983
|
+
describe('#auditIbnIntent - errors', () => {
|
|
1984
|
+
it('should have a auditIbnIntent function', (done) => {
|
|
1985
|
+
try {
|
|
1986
|
+
assert.equal(true, typeof a.auditIbnIntent === 'function');
|
|
1987
|
+
done();
|
|
1988
|
+
} catch (error) {
|
|
1989
|
+
log.error(`Test Failure: ${error}`);
|
|
1990
|
+
done(error);
|
|
1991
|
+
}
|
|
1992
|
+
}).timeout(attemptTimeout);
|
|
1993
|
+
it('should error if - missing intent', (done) => {
|
|
1994
|
+
try {
|
|
1995
|
+
a.auditIbnIntent(null, (data, error) => {
|
|
1996
|
+
try {
|
|
1997
|
+
const displayE = 'intent is required';
|
|
1998
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-nokia_altiplano-adapter-auditIbnIntent', displayE);
|
|
1999
|
+
done();
|
|
2000
|
+
} catch (err) {
|
|
2001
|
+
log.error(`Test Failure: ${err}`);
|
|
2002
|
+
done(err);
|
|
2003
|
+
}
|
|
2004
|
+
});
|
|
2005
|
+
} catch (error) {
|
|
2006
|
+
log.error(`Adapter Exception: ${error}`);
|
|
2007
|
+
done(error);
|
|
2008
|
+
}
|
|
2009
|
+
}).timeout(attemptTimeout);
|
|
2010
|
+
});
|
|
1849
2011
|
});
|
|
1850
2012
|
});
|