@itentialopensource/adapter-six_connect 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/adapter.js +75 -0
- package/entities/ipam/action.json +21 -0
- package/entities/ipam/schema.json +2 -1
- package/package.json +1 -1
- package/pronghorn.json +44 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +7 -7
- package/test/integration/adapterTestIntegration.js +30 -0
- package/test/unit/adapterTestUnit.js +29 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
|
|
2
|
+
## 0.7.1 [03-14-2023]
|
|
3
|
+
|
|
4
|
+
* Add a task to ipam entity
|
|
5
|
+
|
|
6
|
+
See merge request itentialopensource/adapters/controller-orchestrator/adapter-six_connect!11
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
2
10
|
## 0.7.0 [07-25-2022]
|
|
3
11
|
|
|
4
12
|
* Changes for smartAssign -- added smartAssignTags and smartAssignObject for requested changes
|
package/adapter.js
CHANGED
|
@@ -7298,6 +7298,81 @@ class SixConnect extends AdapterBaseCl {
|
|
|
7298
7298
|
}
|
|
7299
7299
|
}
|
|
7300
7300
|
|
|
7301
|
+
/**
|
|
7302
|
+
* @summary CREATE IPAM Swip
|
|
7303
|
+
*
|
|
7304
|
+
* @function postIpamSwip
|
|
7305
|
+
* @param {string} netblockId - netblock id
|
|
7306
|
+
* @param {object} body - body param
|
|
7307
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
7308
|
+
*/
|
|
7309
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
7310
|
+
postIpamSwip(netblockId, body, callback) {
|
|
7311
|
+
const meth = 'adapter-postIpamSwip';
|
|
7312
|
+
const origin = `${this.id}-${meth}`;
|
|
7313
|
+
log.trace(origin);
|
|
7314
|
+
|
|
7315
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
7316
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
7317
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
7318
|
+
return callback(null, errorObj);
|
|
7319
|
+
}
|
|
7320
|
+
|
|
7321
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
7322
|
+
if (netblockId === undefined || netblockId === null || netblockId === '') {
|
|
7323
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['netblockId'], null, null, null);
|
|
7324
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
7325
|
+
return callback(null, errorObj);
|
|
7326
|
+
}
|
|
7327
|
+
|
|
7328
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
7329
|
+
const queryParamsAvailable = {};
|
|
7330
|
+
const queryParams = {};
|
|
7331
|
+
const pathVars = [netblockId];
|
|
7332
|
+
const bodyVars = body;
|
|
7333
|
+
|
|
7334
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
7335
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
7336
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
7337
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
7338
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
7339
|
+
}
|
|
7340
|
+
});
|
|
7341
|
+
|
|
7342
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
7343
|
+
const reqObj = {
|
|
7344
|
+
payload: bodyVars,
|
|
7345
|
+
uriPathVars: pathVars,
|
|
7346
|
+
uriQuery: queryParams
|
|
7347
|
+
};
|
|
7348
|
+
|
|
7349
|
+
try {
|
|
7350
|
+
// Make the call -
|
|
7351
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
7352
|
+
return this.requestHandlerInst.identifyRequest('ipam', 'postIpamSwip', reqObj, true, (irReturnData, irReturnError) => {
|
|
7353
|
+
// if we received an error or their is no response on the results
|
|
7354
|
+
// return an error
|
|
7355
|
+
if (irReturnError) {
|
|
7356
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
7357
|
+
return callback(null, irReturnError);
|
|
7358
|
+
}
|
|
7359
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
7360
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['postIpamSwip'], null, null, null);
|
|
7361
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
7362
|
+
return callback(null, errorObj);
|
|
7363
|
+
}
|
|
7364
|
+
|
|
7365
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
7366
|
+
// return the response
|
|
7367
|
+
return callback(irReturnData, null);
|
|
7368
|
+
});
|
|
7369
|
+
} catch (ex) {
|
|
7370
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
7371
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
7372
|
+
return callback(null, errorObj);
|
|
7373
|
+
}
|
|
7374
|
+
}
|
|
7375
|
+
|
|
7301
7376
|
/**
|
|
7302
7377
|
* @summary Get workflows
|
|
7303
7378
|
*
|
|
@@ -1805,6 +1805,27 @@
|
|
|
1805
1805
|
"mockFile": ""
|
|
1806
1806
|
}
|
|
1807
1807
|
]
|
|
1808
|
+
},
|
|
1809
|
+
{
|
|
1810
|
+
"name": "postIpamSwip",
|
|
1811
|
+
"protocol": "REST",
|
|
1812
|
+
"method": "POST",
|
|
1813
|
+
"entitypath": "{base_path}/{version}/ipam/swip/{pathv1}/simple?{query}",
|
|
1814
|
+
"requestSchema": "schema.json",
|
|
1815
|
+
"responseSchema": "schema.json",
|
|
1816
|
+
"timeout": 0,
|
|
1817
|
+
"sendEmpty": false,
|
|
1818
|
+
"sendGetBody": false,
|
|
1819
|
+
"requestDatatype": "JSON",
|
|
1820
|
+
"responseDatatype": "JSON",
|
|
1821
|
+
"headers": {},
|
|
1822
|
+
"responseObjects": [
|
|
1823
|
+
{
|
|
1824
|
+
"type": "default",
|
|
1825
|
+
"key": "",
|
|
1826
|
+
"mockFile": ""
|
|
1827
|
+
}
|
|
1828
|
+
]
|
|
1808
1829
|
}
|
|
1809
1830
|
]
|
|
1810
1831
|
}
|
package/package.json
CHANGED
package/pronghorn.json
CHANGED
|
@@ -5087,6 +5087,50 @@
|
|
|
5087
5087
|
},
|
|
5088
5088
|
"task": true
|
|
5089
5089
|
},
|
|
5090
|
+
{
|
|
5091
|
+
"name": "postIpamSwip",
|
|
5092
|
+
"summary": "Create IPAM Swip",
|
|
5093
|
+
"description": "Creates a new IPAM swip.",
|
|
5094
|
+
"input": [
|
|
5095
|
+
{
|
|
5096
|
+
"name": "netblockId",
|
|
5097
|
+
"type": "string",
|
|
5098
|
+
"info": "",
|
|
5099
|
+
"required": true,
|
|
5100
|
+
"schema": {
|
|
5101
|
+
"title": "netblockId",
|
|
5102
|
+
"type": "string"
|
|
5103
|
+
}
|
|
5104
|
+
},
|
|
5105
|
+
{
|
|
5106
|
+
"name": "body",
|
|
5107
|
+
"type": "object",
|
|
5108
|
+
"info": "",
|
|
5109
|
+
"required": false,
|
|
5110
|
+
"schema": {
|
|
5111
|
+
"title": "body",
|
|
5112
|
+
"type": "object"
|
|
5113
|
+
}
|
|
5114
|
+
}
|
|
5115
|
+
],
|
|
5116
|
+
"output": {
|
|
5117
|
+
"name": "result",
|
|
5118
|
+
"type": "object",
|
|
5119
|
+
"description": "A JSON Object containing status, code and the result",
|
|
5120
|
+
"schema": {
|
|
5121
|
+
"title": "result",
|
|
5122
|
+
"type": "object"
|
|
5123
|
+
}
|
|
5124
|
+
},
|
|
5125
|
+
"roles": [
|
|
5126
|
+
"admin"
|
|
5127
|
+
],
|
|
5128
|
+
"route": {
|
|
5129
|
+
"verb": "POST",
|
|
5130
|
+
"path": "/postIpamSwip"
|
|
5131
|
+
},
|
|
5132
|
+
"task": true
|
|
5133
|
+
},
|
|
5090
5134
|
{
|
|
5091
5135
|
"name": "getWorkflows",
|
|
5092
5136
|
"summary": "Get workflows",
|
|
Binary file
|
package/report/adapterInfo.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"configLines":
|
|
2
|
+
"version": "0.7.0",
|
|
3
|
+
"configLines": 13480,
|
|
4
4
|
"scriptLines": 1707,
|
|
5
|
-
"codeLines":
|
|
6
|
-
"testLines":
|
|
7
|
-
"testCases":
|
|
8
|
-
"totalCodeLines":
|
|
9
|
-
"wfTasks":
|
|
5
|
+
"codeLines": 19007,
|
|
6
|
+
"testLines": 11198,
|
|
7
|
+
"testCases": 527,
|
|
8
|
+
"totalCodeLines": 31912,
|
|
9
|
+
"wfTasks": 236
|
|
10
10
|
}
|
|
@@ -4679,5 +4679,35 @@ describe('[integration] Six_connect Adapter Test', () => {
|
|
|
4679
4679
|
}
|
|
4680
4680
|
}).timeout(attemptTimeout);
|
|
4681
4681
|
});
|
|
4682
|
+
|
|
4683
|
+
const postIpamSwipBodyParam = {
|
|
4684
|
+
lir_id: '16',
|
|
4685
|
+
entity_handle: 'ZAYOB',
|
|
4686
|
+
net_handle: 'ZAYO-IPYX-123456'
|
|
4687
|
+
};
|
|
4688
|
+
describe('#postIpamSwip - errors', () => {
|
|
4689
|
+
it('should work if integrated but since no mockdata should error when run standalone', (done) => {
|
|
4690
|
+
try {
|
|
4691
|
+
a.postIpamSwip('fakedata', postIpamSwipBodyParam, (data, error) => {
|
|
4692
|
+
try {
|
|
4693
|
+
if (stub) {
|
|
4694
|
+
const displayE = 'Error 400 received on request';
|
|
4695
|
+
runErrorAsserts(data, error, 'AD.500', 'Test-six_connect-connectorRest-handleEndResponse', displayE);
|
|
4696
|
+
} else {
|
|
4697
|
+
runCommonAsserts(data, error);
|
|
4698
|
+
}
|
|
4699
|
+
saveMockData('ipam', 'postIpamSwip', 'default', data);
|
|
4700
|
+
done();
|
|
4701
|
+
} catch (err) {
|
|
4702
|
+
log.error(`Test Failure: ${err}`);
|
|
4703
|
+
done(err);
|
|
4704
|
+
}
|
|
4705
|
+
});
|
|
4706
|
+
} catch (error) {
|
|
4707
|
+
log.error(`Adapter Exception: ${error}`);
|
|
4708
|
+
done(error);
|
|
4709
|
+
}
|
|
4710
|
+
}).timeout(attemptTimeout);
|
|
4711
|
+
});
|
|
4682
4712
|
});
|
|
4683
4713
|
});
|
|
@@ -5320,5 +5320,34 @@ describe('[unit] Six_connect Adapter Test', () => {
|
|
|
5320
5320
|
}
|
|
5321
5321
|
}).timeout(attemptTimeout);
|
|
5322
5322
|
});
|
|
5323
|
+
|
|
5324
|
+
describe('#postIpamSwip - errors', () => {
|
|
5325
|
+
it('should have a postIpamSwip function', (done) => {
|
|
5326
|
+
try {
|
|
5327
|
+
assert.equal(true, typeof a.postIpamSwip === 'function');
|
|
5328
|
+
done();
|
|
5329
|
+
} catch (error) {
|
|
5330
|
+
log.error(`Test Failure: ${error}`);
|
|
5331
|
+
done(error);
|
|
5332
|
+
}
|
|
5333
|
+
}).timeout(attemptTimeout);
|
|
5334
|
+
it('should error if - missing netblockId', (done) => {
|
|
5335
|
+
try {
|
|
5336
|
+
a.postIpamSwip(null, null, (data, error) => {
|
|
5337
|
+
try {
|
|
5338
|
+
const displayE = 'netblockId is required';
|
|
5339
|
+
runErrorAsserts(data, error, 'AD.300', 'Test-six_connect-adapter-postIpamSwip', displayE);
|
|
5340
|
+
done();
|
|
5341
|
+
} catch (err) {
|
|
5342
|
+
log.error(`Test Failure: ${err}`);
|
|
5343
|
+
done(err);
|
|
5344
|
+
}
|
|
5345
|
+
});
|
|
5346
|
+
} catch (error) {
|
|
5347
|
+
log.error(`Adapter Exception: ${error}`);
|
|
5348
|
+
done(error);
|
|
5349
|
+
}
|
|
5350
|
+
}).timeout(attemptTimeout);
|
|
5351
|
+
});
|
|
5323
5352
|
});
|
|
5324
5353
|
});
|