@itentialopensource/adapter-infoblox 1.11.0 → 1.12.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 +198 -0
- package/entities/Networks/action.json +42 -0
- package/entities/Networks/requestSchema.json +3 -1
- package/entities/Networks/responseSchema.json +3 -1
- package/package.json +1 -1
- package/pronghorn.json +118 -0
- package/refs?service=git-upload-pack +0 -0
- package/test/integration/adapterTestIntegration.js +50 -0
- package/test/unit/adapterTestUnit.js +109 -0
package/CHANGELOG.md
CHANGED
package/adapter.js
CHANGED
|
@@ -28212,6 +28212,204 @@ class Infoblox extends AdapterBaseCl {
|
|
|
28212
28212
|
return callback(null, errorObj);
|
|
28213
28213
|
}
|
|
28214
28214
|
}
|
|
28215
|
+
|
|
28216
|
+
/**
|
|
28217
|
+
* @function getNetworkZoneAssociations
|
|
28218
|
+
* @pronghornType method
|
|
28219
|
+
* @name getNetworkZoneAssociations
|
|
28220
|
+
* @summary getNetworkZoneAssociations
|
|
28221
|
+
*
|
|
28222
|
+
* @param {string} networkId - The id of the network to get zones for
|
|
28223
|
+
* @param {string} networkView - The network view we are getting zones from
|
|
28224
|
+
* @param {object} [query] - The query parameters to include on the request
|
|
28225
|
+
* @return {object} results - An object containing the response of the action
|
|
28226
|
+
*
|
|
28227
|
+
* @route {POST} /getNetworkZoneAssociations
|
|
28228
|
+
* @roles admin
|
|
28229
|
+
* @task true
|
|
28230
|
+
*/
|
|
28231
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
28232
|
+
getNetworkZoneAssociations(networkId, networkView, query, callback) {
|
|
28233
|
+
const meth = 'adapter-getNetworkZoneAssociations';
|
|
28234
|
+
const origin = `${this.id}-${meth}`;
|
|
28235
|
+
log.trace(origin);
|
|
28236
|
+
|
|
28237
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
28238
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
28239
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28240
|
+
return callback(null, errorObj);
|
|
28241
|
+
}
|
|
28242
|
+
|
|
28243
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
28244
|
+
if (networkId === undefined || networkId === null || networkId === '') {
|
|
28245
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkId'], null, null, null);
|
|
28246
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28247
|
+
return callback(null, errorObj);
|
|
28248
|
+
}
|
|
28249
|
+
if (networkId.indexOf('/') < 1) {
|
|
28250
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['subnet mask in networkId'], null, null, null);
|
|
28251
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28252
|
+
return callback(null, errorObj);
|
|
28253
|
+
}
|
|
28254
|
+
const netParts = networkId.split('/');
|
|
28255
|
+
let netView = 'default';
|
|
28256
|
+
if (networkView) {
|
|
28257
|
+
netView = networkView;
|
|
28258
|
+
}
|
|
28259
|
+
|
|
28260
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
28261
|
+
let queryParamsAvailable = {};
|
|
28262
|
+
if (query) {
|
|
28263
|
+
queryParamsAvailable = query;
|
|
28264
|
+
}
|
|
28265
|
+
const queryParams = {};
|
|
28266
|
+
const pathVars = [netParts[0], netParts[1], netView];
|
|
28267
|
+
const bodyVars = {};
|
|
28268
|
+
|
|
28269
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
28270
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
28271
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
28272
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
28273
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
28274
|
+
}
|
|
28275
|
+
});
|
|
28276
|
+
|
|
28277
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
28278
|
+
// see adapter code documentation for more information on the request object's fields
|
|
28279
|
+
const reqObj = {
|
|
28280
|
+
payload: bodyVars,
|
|
28281
|
+
uriPathVars: pathVars,
|
|
28282
|
+
uriQuery: queryParams
|
|
28283
|
+
};
|
|
28284
|
+
|
|
28285
|
+
try {
|
|
28286
|
+
// Make the call -
|
|
28287
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
28288
|
+
return this.requestHandlerInst.identifyRequest('Networks', 'getNetworkZoneAssociations', reqObj, false, (irReturnData, irReturnError) => {
|
|
28289
|
+
// if we received an error or their is no response on the results
|
|
28290
|
+
// return an error
|
|
28291
|
+
if (irReturnError) {
|
|
28292
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
28293
|
+
return callback(null, irReturnError);
|
|
28294
|
+
}
|
|
28295
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
28296
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getNetworkZoneAssociations'], null, null, null);
|
|
28297
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28298
|
+
return callback(null, errorObj);
|
|
28299
|
+
}
|
|
28300
|
+
|
|
28301
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
28302
|
+
// return the response
|
|
28303
|
+
return callback(irReturnData, null);
|
|
28304
|
+
});
|
|
28305
|
+
} catch (ex) {
|
|
28306
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
28307
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28308
|
+
return callback(null, errorObj);
|
|
28309
|
+
}
|
|
28310
|
+
}
|
|
28311
|
+
|
|
28312
|
+
/**
|
|
28313
|
+
* @function addNetworkZoneAssociation
|
|
28314
|
+
* @pronghornType method
|
|
28315
|
+
* @name addNetworkZoneAssociation
|
|
28316
|
+
* @summary addNetworkZoneAssociation
|
|
28317
|
+
*
|
|
28318
|
+
* @param {string} networkId - The id of the network to get zones for
|
|
28319
|
+
* @param {string} networkView - The network view we are getting zones from
|
|
28320
|
+
* @param {object} [query] - The query parameters to include on the request
|
|
28321
|
+
* @param {object} body - The zone information to include on the request
|
|
28322
|
+
* @return {object} results - An object containing the response of the action
|
|
28323
|
+
*
|
|
28324
|
+
* @route {POST} /addNetworkZoneAssociation
|
|
28325
|
+
* @roles admin
|
|
28326
|
+
* @task true
|
|
28327
|
+
*/
|
|
28328
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
28329
|
+
addNetworkZoneAssociation(networkId, networkView, query, body, callback) {
|
|
28330
|
+
const meth = 'adapter-addNetworkZoneAssociation';
|
|
28331
|
+
const origin = `${this.id}-${meth}`;
|
|
28332
|
+
log.trace(origin);
|
|
28333
|
+
|
|
28334
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
28335
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
28336
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28337
|
+
return callback(null, errorObj);
|
|
28338
|
+
}
|
|
28339
|
+
|
|
28340
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
28341
|
+
if (networkId === undefined || networkId === null || networkId === '') {
|
|
28342
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkId'], null, null, null);
|
|
28343
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28344
|
+
return callback(null, errorObj);
|
|
28345
|
+
}
|
|
28346
|
+
if (networkId.indexOf('/') < 1) {
|
|
28347
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['subnet mask in networkId'], null, null, null);
|
|
28348
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28349
|
+
return callback(null, errorObj);
|
|
28350
|
+
}
|
|
28351
|
+
if (body === undefined || body === null || body === '') {
|
|
28352
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['body'], null, null, null);
|
|
28353
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28354
|
+
return callback(null, errorObj);
|
|
28355
|
+
}
|
|
28356
|
+
const netParts = networkId.split('/');
|
|
28357
|
+
let netView = 'default';
|
|
28358
|
+
if (networkView) {
|
|
28359
|
+
netView = networkView;
|
|
28360
|
+
}
|
|
28361
|
+
|
|
28362
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
28363
|
+
let queryParamsAvailable = {};
|
|
28364
|
+
if (query) {
|
|
28365
|
+
queryParamsAvailable = query;
|
|
28366
|
+
}
|
|
28367
|
+
const queryParams = {};
|
|
28368
|
+
const pathVars = [netParts[0], netParts[1], netView];
|
|
28369
|
+
const bodyVars = body;
|
|
28370
|
+
|
|
28371
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
28372
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
28373
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
28374
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
28375
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
28376
|
+
}
|
|
28377
|
+
});
|
|
28378
|
+
|
|
28379
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
28380
|
+
// see adapter code documentation for more information on the request object's fields
|
|
28381
|
+
const reqObj = {
|
|
28382
|
+
payload: bodyVars,
|
|
28383
|
+
uriPathVars: pathVars,
|
|
28384
|
+
uriQuery: queryParams
|
|
28385
|
+
};
|
|
28386
|
+
|
|
28387
|
+
try {
|
|
28388
|
+
// Make the call -
|
|
28389
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
28390
|
+
return this.requestHandlerInst.identifyRequest('Networks', 'addNetworkZoneAssociation', reqObj, false, (irReturnData, irReturnError) => {
|
|
28391
|
+
// if we received an error or their is no response on the results
|
|
28392
|
+
// return an error
|
|
28393
|
+
if (irReturnError) {
|
|
28394
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
28395
|
+
return callback(null, irReturnError);
|
|
28396
|
+
}
|
|
28397
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
28398
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addNetworkZoneAssociation'], null, null, null);
|
|
28399
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28400
|
+
return callback(null, errorObj);
|
|
28401
|
+
}
|
|
28402
|
+
|
|
28403
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
28404
|
+
// return the response
|
|
28405
|
+
return callback(irReturnData, null);
|
|
28406
|
+
});
|
|
28407
|
+
} catch (ex) {
|
|
28408
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
28409
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
28410
|
+
return callback(null, errorObj);
|
|
28411
|
+
}
|
|
28412
|
+
}
|
|
28215
28413
|
}
|
|
28216
28414
|
|
|
28217
28415
|
module.exports = Infoblox;
|
|
@@ -418,6 +418,48 @@
|
|
|
418
418
|
"mockFile": ""
|
|
419
419
|
}
|
|
420
420
|
]
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"name": "getNetworkZoneAssociations",
|
|
424
|
+
"protocol": "REST",
|
|
425
|
+
"method": "GET",
|
|
426
|
+
"entitypath": "{base_path}/{version}/network/{pathv1}/{pathv2}/{pathv3}?{query}",
|
|
427
|
+
"requestSchema": "requestSchema.json",
|
|
428
|
+
"responseSchema": "responseSchema.json",
|
|
429
|
+
"timeout": 0,
|
|
430
|
+
"sendEmpty": false,
|
|
431
|
+
"sendGetBody": false,
|
|
432
|
+
"requestDatatype": "JSON",
|
|
433
|
+
"responseDatatype": "JSON",
|
|
434
|
+
"headers": {},
|
|
435
|
+
"responseObjects": [
|
|
436
|
+
{
|
|
437
|
+
"type": "default",
|
|
438
|
+
"key": "",
|
|
439
|
+
"mockFile": ""
|
|
440
|
+
}
|
|
441
|
+
]
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
"name": "addNetworkZoneAssociation",
|
|
445
|
+
"protocol": "REST",
|
|
446
|
+
"method": "PUT",
|
|
447
|
+
"entitypath": "{base_path}/{version}/network/{pathv1}/{pathv2}/{pathv3}?{query}",
|
|
448
|
+
"requestSchema": "requestSchema.json",
|
|
449
|
+
"responseSchema": "responseSchema.json",
|
|
450
|
+
"timeout": 0,
|
|
451
|
+
"sendEmpty": false,
|
|
452
|
+
"sendGetBody": false,
|
|
453
|
+
"requestDatatype": "JSON",
|
|
454
|
+
"responseDatatype": "JSON",
|
|
455
|
+
"headers": {},
|
|
456
|
+
"responseObjects": [
|
|
457
|
+
{
|
|
458
|
+
"type": "default",
|
|
459
|
+
"key": "",
|
|
460
|
+
"mockFile": ""
|
|
461
|
+
}
|
|
462
|
+
]
|
|
421
463
|
}
|
|
422
464
|
]
|
|
423
465
|
}
|
|
@@ -27,7 +27,9 @@
|
|
|
27
27
|
"deleteNetwork",
|
|
28
28
|
"modifyNetworkBlock",
|
|
29
29
|
"getNetworkContainerNextNetworkIps",
|
|
30
|
-
"getIpv6NetworkContainerNextNetworkIps"
|
|
30
|
+
"getIpv6NetworkContainerNextNetworkIps",
|
|
31
|
+
"getNetworkZoneAssociations",
|
|
32
|
+
"addNetworkZoneAssociation"
|
|
31
33
|
],
|
|
32
34
|
"external_name": "ph_request_type"
|
|
33
35
|
},
|
|
@@ -25,7 +25,9 @@
|
|
|
25
25
|
"deleteNetwork",
|
|
26
26
|
"modifyNetworkBlock",
|
|
27
27
|
"getNetworkContainerNextNetworkIps",
|
|
28
|
-
"getIpv6NetworkContainerNextNetworkIps"
|
|
28
|
+
"getIpv6NetworkContainerNextNetworkIps",
|
|
29
|
+
"getNetworkZoneAssociations",
|
|
30
|
+
"addNetworkZoneAssociation"
|
|
29
31
|
],
|
|
30
32
|
"external_name": "ph_request_type"
|
|
31
33
|
},
|
package/package.json
CHANGED
package/pronghorn.json
CHANGED
|
@@ -20817,6 +20817,124 @@
|
|
|
20817
20817
|
"path": "/deleteZoneStubByReference"
|
|
20818
20818
|
},
|
|
20819
20819
|
"task": true
|
|
20820
|
+
},
|
|
20821
|
+
{
|
|
20822
|
+
"name": "getNetworkZoneAssociations",
|
|
20823
|
+
"summary": "getNetworkZoneAssociations",
|
|
20824
|
+
"description": "getNetworkZoneAssociations",
|
|
20825
|
+
"input": [
|
|
20826
|
+
{
|
|
20827
|
+
"name": "networkId",
|
|
20828
|
+
"type": "string",
|
|
20829
|
+
"info": "The id of the network to get zones for",
|
|
20830
|
+
"required": true,
|
|
20831
|
+
"schema": {
|
|
20832
|
+
"title": "networkId",
|
|
20833
|
+
"type": "string"
|
|
20834
|
+
}
|
|
20835
|
+
},
|
|
20836
|
+
{
|
|
20837
|
+
"name": "networkView",
|
|
20838
|
+
"type": "string",
|
|
20839
|
+
"info": "The network view we are getting zones from",
|
|
20840
|
+
"required": false,
|
|
20841
|
+
"schema": {
|
|
20842
|
+
"title": "networkView",
|
|
20843
|
+
"type": "string"
|
|
20844
|
+
}
|
|
20845
|
+
},
|
|
20846
|
+
{
|
|
20847
|
+
"name": "query",
|
|
20848
|
+
"type": "object",
|
|
20849
|
+
"info": "The query parameters to include on the request",
|
|
20850
|
+
"required": false,
|
|
20851
|
+
"schema": {
|
|
20852
|
+
"title": "query",
|
|
20853
|
+
"type": "object"
|
|
20854
|
+
}
|
|
20855
|
+
}
|
|
20856
|
+
],
|
|
20857
|
+
"output": {
|
|
20858
|
+
"name": "result",
|
|
20859
|
+
"type": "object",
|
|
20860
|
+
"description": "A JSON Object containing status, code and the result",
|
|
20861
|
+
"schema": {
|
|
20862
|
+
"title": "result",
|
|
20863
|
+
"type": "object"
|
|
20864
|
+
}
|
|
20865
|
+
},
|
|
20866
|
+
"roles": [
|
|
20867
|
+
"admin"
|
|
20868
|
+
],
|
|
20869
|
+
"route": {
|
|
20870
|
+
"verb": "POST",
|
|
20871
|
+
"path": "/getNetworkZoneAssociations"
|
|
20872
|
+
},
|
|
20873
|
+
"task": true
|
|
20874
|
+
},
|
|
20875
|
+
{
|
|
20876
|
+
"name": "addNetworkZoneAssociation",
|
|
20877
|
+
"summary": "addNetworkZoneAssociation",
|
|
20878
|
+
"description": "addNetworkZoneAssociation",
|
|
20879
|
+
"input": [
|
|
20880
|
+
{
|
|
20881
|
+
"name": "networkId",
|
|
20882
|
+
"type": "string",
|
|
20883
|
+
"info": "The id of the network to get zones for",
|
|
20884
|
+
"required": true,
|
|
20885
|
+
"schema": {
|
|
20886
|
+
"title": "networkId",
|
|
20887
|
+
"type": "string"
|
|
20888
|
+
}
|
|
20889
|
+
},
|
|
20890
|
+
{
|
|
20891
|
+
"name": "networkView",
|
|
20892
|
+
"type": "string",
|
|
20893
|
+
"info": "The network view we are getting zones from",
|
|
20894
|
+
"required": false,
|
|
20895
|
+
"schema": {
|
|
20896
|
+
"title": "networkView",
|
|
20897
|
+
"type": "string"
|
|
20898
|
+
}
|
|
20899
|
+
},
|
|
20900
|
+
{
|
|
20901
|
+
"name": "query",
|
|
20902
|
+
"type": "object",
|
|
20903
|
+
"info": "The query parameters to include on the request",
|
|
20904
|
+
"required": false,
|
|
20905
|
+
"schema": {
|
|
20906
|
+
"title": "query",
|
|
20907
|
+
"type": "object"
|
|
20908
|
+
}
|
|
20909
|
+
},
|
|
20910
|
+
{
|
|
20911
|
+
"name": "body",
|
|
20912
|
+
"type": "object",
|
|
20913
|
+
"info": "The zone information to include on the request",
|
|
20914
|
+
"required": true,
|
|
20915
|
+
"schema": {
|
|
20916
|
+
"title": "body",
|
|
20917
|
+
"type": "object"
|
|
20918
|
+
}
|
|
20919
|
+
}
|
|
20920
|
+
],
|
|
20921
|
+
"output": {
|
|
20922
|
+
"name": "result",
|
|
20923
|
+
"type": "object",
|
|
20924
|
+
"description": "A JSON Object containing status, code and the result",
|
|
20925
|
+
"schema": {
|
|
20926
|
+
"title": "result",
|
|
20927
|
+
"type": "object"
|
|
20928
|
+
}
|
|
20929
|
+
},
|
|
20930
|
+
"roles": [
|
|
20931
|
+
"admin"
|
|
20932
|
+
],
|
|
20933
|
+
"route": {
|
|
20934
|
+
"verb": "POST",
|
|
20935
|
+
"path": "/addNetworkZoneAssociation"
|
|
20936
|
+
},
|
|
20937
|
+
"task": true
|
|
20820
20938
|
}
|
|
20821
20939
|
]
|
|
20822
20940
|
}
|
|
Binary file
|
|
@@ -10244,5 +10244,55 @@ describe('[integration] Infoblox Adapter Test', () => {
|
|
|
10244
10244
|
}
|
|
10245
10245
|
}).timeout(attemptTimeout);
|
|
10246
10246
|
});
|
|
10247
|
+
|
|
10248
|
+
describe('#addNetworkZoneAssociation - errors', () => {
|
|
10249
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
10250
|
+
try {
|
|
10251
|
+
a.addNetworkZoneAssociation('fakedata/16', null, null, { key: 'value' }, (data, error) => {
|
|
10252
|
+
try {
|
|
10253
|
+
if (stub) {
|
|
10254
|
+
const displayE = 'Error 400 received on request';
|
|
10255
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-infoblox-connectorRest-handleEndResponse', displayE);
|
|
10256
|
+
} else {
|
|
10257
|
+
runCommonAsserts(data, error);
|
|
10258
|
+
}
|
|
10259
|
+
saveMockData('Networks', 'addNetworkZoneAssociation', 'default', data);
|
|
10260
|
+
done();
|
|
10261
|
+
} catch (err) {
|
|
10262
|
+
log.error(`Test Failure: ${err}`);
|
|
10263
|
+
done(err);
|
|
10264
|
+
}
|
|
10265
|
+
});
|
|
10266
|
+
} catch (error) {
|
|
10267
|
+
log.error(`Adapter Exception: ${error}`);
|
|
10268
|
+
done(error);
|
|
10269
|
+
}
|
|
10270
|
+
}).timeout(attemptTimeout);
|
|
10271
|
+
});
|
|
10272
|
+
|
|
10273
|
+
describe('#getNetworkZoneAssociations - errors', () => {
|
|
10274
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
10275
|
+
try {
|
|
10276
|
+
a.getNetworkZoneAssociations('fakedata/16', null, null, (data, error) => {
|
|
10277
|
+
try {
|
|
10278
|
+
if (stub) {
|
|
10279
|
+
const displayE = 'Error 400 received on request';
|
|
10280
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-infoblox-connectorRest-handleEndResponse', displayE);
|
|
10281
|
+
} else {
|
|
10282
|
+
runCommonAsserts(data, error);
|
|
10283
|
+
}
|
|
10284
|
+
saveMockData('Networks', 'getNetworkZoneAssociations', 'default', data);
|
|
10285
|
+
done();
|
|
10286
|
+
} catch (err) {
|
|
10287
|
+
log.error(`Test Failure: ${err}`);
|
|
10288
|
+
done(err);
|
|
10289
|
+
}
|
|
10290
|
+
});
|
|
10291
|
+
} catch (error) {
|
|
10292
|
+
log.error(`Adapter Exception: ${error}`);
|
|
10293
|
+
done(error);
|
|
10294
|
+
}
|
|
10295
|
+
}).timeout(attemptTimeout);
|
|
10296
|
+
});
|
|
10247
10297
|
});
|
|
10248
10298
|
});
|
|
@@ -10747,5 +10747,114 @@ describe('[unit] Infoblox Adapter Test', () => {
|
|
|
10747
10747
|
}
|
|
10748
10748
|
}).timeout(attemptTimeout);
|
|
10749
10749
|
});
|
|
10750
|
+
|
|
10751
|
+
describe('#getNetworkZoneAssociations - errors', () => {
|
|
10752
|
+
it('should have a getNetworkZoneAssociations function', (done) => {
|
|
10753
|
+
try {
|
|
10754
|
+
assert.equal(true, typeof a.getNetworkZoneAssociations === 'function');
|
|
10755
|
+
done();
|
|
10756
|
+
} catch (error) {
|
|
10757
|
+
log.error(`Test Failure: ${error}`);
|
|
10758
|
+
done(error);
|
|
10759
|
+
}
|
|
10760
|
+
}).timeout(attemptTimeout);
|
|
10761
|
+
it('should error if - missing networkId', (done) => {
|
|
10762
|
+
try {
|
|
10763
|
+
a.getNetworkZoneAssociations(null, null, null, (data, error) => {
|
|
10764
|
+
try {
|
|
10765
|
+
const displayE = 'networkId is required';
|
|
10766
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-infoblox-adapter-getNetworkZoneAssociations', displayE);
|
|
10767
|
+
done();
|
|
10768
|
+
} catch (err) {
|
|
10769
|
+
log.error(`Test Failure: ${err}`);
|
|
10770
|
+
done(err);
|
|
10771
|
+
}
|
|
10772
|
+
});
|
|
10773
|
+
} catch (error) {
|
|
10774
|
+
log.error(`Adapter Exception: ${error}`);
|
|
10775
|
+
done(error);
|
|
10776
|
+
}
|
|
10777
|
+
}).timeout(attemptTimeout);
|
|
10778
|
+
it('should error if - missing networkId subnet mask', (done) => {
|
|
10779
|
+
try {
|
|
10780
|
+
a.getNetworkZoneAssociations('fakedata', null, null, (data, error) => {
|
|
10781
|
+
try {
|
|
10782
|
+
const displayE = 'subnet mask in networkId is required';
|
|
10783
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-infoblox-adapter-getNetworkZoneAssociations', displayE);
|
|
10784
|
+
done();
|
|
10785
|
+
} catch (err) {
|
|
10786
|
+
log.error(`Test Failure: ${err}`);
|
|
10787
|
+
done(err);
|
|
10788
|
+
}
|
|
10789
|
+
});
|
|
10790
|
+
} catch (error) {
|
|
10791
|
+
log.error(`Adapter Exception: ${error}`);
|
|
10792
|
+
done(error);
|
|
10793
|
+
}
|
|
10794
|
+
}).timeout(attemptTimeout);
|
|
10795
|
+
});
|
|
10796
|
+
|
|
10797
|
+
describe('#addNetworkZoneAssociation - errors', () => {
|
|
10798
|
+
it('should have a addNetworkZoneAssociation function', (done) => {
|
|
10799
|
+
try {
|
|
10800
|
+
assert.equal(true, typeof a.addNetworkZoneAssociation === 'function');
|
|
10801
|
+
done();
|
|
10802
|
+
} catch (error) {
|
|
10803
|
+
log.error(`Test Failure: ${error}`);
|
|
10804
|
+
done(error);
|
|
10805
|
+
}
|
|
10806
|
+
}).timeout(attemptTimeout);
|
|
10807
|
+
it('should error if - missing networkId', (done) => {
|
|
10808
|
+
try {
|
|
10809
|
+
a.addNetworkZoneAssociation(null, null, null, null, (data, error) => {
|
|
10810
|
+
try {
|
|
10811
|
+
const displayE = 'networkId is required';
|
|
10812
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-infoblox-adapter-addNetworkZoneAssociation', displayE);
|
|
10813
|
+
done();
|
|
10814
|
+
} catch (err) {
|
|
10815
|
+
log.error(`Test Failure: ${err}`);
|
|
10816
|
+
done(err);
|
|
10817
|
+
}
|
|
10818
|
+
});
|
|
10819
|
+
} catch (error) {
|
|
10820
|
+
log.error(`Adapter Exception: ${error}`);
|
|
10821
|
+
done(error);
|
|
10822
|
+
}
|
|
10823
|
+
}).timeout(attemptTimeout);
|
|
10824
|
+
it('should error if - missing networkId subnet mask', (done) => {
|
|
10825
|
+
try {
|
|
10826
|
+
a.addNetworkZoneAssociation('fakedata', null, null, null, (data, error) => {
|
|
10827
|
+
try {
|
|
10828
|
+
const displayE = 'subnet mask in networkId is required';
|
|
10829
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-infoblox-adapter-addNetworkZoneAssociation', displayE);
|
|
10830
|
+
done();
|
|
10831
|
+
} catch (err) {
|
|
10832
|
+
log.error(`Test Failure: ${err}`);
|
|
10833
|
+
done(err);
|
|
10834
|
+
}
|
|
10835
|
+
});
|
|
10836
|
+
} catch (error) {
|
|
10837
|
+
log.error(`Adapter Exception: ${error}`);
|
|
10838
|
+
done(error);
|
|
10839
|
+
}
|
|
10840
|
+
}).timeout(attemptTimeout);
|
|
10841
|
+
it('should error if - missing body', (done) => {
|
|
10842
|
+
try {
|
|
10843
|
+
a.addNetworkZoneAssociation('fakedata/16', null, null, null, (data, error) => {
|
|
10844
|
+
try {
|
|
10845
|
+
const displayE = 'body is required';
|
|
10846
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-infoblox-adapter-addNetworkZoneAssociation', displayE);
|
|
10847
|
+
done();
|
|
10848
|
+
} catch (err) {
|
|
10849
|
+
log.error(`Test Failure: ${err}`);
|
|
10850
|
+
done(err);
|
|
10851
|
+
}
|
|
10852
|
+
});
|
|
10853
|
+
} catch (error) {
|
|
10854
|
+
log.error(`Adapter Exception: ${error}`);
|
|
10855
|
+
done(error);
|
|
10856
|
+
}
|
|
10857
|
+
}).timeout(attemptTimeout);
|
|
10858
|
+
});
|
|
10750
10859
|
});
|
|
10751
10860
|
});
|