@itentialopensource/adapter-dna_center 0.9.0 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CALLS.md +270 -0
- package/CHANGELOG.md +16 -0
- package/adapter.js +3751 -0
- package/entities/SDA/action.json +920 -0
- package/entities/SDA/schema.json +63 -0
- package/package.json +1 -1
- package/pronghorn.json +1797 -2
- package/refs?service=git-upload-pack +0 -0
- package/report/adapterInfo.json +7 -7
- package/test/integration/adapterTestIntegration.js +1639 -0
- package/test/unit/adapterTestUnit.js +1475 -0
package/adapter.js
CHANGED
|
@@ -13573,6 +13573,3757 @@ class DnaCenter extends AdapterBaseCl {
|
|
|
13573
13573
|
return callback(null, errorObj);
|
|
13574
13574
|
}
|
|
13575
13575
|
}
|
|
13576
|
+
|
|
13577
|
+
/**
|
|
13578
|
+
* @function deletePortAssignmentForAccessPointInSDAFabric
|
|
13579
|
+
* @pronghornType method
|
|
13580
|
+
* @name deletePortAssignmentForAccessPointInSDAFabric
|
|
13581
|
+
* @summary Delete Port assignment for access point in SDA Fabric
|
|
13582
|
+
*
|
|
13583
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
13584
|
+
* @param {string} interfaceName - interfaceName
|
|
13585
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
13586
|
+
* @return {object} results - An object containing the response of the action
|
|
13587
|
+
*
|
|
13588
|
+
* @route {POST} /deletePortAssignmentForAccessPointInSDAFabric
|
|
13589
|
+
* @roles admin
|
|
13590
|
+
* @task true
|
|
13591
|
+
*/
|
|
13592
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
13593
|
+
deletePortAssignmentForAccessPointInSDAFabric(deviceManagementIpAddress, interfaceName, callback) {
|
|
13594
|
+
const meth = 'adapter-deletePortAssignmentForAccessPointInSDAFabric';
|
|
13595
|
+
const origin = `${this.id}-${meth}`;
|
|
13596
|
+
log.trace(origin);
|
|
13597
|
+
|
|
13598
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
13599
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
13600
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13601
|
+
return callback(null, errorObj);
|
|
13602
|
+
}
|
|
13603
|
+
|
|
13604
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
13605
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
13606
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
13607
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13608
|
+
return callback(null, errorObj);
|
|
13609
|
+
}
|
|
13610
|
+
if (interfaceName === undefined || interfaceName === null || interfaceName === '') {
|
|
13611
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['interfaceName'], null, null, null);
|
|
13612
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13613
|
+
return callback(null, errorObj);
|
|
13614
|
+
}
|
|
13615
|
+
|
|
13616
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
13617
|
+
const queryParamsAvailable = { deviceManagementIpAddress, interfaceName };
|
|
13618
|
+
const queryParams = {};
|
|
13619
|
+
const pathVars = [];
|
|
13620
|
+
const bodyVars = {};
|
|
13621
|
+
|
|
13622
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
13623
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
13624
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
13625
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
13626
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
13627
|
+
}
|
|
13628
|
+
});
|
|
13629
|
+
|
|
13630
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
13631
|
+
// see adapter code documentation for more information on the request object's fields
|
|
13632
|
+
const reqObj = {
|
|
13633
|
+
payload: bodyVars,
|
|
13634
|
+
uriPathVars: pathVars,
|
|
13635
|
+
uriQuery: queryParams
|
|
13636
|
+
};
|
|
13637
|
+
|
|
13638
|
+
try {
|
|
13639
|
+
// Make the call -
|
|
13640
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
13641
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deletePortAssignmentForAccessPointInSDAFabric', reqObj, false, (irReturnData, irReturnError) => {
|
|
13642
|
+
// if we received an error or their is no response on the results
|
|
13643
|
+
// return an error
|
|
13644
|
+
if (irReturnError) {
|
|
13645
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
13646
|
+
return callback(null, irReturnError);
|
|
13647
|
+
}
|
|
13648
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
13649
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletePortAssignmentForAccessPointInSDAFabric'], null, null, null);
|
|
13650
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13651
|
+
return callback(null, errorObj);
|
|
13652
|
+
}
|
|
13653
|
+
|
|
13654
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
13655
|
+
// return the response
|
|
13656
|
+
return callback(irReturnData, null);
|
|
13657
|
+
});
|
|
13658
|
+
} catch (ex) {
|
|
13659
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
13660
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13661
|
+
return callback(null, errorObj);
|
|
13662
|
+
}
|
|
13663
|
+
}
|
|
13664
|
+
|
|
13665
|
+
/**
|
|
13666
|
+
* @function getPortAssignmentForAccessPointInSDAFabric
|
|
13667
|
+
* @pronghornType method
|
|
13668
|
+
* @name getPortAssignmentForAccessPointInSDAFabric
|
|
13669
|
+
* @summary Get Port assignment for access point in SDA Fabric
|
|
13670
|
+
*
|
|
13671
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
13672
|
+
* @param {string} interfaceName - interfaceName
|
|
13673
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
13674
|
+
* @return {object} results - An object containing the response of the action
|
|
13675
|
+
*
|
|
13676
|
+
* @route {POST} /getPortAssignmentForAccessPointInSDAFabric
|
|
13677
|
+
* @roles admin
|
|
13678
|
+
* @task true
|
|
13679
|
+
*/
|
|
13680
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
13681
|
+
getPortAssignmentForAccessPointInSDAFabric(deviceManagementIpAddress, interfaceName, callback) {
|
|
13682
|
+
const meth = 'adapter-getPortAssignmentForAccessPointInSDAFabric';
|
|
13683
|
+
const origin = `${this.id}-${meth}`;
|
|
13684
|
+
log.trace(origin);
|
|
13685
|
+
|
|
13686
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
13687
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
13688
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13689
|
+
return callback(null, errorObj);
|
|
13690
|
+
}
|
|
13691
|
+
|
|
13692
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
13693
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
13694
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
13695
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13696
|
+
return callback(null, errorObj);
|
|
13697
|
+
}
|
|
13698
|
+
if (interfaceName === undefined || interfaceName === null || interfaceName === '') {
|
|
13699
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['interfaceName'], null, null, null);
|
|
13700
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13701
|
+
return callback(null, errorObj);
|
|
13702
|
+
}
|
|
13703
|
+
|
|
13704
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
13705
|
+
const queryParamsAvailable = { deviceManagementIpAddress, interfaceName };
|
|
13706
|
+
const queryParams = {};
|
|
13707
|
+
const pathVars = [];
|
|
13708
|
+
const bodyVars = {};
|
|
13709
|
+
|
|
13710
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
13711
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
13712
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
13713
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
13714
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
13715
|
+
}
|
|
13716
|
+
});
|
|
13717
|
+
|
|
13718
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
13719
|
+
// see adapter code documentation for more information on the request object's fields
|
|
13720
|
+
const reqObj = {
|
|
13721
|
+
payload: bodyVars,
|
|
13722
|
+
uriPathVars: pathVars,
|
|
13723
|
+
uriQuery: queryParams
|
|
13724
|
+
};
|
|
13725
|
+
|
|
13726
|
+
try {
|
|
13727
|
+
// Make the call -
|
|
13728
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
13729
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getPortAssignmentForAccessPointInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
13730
|
+
// if we received an error or their is no response on the results
|
|
13731
|
+
// return an error
|
|
13732
|
+
if (irReturnError) {
|
|
13733
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
13734
|
+
return callback(null, irReturnError);
|
|
13735
|
+
}
|
|
13736
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
13737
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getPortAssignmentForAccessPointInSDAFabric'], null, null, null);
|
|
13738
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13739
|
+
return callback(null, errorObj);
|
|
13740
|
+
}
|
|
13741
|
+
|
|
13742
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
13743
|
+
// return the response
|
|
13744
|
+
return callback(irReturnData, null);
|
|
13745
|
+
});
|
|
13746
|
+
} catch (ex) {
|
|
13747
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
13748
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13749
|
+
return callback(null, errorObj);
|
|
13750
|
+
}
|
|
13751
|
+
}
|
|
13752
|
+
|
|
13753
|
+
/**
|
|
13754
|
+
* @function addPortAssignmentForAccessPointInSDAFabric
|
|
13755
|
+
* @pronghornType method
|
|
13756
|
+
* @name addPortAssignmentForAccessPointInSDAFabric
|
|
13757
|
+
* @summary Add Port assignment for access point in SDA Fabric
|
|
13758
|
+
*
|
|
13759
|
+
* @param {object} request - request
|
|
13760
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
13761
|
+
* @return {object} results - An object containing the response of the action
|
|
13762
|
+
*
|
|
13763
|
+
* @route {POST} /addPortAssignmentForAccessPointInSDAFabric
|
|
13764
|
+
* @roles admin
|
|
13765
|
+
* @task true
|
|
13766
|
+
*/
|
|
13767
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
13768
|
+
addPortAssignmentForAccessPointInSDAFabric(request, callback) {
|
|
13769
|
+
const meth = 'adapter-addPortAssignmentForAccessPointInSDAFabric';
|
|
13770
|
+
const origin = `${this.id}-${meth}`;
|
|
13771
|
+
log.trace(origin);
|
|
13772
|
+
|
|
13773
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
13774
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
13775
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13776
|
+
return callback(null, errorObj);
|
|
13777
|
+
}
|
|
13778
|
+
|
|
13779
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
13780
|
+
if (request === undefined || request === null || request === '') {
|
|
13781
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
13782
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13783
|
+
return callback(null, errorObj);
|
|
13784
|
+
}
|
|
13785
|
+
|
|
13786
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
13787
|
+
const queryParamsAvailable = {};
|
|
13788
|
+
const queryParams = {};
|
|
13789
|
+
const pathVars = [];
|
|
13790
|
+
const bodyVars = request;
|
|
13791
|
+
|
|
13792
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
13793
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
13794
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
13795
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
13796
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
13797
|
+
}
|
|
13798
|
+
});
|
|
13799
|
+
|
|
13800
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
13801
|
+
// see adapter code documentation for more information on the request object's fields
|
|
13802
|
+
const reqObj = {
|
|
13803
|
+
payload: bodyVars,
|
|
13804
|
+
uriPathVars: pathVars,
|
|
13805
|
+
uriQuery: queryParams
|
|
13806
|
+
};
|
|
13807
|
+
|
|
13808
|
+
try {
|
|
13809
|
+
// Make the call -
|
|
13810
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
13811
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addPortAssignmentForAccessPointInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
13812
|
+
// if we received an error or their is no response on the results
|
|
13813
|
+
// return an error
|
|
13814
|
+
if (irReturnError) {
|
|
13815
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
13816
|
+
return callback(null, irReturnError);
|
|
13817
|
+
}
|
|
13818
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
13819
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addPortAssignmentForAccessPointInSDAFabric'], null, null, null);
|
|
13820
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13821
|
+
return callback(null, errorObj);
|
|
13822
|
+
}
|
|
13823
|
+
|
|
13824
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
13825
|
+
// return the response
|
|
13826
|
+
return callback(irReturnData, null);
|
|
13827
|
+
});
|
|
13828
|
+
} catch (ex) {
|
|
13829
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
13830
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13831
|
+
return callback(null, errorObj);
|
|
13832
|
+
}
|
|
13833
|
+
}
|
|
13834
|
+
|
|
13835
|
+
/**
|
|
13836
|
+
* @function getDeviceInfoFromSDAFabric
|
|
13837
|
+
* @pronghornType method
|
|
13838
|
+
* @name getDeviceInfoFromSDAFabric
|
|
13839
|
+
* @summary Get device info from SDA Fabric
|
|
13840
|
+
*
|
|
13841
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
13842
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
13843
|
+
* @return {object} results - An object containing the response of the action
|
|
13844
|
+
*
|
|
13845
|
+
* @route {POST} /getDeviceInfoFromSDAFabric
|
|
13846
|
+
* @roles admin
|
|
13847
|
+
* @task true
|
|
13848
|
+
*/
|
|
13849
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
13850
|
+
getDeviceInfoFromSDAFabric(deviceManagementIpAddress, callback) {
|
|
13851
|
+
const meth = 'adapter-getDeviceInfoFromSDAFabric';
|
|
13852
|
+
const origin = `${this.id}-${meth}`;
|
|
13853
|
+
log.trace(origin);
|
|
13854
|
+
|
|
13855
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
13856
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
13857
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13858
|
+
return callback(null, errorObj);
|
|
13859
|
+
}
|
|
13860
|
+
|
|
13861
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
13862
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
13863
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
13864
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13865
|
+
return callback(null, errorObj);
|
|
13866
|
+
}
|
|
13867
|
+
|
|
13868
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
13869
|
+
const queryParamsAvailable = { deviceManagementIpAddress };
|
|
13870
|
+
const queryParams = {};
|
|
13871
|
+
const pathVars = [];
|
|
13872
|
+
const bodyVars = {};
|
|
13873
|
+
|
|
13874
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
13875
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
13876
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
13877
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
13878
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
13879
|
+
}
|
|
13880
|
+
});
|
|
13881
|
+
|
|
13882
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
13883
|
+
// see adapter code documentation for more information on the request object's fields
|
|
13884
|
+
const reqObj = {
|
|
13885
|
+
payload: bodyVars,
|
|
13886
|
+
uriPathVars: pathVars,
|
|
13887
|
+
uriQuery: queryParams
|
|
13888
|
+
};
|
|
13889
|
+
|
|
13890
|
+
try {
|
|
13891
|
+
// Make the call -
|
|
13892
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
13893
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getDeviceInfoFromSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
13894
|
+
// if we received an error or their is no response on the results
|
|
13895
|
+
// return an error
|
|
13896
|
+
if (irReturnError) {
|
|
13897
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
13898
|
+
return callback(null, irReturnError);
|
|
13899
|
+
}
|
|
13900
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
13901
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDeviceInfoFromSDAFabric'], null, null, null);
|
|
13902
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13903
|
+
return callback(null, errorObj);
|
|
13904
|
+
}
|
|
13905
|
+
|
|
13906
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
13907
|
+
// return the response
|
|
13908
|
+
return callback(irReturnData, null);
|
|
13909
|
+
});
|
|
13910
|
+
} catch (ex) {
|
|
13911
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
13912
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13913
|
+
return callback(null, errorObj);
|
|
13914
|
+
}
|
|
13915
|
+
}
|
|
13916
|
+
|
|
13917
|
+
/**
|
|
13918
|
+
* @function getTransitPeerNetworkInfo
|
|
13919
|
+
* @pronghornType method
|
|
13920
|
+
* @name getTransitPeerNetworkInfo
|
|
13921
|
+
* @summary Get Transit Peer Network Info
|
|
13922
|
+
*
|
|
13923
|
+
* @param {string} transitPeerNetworkName - Transit or Peer Network Name
|
|
13924
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
13925
|
+
* @return {object} results - An object containing the response of the action
|
|
13926
|
+
*
|
|
13927
|
+
* @route {POST} /getTransitPeerNetworkInfo
|
|
13928
|
+
* @roles admin
|
|
13929
|
+
* @task true
|
|
13930
|
+
*/
|
|
13931
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
13932
|
+
getTransitPeerNetworkInfo(transitPeerNetworkName, callback) {
|
|
13933
|
+
const meth = 'adapter-getTransitPeerNetworkInfo';
|
|
13934
|
+
const origin = `${this.id}-${meth}`;
|
|
13935
|
+
log.trace(origin);
|
|
13936
|
+
|
|
13937
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
13938
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
13939
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13940
|
+
return callback(null, errorObj);
|
|
13941
|
+
}
|
|
13942
|
+
|
|
13943
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
13944
|
+
if (transitPeerNetworkName === undefined || transitPeerNetworkName === null || transitPeerNetworkName === '') {
|
|
13945
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['transitPeerNetworkName'], null, null, null);
|
|
13946
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13947
|
+
return callback(null, errorObj);
|
|
13948
|
+
}
|
|
13949
|
+
|
|
13950
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
13951
|
+
const queryParamsAvailable = { transitPeerNetworkName };
|
|
13952
|
+
const queryParams = {};
|
|
13953
|
+
const pathVars = [];
|
|
13954
|
+
const bodyVars = {};
|
|
13955
|
+
|
|
13956
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
13957
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
13958
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
13959
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
13960
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
13961
|
+
}
|
|
13962
|
+
});
|
|
13963
|
+
|
|
13964
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
13965
|
+
// see adapter code documentation for more information on the request object's fields
|
|
13966
|
+
const reqObj = {
|
|
13967
|
+
payload: bodyVars,
|
|
13968
|
+
uriPathVars: pathVars,
|
|
13969
|
+
uriQuery: queryParams
|
|
13970
|
+
};
|
|
13971
|
+
|
|
13972
|
+
try {
|
|
13973
|
+
// Make the call -
|
|
13974
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
13975
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getTransitPeerNetworkInfo', reqObj, true, (irReturnData, irReturnError) => {
|
|
13976
|
+
// if we received an error or their is no response on the results
|
|
13977
|
+
// return an error
|
|
13978
|
+
if (irReturnError) {
|
|
13979
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
13980
|
+
return callback(null, irReturnError);
|
|
13981
|
+
}
|
|
13982
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
13983
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getTransitPeerNetworkInfo'], null, null, null);
|
|
13984
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13985
|
+
return callback(null, errorObj);
|
|
13986
|
+
}
|
|
13987
|
+
|
|
13988
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
13989
|
+
// return the response
|
|
13990
|
+
return callback(irReturnData, null);
|
|
13991
|
+
});
|
|
13992
|
+
} catch (ex) {
|
|
13993
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
13994
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
13995
|
+
return callback(null, errorObj);
|
|
13996
|
+
}
|
|
13997
|
+
}
|
|
13998
|
+
|
|
13999
|
+
/**
|
|
14000
|
+
* @function addTransitPeerNetwork
|
|
14001
|
+
* @pronghornType method
|
|
14002
|
+
* @name addTransitPeerNetwork
|
|
14003
|
+
* @summary Add Transit Peer Network
|
|
14004
|
+
*
|
|
14005
|
+
* @param {object} request - request
|
|
14006
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14007
|
+
* @return {object} results - An object containing the response of the action
|
|
14008
|
+
*
|
|
14009
|
+
* @route {POST} /addTransitPeerNetwork
|
|
14010
|
+
* @roles admin
|
|
14011
|
+
* @task true
|
|
14012
|
+
*/
|
|
14013
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14014
|
+
addTransitPeerNetwork(request, callback) {
|
|
14015
|
+
const meth = 'adapter-addTransitPeerNetwork';
|
|
14016
|
+
const origin = `${this.id}-${meth}`;
|
|
14017
|
+
log.trace(origin);
|
|
14018
|
+
|
|
14019
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14020
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14021
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14022
|
+
return callback(null, errorObj);
|
|
14023
|
+
}
|
|
14024
|
+
|
|
14025
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14026
|
+
if (request === undefined || request === null || request === '') {
|
|
14027
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
14028
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14029
|
+
return callback(null, errorObj);
|
|
14030
|
+
}
|
|
14031
|
+
|
|
14032
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14033
|
+
const queryParamsAvailable = {};
|
|
14034
|
+
const queryParams = {};
|
|
14035
|
+
const pathVars = [];
|
|
14036
|
+
const bodyVars = request;
|
|
14037
|
+
|
|
14038
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14039
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14040
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14041
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14042
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14043
|
+
}
|
|
14044
|
+
});
|
|
14045
|
+
|
|
14046
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14047
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14048
|
+
const reqObj = {
|
|
14049
|
+
payload: bodyVars,
|
|
14050
|
+
uriPathVars: pathVars,
|
|
14051
|
+
uriQuery: queryParams
|
|
14052
|
+
};
|
|
14053
|
+
|
|
14054
|
+
try {
|
|
14055
|
+
// Make the call -
|
|
14056
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14057
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addTransitPeerNetwork', reqObj, true, (irReturnData, irReturnError) => {
|
|
14058
|
+
// if we received an error or their is no response on the results
|
|
14059
|
+
// return an error
|
|
14060
|
+
if (irReturnError) {
|
|
14061
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14062
|
+
return callback(null, irReturnError);
|
|
14063
|
+
}
|
|
14064
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14065
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addTransitPeerNetwork'], null, null, null);
|
|
14066
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14067
|
+
return callback(null, errorObj);
|
|
14068
|
+
}
|
|
14069
|
+
|
|
14070
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14071
|
+
// return the response
|
|
14072
|
+
return callback(irReturnData, null);
|
|
14073
|
+
});
|
|
14074
|
+
} catch (ex) {
|
|
14075
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14076
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14077
|
+
return callback(null, errorObj);
|
|
14078
|
+
}
|
|
14079
|
+
}
|
|
14080
|
+
|
|
14081
|
+
/**
|
|
14082
|
+
* @function deleteTransitPeerNetwork
|
|
14083
|
+
* @pronghornType method
|
|
14084
|
+
* @name deleteTransitPeerNetwork
|
|
14085
|
+
* @summary Delete Transit Peer Network
|
|
14086
|
+
*
|
|
14087
|
+
* @param {string} transitPeerNetworkName - Transit Peer Network Name
|
|
14088
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14089
|
+
* @return {object} results - An object containing the response of the action
|
|
14090
|
+
*
|
|
14091
|
+
* @route {POST} /deleteTransitPeerNetwork
|
|
14092
|
+
* @roles admin
|
|
14093
|
+
* @task true
|
|
14094
|
+
*/
|
|
14095
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14096
|
+
deleteTransitPeerNetwork(transitPeerNetworkName, callback) {
|
|
14097
|
+
const meth = 'adapter-deleteTransitPeerNetwork';
|
|
14098
|
+
const origin = `${this.id}-${meth}`;
|
|
14099
|
+
log.trace(origin);
|
|
14100
|
+
|
|
14101
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14102
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14103
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14104
|
+
return callback(null, errorObj);
|
|
14105
|
+
}
|
|
14106
|
+
|
|
14107
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14108
|
+
if (transitPeerNetworkName === undefined || transitPeerNetworkName === null || transitPeerNetworkName === '') {
|
|
14109
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['transitPeerNetworkName'], null, null, null);
|
|
14110
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14111
|
+
return callback(null, errorObj);
|
|
14112
|
+
}
|
|
14113
|
+
|
|
14114
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14115
|
+
const queryParamsAvailable = { transitPeerNetworkName };
|
|
14116
|
+
const queryParams = {};
|
|
14117
|
+
const pathVars = [];
|
|
14118
|
+
const bodyVars = {};
|
|
14119
|
+
|
|
14120
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14121
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14122
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14123
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14124
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14125
|
+
}
|
|
14126
|
+
});
|
|
14127
|
+
|
|
14128
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14129
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14130
|
+
const reqObj = {
|
|
14131
|
+
payload: bodyVars,
|
|
14132
|
+
uriPathVars: pathVars,
|
|
14133
|
+
uriQuery: queryParams
|
|
14134
|
+
};
|
|
14135
|
+
|
|
14136
|
+
try {
|
|
14137
|
+
// Make the call -
|
|
14138
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14139
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteTransitPeerNetwork', reqObj, false, (irReturnData, irReturnError) => {
|
|
14140
|
+
// if we received an error or their is no response on the results
|
|
14141
|
+
// return an error
|
|
14142
|
+
if (irReturnError) {
|
|
14143
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14144
|
+
return callback(null, irReturnError);
|
|
14145
|
+
}
|
|
14146
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14147
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteTransitPeerNetwork'], null, null, null);
|
|
14148
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14149
|
+
return callback(null, errorObj);
|
|
14150
|
+
}
|
|
14151
|
+
|
|
14152
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14153
|
+
// return the response
|
|
14154
|
+
return callback(irReturnData, null);
|
|
14155
|
+
});
|
|
14156
|
+
} catch (ex) {
|
|
14157
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14158
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14159
|
+
return callback(null, errorObj);
|
|
14160
|
+
}
|
|
14161
|
+
}
|
|
14162
|
+
|
|
14163
|
+
/**
|
|
14164
|
+
* @function deleteEdgeDeviceFromSDAFabric
|
|
14165
|
+
* @pronghornType method
|
|
14166
|
+
* @name deleteEdgeDeviceFromSDAFabric
|
|
14167
|
+
* @summary Delete edge device from SDA Fabric
|
|
14168
|
+
*
|
|
14169
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
14170
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14171
|
+
* @return {object} results - An object containing the response of the action
|
|
14172
|
+
*
|
|
14173
|
+
* @route {POST} /deleteEdgeDeviceFromSDAFabric
|
|
14174
|
+
* @roles admin
|
|
14175
|
+
* @task true
|
|
14176
|
+
*/
|
|
14177
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14178
|
+
deleteEdgeDeviceFromSDAFabric(deviceManagementIpAddress, callback) {
|
|
14179
|
+
const meth = 'adapter-deleteEdgeDeviceFromSDAFabric';
|
|
14180
|
+
const origin = `${this.id}-${meth}`;
|
|
14181
|
+
log.trace(origin);
|
|
14182
|
+
|
|
14183
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14184
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14185
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14186
|
+
return callback(null, errorObj);
|
|
14187
|
+
}
|
|
14188
|
+
|
|
14189
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14190
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
14191
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
14192
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14193
|
+
return callback(null, errorObj);
|
|
14194
|
+
}
|
|
14195
|
+
|
|
14196
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14197
|
+
const queryParamsAvailable = { deviceManagementIpAddress };
|
|
14198
|
+
const queryParams = {};
|
|
14199
|
+
const pathVars = [];
|
|
14200
|
+
const bodyVars = {};
|
|
14201
|
+
|
|
14202
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14203
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14204
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14205
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14206
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14207
|
+
}
|
|
14208
|
+
});
|
|
14209
|
+
|
|
14210
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14211
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14212
|
+
const reqObj = {
|
|
14213
|
+
payload: bodyVars,
|
|
14214
|
+
uriPathVars: pathVars,
|
|
14215
|
+
uriQuery: queryParams
|
|
14216
|
+
};
|
|
14217
|
+
|
|
14218
|
+
try {
|
|
14219
|
+
// Make the call -
|
|
14220
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14221
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteEdgeDeviceFromSDAFabric', reqObj, false, (irReturnData, irReturnError) => {
|
|
14222
|
+
// if we received an error or their is no response on the results
|
|
14223
|
+
// return an error
|
|
14224
|
+
if (irReturnError) {
|
|
14225
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14226
|
+
return callback(null, irReturnError);
|
|
14227
|
+
}
|
|
14228
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14229
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteEdgeDeviceFromSDAFabric'], null, null, null);
|
|
14230
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14231
|
+
return callback(null, errorObj);
|
|
14232
|
+
}
|
|
14233
|
+
|
|
14234
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14235
|
+
// return the response
|
|
14236
|
+
return callback(irReturnData, null);
|
|
14237
|
+
});
|
|
14238
|
+
} catch (ex) {
|
|
14239
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14240
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14241
|
+
return callback(null, errorObj);
|
|
14242
|
+
}
|
|
14243
|
+
}
|
|
14244
|
+
|
|
14245
|
+
/**
|
|
14246
|
+
* @function getEdgeDeviceFromSDAFabric
|
|
14247
|
+
* @pronghornType method
|
|
14248
|
+
* @name getEdgeDeviceFromSDAFabric
|
|
14249
|
+
* @summary Get edge device from SDA Fabric
|
|
14250
|
+
*
|
|
14251
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
14252
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14253
|
+
* @return {object} results - An object containing the response of the action
|
|
14254
|
+
*
|
|
14255
|
+
* @route {POST} /getEdgeDeviceFromSDAFabric
|
|
14256
|
+
* @roles admin
|
|
14257
|
+
* @task true
|
|
14258
|
+
*/
|
|
14259
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14260
|
+
getEdgeDeviceFromSDAFabric(deviceManagementIpAddress, callback) {
|
|
14261
|
+
const meth = 'adapter-getEdgeDeviceFromSDAFabric';
|
|
14262
|
+
const origin = `${this.id}-${meth}`;
|
|
14263
|
+
log.trace(origin);
|
|
14264
|
+
|
|
14265
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14266
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14267
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14268
|
+
return callback(null, errorObj);
|
|
14269
|
+
}
|
|
14270
|
+
|
|
14271
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14272
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
14273
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
14274
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14275
|
+
return callback(null, errorObj);
|
|
14276
|
+
}
|
|
14277
|
+
|
|
14278
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14279
|
+
const queryParamsAvailable = { deviceManagementIpAddress };
|
|
14280
|
+
const queryParams = {};
|
|
14281
|
+
const pathVars = [];
|
|
14282
|
+
const bodyVars = {};
|
|
14283
|
+
|
|
14284
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14285
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14286
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14287
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14288
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14289
|
+
}
|
|
14290
|
+
});
|
|
14291
|
+
|
|
14292
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14293
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14294
|
+
const reqObj = {
|
|
14295
|
+
payload: bodyVars,
|
|
14296
|
+
uriPathVars: pathVars,
|
|
14297
|
+
uriQuery: queryParams
|
|
14298
|
+
};
|
|
14299
|
+
|
|
14300
|
+
try {
|
|
14301
|
+
// Make the call -
|
|
14302
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14303
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getEdgeDeviceFromSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
14304
|
+
// if we received an error or their is no response on the results
|
|
14305
|
+
// return an error
|
|
14306
|
+
if (irReturnError) {
|
|
14307
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14308
|
+
return callback(null, irReturnError);
|
|
14309
|
+
}
|
|
14310
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14311
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getEdgeDeviceFromSDAFabric'], null, null, null);
|
|
14312
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14313
|
+
return callback(null, errorObj);
|
|
14314
|
+
}
|
|
14315
|
+
|
|
14316
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14317
|
+
// return the response
|
|
14318
|
+
return callback(irReturnData, null);
|
|
14319
|
+
});
|
|
14320
|
+
} catch (ex) {
|
|
14321
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14322
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14323
|
+
return callback(null, errorObj);
|
|
14324
|
+
}
|
|
14325
|
+
}
|
|
14326
|
+
|
|
14327
|
+
/**
|
|
14328
|
+
* @function addEdgeDeviceInSDAFabric
|
|
14329
|
+
* @pronghornType method
|
|
14330
|
+
* @name addEdgeDeviceInSDAFabric
|
|
14331
|
+
* @summary Add edge device in SDA Fabric
|
|
14332
|
+
*
|
|
14333
|
+
* @param {object} request - request
|
|
14334
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14335
|
+
* @return {object} results - An object containing the response of the action
|
|
14336
|
+
*
|
|
14337
|
+
* @route {POST} /addEdgeDeviceInSDAFabric
|
|
14338
|
+
* @roles admin
|
|
14339
|
+
* @task true
|
|
14340
|
+
*/
|
|
14341
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14342
|
+
addEdgeDeviceInSDAFabric(request, callback) {
|
|
14343
|
+
const meth = 'adapter-addEdgeDeviceInSDAFabric';
|
|
14344
|
+
const origin = `${this.id}-${meth}`;
|
|
14345
|
+
log.trace(origin);
|
|
14346
|
+
|
|
14347
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14348
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14349
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14350
|
+
return callback(null, errorObj);
|
|
14351
|
+
}
|
|
14352
|
+
|
|
14353
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14354
|
+
if (request === undefined || request === null || request === '') {
|
|
14355
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
14356
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14357
|
+
return callback(null, errorObj);
|
|
14358
|
+
}
|
|
14359
|
+
|
|
14360
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14361
|
+
const queryParamsAvailable = {};
|
|
14362
|
+
const queryParams = {};
|
|
14363
|
+
const pathVars = [];
|
|
14364
|
+
const bodyVars = request;
|
|
14365
|
+
|
|
14366
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14367
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14368
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14369
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14370
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14371
|
+
}
|
|
14372
|
+
});
|
|
14373
|
+
|
|
14374
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14375
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14376
|
+
const reqObj = {
|
|
14377
|
+
payload: bodyVars,
|
|
14378
|
+
uriPathVars: pathVars,
|
|
14379
|
+
uriQuery: queryParams
|
|
14380
|
+
};
|
|
14381
|
+
|
|
14382
|
+
try {
|
|
14383
|
+
// Make the call -
|
|
14384
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14385
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addEdgeDeviceInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
14386
|
+
// if we received an error or their is no response on the results
|
|
14387
|
+
// return an error
|
|
14388
|
+
if (irReturnError) {
|
|
14389
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14390
|
+
return callback(null, irReturnError);
|
|
14391
|
+
}
|
|
14392
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14393
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addEdgeDeviceInSDAFabric'], null, null, null);
|
|
14394
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14395
|
+
return callback(null, errorObj);
|
|
14396
|
+
}
|
|
14397
|
+
|
|
14398
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14399
|
+
// return the response
|
|
14400
|
+
return callback(irReturnData, null);
|
|
14401
|
+
});
|
|
14402
|
+
} catch (ex) {
|
|
14403
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14404
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14405
|
+
return callback(null, errorObj);
|
|
14406
|
+
}
|
|
14407
|
+
}
|
|
14408
|
+
|
|
14409
|
+
/**
|
|
14410
|
+
* @function addIPPoolInSDAVirtualNetwork
|
|
14411
|
+
* @pronghornType method
|
|
14412
|
+
* @name addIPPoolInSDAVirtualNetwork
|
|
14413
|
+
* @summary Add IP Pool in SDA Virtual Network
|
|
14414
|
+
*
|
|
14415
|
+
* @param {object} request - request
|
|
14416
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14417
|
+
* @return {object} results - An object containing the response of the action
|
|
14418
|
+
*
|
|
14419
|
+
* @route {POST} /addIPPoolInSDAVirtualNetwork
|
|
14420
|
+
* @roles admin
|
|
14421
|
+
* @task true
|
|
14422
|
+
*/
|
|
14423
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14424
|
+
addIPPoolInSDAVirtualNetwork(request, callback) {
|
|
14425
|
+
const meth = 'adapter-addIPPoolInSDAVirtualNetwork';
|
|
14426
|
+
const origin = `${this.id}-${meth}`;
|
|
14427
|
+
log.trace(origin);
|
|
14428
|
+
|
|
14429
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14430
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14431
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14432
|
+
return callback(null, errorObj);
|
|
14433
|
+
}
|
|
14434
|
+
|
|
14435
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14436
|
+
if (request === undefined || request === null || request === '') {
|
|
14437
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
14438
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14439
|
+
return callback(null, errorObj);
|
|
14440
|
+
}
|
|
14441
|
+
|
|
14442
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14443
|
+
const queryParamsAvailable = {};
|
|
14444
|
+
const queryParams = {};
|
|
14445
|
+
const pathVars = [];
|
|
14446
|
+
const bodyVars = request;
|
|
14447
|
+
|
|
14448
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14449
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14450
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14451
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14452
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14453
|
+
}
|
|
14454
|
+
});
|
|
14455
|
+
|
|
14456
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14457
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14458
|
+
const reqObj = {
|
|
14459
|
+
payload: bodyVars,
|
|
14460
|
+
uriPathVars: pathVars,
|
|
14461
|
+
uriQuery: queryParams
|
|
14462
|
+
};
|
|
14463
|
+
|
|
14464
|
+
try {
|
|
14465
|
+
// Make the call -
|
|
14466
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14467
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addIPPoolInSDAVirtualNetwork', reqObj, true, (irReturnData, irReturnError) => {
|
|
14468
|
+
// if we received an error or their is no response on the results
|
|
14469
|
+
// return an error
|
|
14470
|
+
if (irReturnError) {
|
|
14471
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14472
|
+
return callback(null, irReturnError);
|
|
14473
|
+
}
|
|
14474
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14475
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addIPPoolInSDAVirtualNetwork'], null, null, null);
|
|
14476
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14477
|
+
return callback(null, errorObj);
|
|
14478
|
+
}
|
|
14479
|
+
|
|
14480
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14481
|
+
// return the response
|
|
14482
|
+
return callback(irReturnData, null);
|
|
14483
|
+
});
|
|
14484
|
+
} catch (ex) {
|
|
14485
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14486
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14487
|
+
return callback(null, errorObj);
|
|
14488
|
+
}
|
|
14489
|
+
}
|
|
14490
|
+
|
|
14491
|
+
/**
|
|
14492
|
+
* @function deleteIPPoolFromSDAVirtualNetwork
|
|
14493
|
+
* @pronghornType method
|
|
14494
|
+
* @name deleteIPPoolFromSDAVirtualNetwork
|
|
14495
|
+
* @summary Delete IP Pool from SDA Virtual Network
|
|
14496
|
+
*
|
|
14497
|
+
* @param {string} siteNameHierarchy - siteNameHierarchy
|
|
14498
|
+
* @param {string} virtualNetworkName - virtualNetworkName
|
|
14499
|
+
* @param {string} ipPoolName - ipPoolName
|
|
14500
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14501
|
+
* @return {object} results - An object containing the response of the action
|
|
14502
|
+
*
|
|
14503
|
+
* @route {POST} /deleteIPPoolFromSDAVirtualNetwork
|
|
14504
|
+
* @roles admin
|
|
14505
|
+
* @task true
|
|
14506
|
+
*/
|
|
14507
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14508
|
+
deleteIPPoolFromSDAVirtualNetwork(siteNameHierarchy, virtualNetworkName, ipPoolName, callback) {
|
|
14509
|
+
const meth = 'adapter-deleteIPPoolFromSDAVirtualNetwork';
|
|
14510
|
+
const origin = `${this.id}-${meth}`;
|
|
14511
|
+
log.trace(origin);
|
|
14512
|
+
|
|
14513
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14514
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14515
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14516
|
+
return callback(null, errorObj);
|
|
14517
|
+
}
|
|
14518
|
+
|
|
14519
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14520
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
14521
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
14522
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14523
|
+
return callback(null, errorObj);
|
|
14524
|
+
}
|
|
14525
|
+
if (virtualNetworkName === undefined || virtualNetworkName === null || virtualNetworkName === '') {
|
|
14526
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['virtualNetworkName'], null, null, null);
|
|
14527
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14528
|
+
return callback(null, errorObj);
|
|
14529
|
+
}
|
|
14530
|
+
if (ipPoolName === undefined || ipPoolName === null || ipPoolName === '') {
|
|
14531
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['ipPoolName'], null, null, null);
|
|
14532
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14533
|
+
return callback(null, errorObj);
|
|
14534
|
+
}
|
|
14535
|
+
|
|
14536
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14537
|
+
const queryParamsAvailable = { siteNameHierarchy, virtualNetworkName, ipPoolName };
|
|
14538
|
+
const queryParams = {};
|
|
14539
|
+
const pathVars = [];
|
|
14540
|
+
const bodyVars = {};
|
|
14541
|
+
|
|
14542
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14543
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14544
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14545
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14546
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14547
|
+
}
|
|
14548
|
+
});
|
|
14549
|
+
|
|
14550
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14551
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14552
|
+
const reqObj = {
|
|
14553
|
+
payload: bodyVars,
|
|
14554
|
+
uriPathVars: pathVars,
|
|
14555
|
+
uriQuery: queryParams
|
|
14556
|
+
};
|
|
14557
|
+
|
|
14558
|
+
try {
|
|
14559
|
+
// Make the call -
|
|
14560
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14561
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteIPPoolFromSDAVirtualNetwork', reqObj, false, (irReturnData, irReturnError) => {
|
|
14562
|
+
// if we received an error or their is no response on the results
|
|
14563
|
+
// return an error
|
|
14564
|
+
if (irReturnError) {
|
|
14565
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14566
|
+
return callback(null, irReturnError);
|
|
14567
|
+
}
|
|
14568
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14569
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteIPPoolFromSDAVirtualNetwork'], null, null, null);
|
|
14570
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14571
|
+
return callback(null, errorObj);
|
|
14572
|
+
}
|
|
14573
|
+
|
|
14574
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14575
|
+
// return the response
|
|
14576
|
+
return callback(irReturnData, null);
|
|
14577
|
+
});
|
|
14578
|
+
} catch (ex) {
|
|
14579
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14580
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14581
|
+
return callback(null, errorObj);
|
|
14582
|
+
}
|
|
14583
|
+
}
|
|
14584
|
+
|
|
14585
|
+
/**
|
|
14586
|
+
* @function getIPPoolFromSDAVirtualNetwork
|
|
14587
|
+
* @pronghornType method
|
|
14588
|
+
* @name getIPPoolFromSDAVirtualNetwork
|
|
14589
|
+
* @summary Get IP Pool from SDA Virtual Network
|
|
14590
|
+
*
|
|
14591
|
+
* @param {string} siteNameHierarchy - siteNameHierarchy
|
|
14592
|
+
* @param {string} virtualNetworkName - virtualNetworkName
|
|
14593
|
+
* @param {string} ipPoolName - ipPoolName. Note: Use vlanName as a value for this parameter if same ip pool is assigned to multiple virtual networks (e.g.. ipPoolName=vlan1021)
|
|
14594
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14595
|
+
* @return {object} results - An object containing the response of the action
|
|
14596
|
+
*
|
|
14597
|
+
* @route {POST} /getIPPoolFromSDAVirtualNetwork
|
|
14598
|
+
* @roles admin
|
|
14599
|
+
* @task true
|
|
14600
|
+
*/
|
|
14601
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14602
|
+
getIPPoolFromSDAVirtualNetwork(siteNameHierarchy, virtualNetworkName, ipPoolName, callback) {
|
|
14603
|
+
const meth = 'adapter-getIPPoolFromSDAVirtualNetwork';
|
|
14604
|
+
const origin = `${this.id}-${meth}`;
|
|
14605
|
+
log.trace(origin);
|
|
14606
|
+
|
|
14607
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14608
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14609
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14610
|
+
return callback(null, errorObj);
|
|
14611
|
+
}
|
|
14612
|
+
|
|
14613
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14614
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
14615
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
14616
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14617
|
+
return callback(null, errorObj);
|
|
14618
|
+
}
|
|
14619
|
+
if (virtualNetworkName === undefined || virtualNetworkName === null || virtualNetworkName === '') {
|
|
14620
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['virtualNetworkName'], null, null, null);
|
|
14621
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14622
|
+
return callback(null, errorObj);
|
|
14623
|
+
}
|
|
14624
|
+
if (ipPoolName === undefined || ipPoolName === null || ipPoolName === '') {
|
|
14625
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['ipPoolName'], null, null, null);
|
|
14626
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14627
|
+
return callback(null, errorObj);
|
|
14628
|
+
}
|
|
14629
|
+
|
|
14630
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14631
|
+
const queryParamsAvailable = { siteNameHierarchy, virtualNetworkName, ipPoolName };
|
|
14632
|
+
const queryParams = {};
|
|
14633
|
+
const pathVars = [];
|
|
14634
|
+
const bodyVars = {};
|
|
14635
|
+
|
|
14636
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14637
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14638
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14639
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14640
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14641
|
+
}
|
|
14642
|
+
});
|
|
14643
|
+
|
|
14644
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14645
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14646
|
+
const reqObj = {
|
|
14647
|
+
payload: bodyVars,
|
|
14648
|
+
uriPathVars: pathVars,
|
|
14649
|
+
uriQuery: queryParams
|
|
14650
|
+
};
|
|
14651
|
+
|
|
14652
|
+
try {
|
|
14653
|
+
// Make the call -
|
|
14654
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14655
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getIPPoolFromSDAVirtualNetwork', reqObj, true, (irReturnData, irReturnError) => {
|
|
14656
|
+
// if we received an error or their is no response on the results
|
|
14657
|
+
// return an error
|
|
14658
|
+
if (irReturnError) {
|
|
14659
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14660
|
+
return callback(null, irReturnError);
|
|
14661
|
+
}
|
|
14662
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14663
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getIPPoolFromSDAVirtualNetwork'], null, null, null);
|
|
14664
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14665
|
+
return callback(null, errorObj);
|
|
14666
|
+
}
|
|
14667
|
+
|
|
14668
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14669
|
+
// return the response
|
|
14670
|
+
return callback(irReturnData, null);
|
|
14671
|
+
});
|
|
14672
|
+
} catch (ex) {
|
|
14673
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14674
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14675
|
+
return callback(null, errorObj);
|
|
14676
|
+
}
|
|
14677
|
+
}
|
|
14678
|
+
|
|
14679
|
+
/**
|
|
14680
|
+
* @function deleteMulticastFromSDAFabric
|
|
14681
|
+
* @pronghornType method
|
|
14682
|
+
* @name deleteMulticastFromSDAFabric
|
|
14683
|
+
* @summary Delete multicast from SDA fabric
|
|
14684
|
+
*
|
|
14685
|
+
* @param {string} siteNameHierarchy - siteNameHierarchy
|
|
14686
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14687
|
+
* @return {object} results - An object containing the response of the action
|
|
14688
|
+
*
|
|
14689
|
+
* @route {POST} /deleteMulticastFromSDAFabric
|
|
14690
|
+
* @roles admin
|
|
14691
|
+
* @task true
|
|
14692
|
+
*/
|
|
14693
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14694
|
+
deleteMulticastFromSDAFabric(siteNameHierarchy, callback) {
|
|
14695
|
+
const meth = 'adapter-deleteMulticastFromSDAFabric';
|
|
14696
|
+
const origin = `${this.id}-${meth}`;
|
|
14697
|
+
log.trace(origin);
|
|
14698
|
+
|
|
14699
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14700
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14701
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14702
|
+
return callback(null, errorObj);
|
|
14703
|
+
}
|
|
14704
|
+
|
|
14705
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14706
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
14707
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
14708
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14709
|
+
return callback(null, errorObj);
|
|
14710
|
+
}
|
|
14711
|
+
|
|
14712
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14713
|
+
const queryParamsAvailable = { siteNameHierarchy };
|
|
14714
|
+
const queryParams = {};
|
|
14715
|
+
const pathVars = [];
|
|
14716
|
+
const bodyVars = {};
|
|
14717
|
+
|
|
14718
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14719
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14720
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14721
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14722
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14723
|
+
}
|
|
14724
|
+
});
|
|
14725
|
+
|
|
14726
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14727
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14728
|
+
const reqObj = {
|
|
14729
|
+
payload: bodyVars,
|
|
14730
|
+
uriPathVars: pathVars,
|
|
14731
|
+
uriQuery: queryParams
|
|
14732
|
+
};
|
|
14733
|
+
|
|
14734
|
+
try {
|
|
14735
|
+
// Make the call -
|
|
14736
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14737
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteMulticastFromSDAFabric', reqObj, false, (irReturnData, irReturnError) => {
|
|
14738
|
+
// if we received an error or their is no response on the results
|
|
14739
|
+
// return an error
|
|
14740
|
+
if (irReturnError) {
|
|
14741
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14742
|
+
return callback(null, irReturnError);
|
|
14743
|
+
}
|
|
14744
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14745
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteMulticastFromSDAFabric'], null, null, null);
|
|
14746
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14747
|
+
return callback(null, errorObj);
|
|
14748
|
+
}
|
|
14749
|
+
|
|
14750
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14751
|
+
// return the response
|
|
14752
|
+
return callback(irReturnData, null);
|
|
14753
|
+
});
|
|
14754
|
+
} catch (ex) {
|
|
14755
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14756
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14757
|
+
return callback(null, errorObj);
|
|
14758
|
+
}
|
|
14759
|
+
}
|
|
14760
|
+
|
|
14761
|
+
/**
|
|
14762
|
+
* @function getMulticastDetailsFromSDAFabric
|
|
14763
|
+
* @pronghornType method
|
|
14764
|
+
* @name getMulticastDetailsFromSDAFabric
|
|
14765
|
+
* @summary Get multicast details from SDA fabric
|
|
14766
|
+
*
|
|
14767
|
+
* @param {string} siteNameHierarchy - fabric site name hierarchy
|
|
14768
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14769
|
+
* @return {object} results - An object containing the response of the action
|
|
14770
|
+
*
|
|
14771
|
+
* @route {POST} /getMulticastDetailsFromSDAFabric
|
|
14772
|
+
* @roles admin
|
|
14773
|
+
* @task true
|
|
14774
|
+
*/
|
|
14775
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14776
|
+
getMulticastDetailsFromSDAFabric(siteNameHierarchy, callback) {
|
|
14777
|
+
const meth = 'adapter-getMulticastDetailsFromSDAFabric';
|
|
14778
|
+
const origin = `${this.id}-${meth}`;
|
|
14779
|
+
log.trace(origin);
|
|
14780
|
+
|
|
14781
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14782
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14783
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14784
|
+
return callback(null, errorObj);
|
|
14785
|
+
}
|
|
14786
|
+
|
|
14787
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14788
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
14789
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
14790
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14791
|
+
return callback(null, errorObj);
|
|
14792
|
+
}
|
|
14793
|
+
|
|
14794
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14795
|
+
const queryParamsAvailable = { siteNameHierarchy };
|
|
14796
|
+
const queryParams = {};
|
|
14797
|
+
const pathVars = [];
|
|
14798
|
+
const bodyVars = {};
|
|
14799
|
+
|
|
14800
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14801
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14802
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14803
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14804
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14805
|
+
}
|
|
14806
|
+
});
|
|
14807
|
+
|
|
14808
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14809
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14810
|
+
const reqObj = {
|
|
14811
|
+
payload: bodyVars,
|
|
14812
|
+
uriPathVars: pathVars,
|
|
14813
|
+
uriQuery: queryParams
|
|
14814
|
+
};
|
|
14815
|
+
|
|
14816
|
+
try {
|
|
14817
|
+
// Make the call -
|
|
14818
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14819
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getMulticastDetailsFromSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
14820
|
+
// if we received an error or their is no response on the results
|
|
14821
|
+
// return an error
|
|
14822
|
+
if (irReturnError) {
|
|
14823
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14824
|
+
return callback(null, irReturnError);
|
|
14825
|
+
}
|
|
14826
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14827
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getMulticastDetailsFromSDAFabric'], null, null, null);
|
|
14828
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14829
|
+
return callback(null, errorObj);
|
|
14830
|
+
}
|
|
14831
|
+
|
|
14832
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14833
|
+
// return the response
|
|
14834
|
+
return callback(irReturnData, null);
|
|
14835
|
+
});
|
|
14836
|
+
} catch (ex) {
|
|
14837
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14838
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14839
|
+
return callback(null, errorObj);
|
|
14840
|
+
}
|
|
14841
|
+
}
|
|
14842
|
+
|
|
14843
|
+
/**
|
|
14844
|
+
* @function addMulticastInSDAFabric
|
|
14845
|
+
* @pronghornType method
|
|
14846
|
+
* @name addMulticastInSDAFabric
|
|
14847
|
+
* @summary Add multicast in SDA fabric
|
|
14848
|
+
*
|
|
14849
|
+
* @param {object} request - request
|
|
14850
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14851
|
+
* @return {object} results - An object containing the response of the action
|
|
14852
|
+
*
|
|
14853
|
+
* @route {POST} /addMulticastInSDAFabric
|
|
14854
|
+
* @roles admin
|
|
14855
|
+
* @task true
|
|
14856
|
+
*/
|
|
14857
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14858
|
+
addMulticastInSDAFabric(request, callback) {
|
|
14859
|
+
const meth = 'adapter-addMulticastInSDAFabric';
|
|
14860
|
+
const origin = `${this.id}-${meth}`;
|
|
14861
|
+
log.trace(origin);
|
|
14862
|
+
|
|
14863
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14864
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14865
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14866
|
+
return callback(null, errorObj);
|
|
14867
|
+
}
|
|
14868
|
+
|
|
14869
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14870
|
+
if (request === undefined || request === null || request === '') {
|
|
14871
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
14872
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14873
|
+
return callback(null, errorObj);
|
|
14874
|
+
}
|
|
14875
|
+
|
|
14876
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14877
|
+
const queryParamsAvailable = {};
|
|
14878
|
+
const queryParams = {};
|
|
14879
|
+
const pathVars = [];
|
|
14880
|
+
const bodyVars = request;
|
|
14881
|
+
|
|
14882
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14883
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14884
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14885
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14886
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14887
|
+
}
|
|
14888
|
+
});
|
|
14889
|
+
|
|
14890
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14891
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14892
|
+
const reqObj = {
|
|
14893
|
+
payload: bodyVars,
|
|
14894
|
+
uriPathVars: pathVars,
|
|
14895
|
+
uriQuery: queryParams
|
|
14896
|
+
};
|
|
14897
|
+
|
|
14898
|
+
try {
|
|
14899
|
+
// Make the call -
|
|
14900
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14901
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addMulticastInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
14902
|
+
// if we received an error or their is no response on the results
|
|
14903
|
+
// return an error
|
|
14904
|
+
if (irReturnError) {
|
|
14905
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14906
|
+
return callback(null, irReturnError);
|
|
14907
|
+
}
|
|
14908
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14909
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addMulticastInSDAFabric'], null, null, null);
|
|
14910
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14911
|
+
return callback(null, errorObj);
|
|
14912
|
+
}
|
|
14913
|
+
|
|
14914
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
14915
|
+
// return the response
|
|
14916
|
+
return callback(irReturnData, null);
|
|
14917
|
+
});
|
|
14918
|
+
} catch (ex) {
|
|
14919
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
14920
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14921
|
+
return callback(null, errorObj);
|
|
14922
|
+
}
|
|
14923
|
+
}
|
|
14924
|
+
|
|
14925
|
+
/**
|
|
14926
|
+
* @function getVirtualNetworkFromSDAFabric
|
|
14927
|
+
* @pronghornType method
|
|
14928
|
+
* @name getVirtualNetworkFromSDAFabric
|
|
14929
|
+
* @summary Get VN from SDA Fabric
|
|
14930
|
+
*
|
|
14931
|
+
* @param {string} virtualNetworkName - virtualNetworkName
|
|
14932
|
+
* @param {string} siteNameHierarchy - siteNameHierarchy
|
|
14933
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
14934
|
+
* @return {object} results - An object containing the response of the action
|
|
14935
|
+
*
|
|
14936
|
+
* @route {POST} /getVirtualNetworkFromSDAFabric
|
|
14937
|
+
* @roles admin
|
|
14938
|
+
* @task true
|
|
14939
|
+
*/
|
|
14940
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
14941
|
+
getVirtualNetworkFromSDAFabric(virtualNetworkName, siteNameHierarchy, callback) {
|
|
14942
|
+
const meth = 'adapter-getVirtualNetworkFromSDAFabric';
|
|
14943
|
+
const origin = `${this.id}-${meth}`;
|
|
14944
|
+
log.trace(origin);
|
|
14945
|
+
|
|
14946
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
14947
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
14948
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14949
|
+
return callback(null, errorObj);
|
|
14950
|
+
}
|
|
14951
|
+
|
|
14952
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
14953
|
+
if (virtualNetworkName === undefined || virtualNetworkName === null || virtualNetworkName === '') {
|
|
14954
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['virtualNetworkName'], null, null, null);
|
|
14955
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14956
|
+
return callback(null, errorObj);
|
|
14957
|
+
}
|
|
14958
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
14959
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
14960
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14961
|
+
return callback(null, errorObj);
|
|
14962
|
+
}
|
|
14963
|
+
|
|
14964
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
14965
|
+
const queryParamsAvailable = { virtualNetworkName, siteNameHierarchy };
|
|
14966
|
+
const queryParams = {};
|
|
14967
|
+
const pathVars = [];
|
|
14968
|
+
const bodyVars = {};
|
|
14969
|
+
|
|
14970
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
14971
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
14972
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
14973
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
14974
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
14975
|
+
}
|
|
14976
|
+
});
|
|
14977
|
+
|
|
14978
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
14979
|
+
// see adapter code documentation for more information on the request object's fields
|
|
14980
|
+
const reqObj = {
|
|
14981
|
+
payload: bodyVars,
|
|
14982
|
+
uriPathVars: pathVars,
|
|
14983
|
+
uriQuery: queryParams
|
|
14984
|
+
};
|
|
14985
|
+
|
|
14986
|
+
try {
|
|
14987
|
+
// Make the call -
|
|
14988
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
14989
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getVirtualNetworkFromSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
14990
|
+
// if we received an error or their is no response on the results
|
|
14991
|
+
// return an error
|
|
14992
|
+
if (irReturnError) {
|
|
14993
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
14994
|
+
return callback(null, irReturnError);
|
|
14995
|
+
}
|
|
14996
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
14997
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getVirtualNetworkFromSDAFabric'], null, null, null);
|
|
14998
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
14999
|
+
return callback(null, errorObj);
|
|
15000
|
+
}
|
|
15001
|
+
|
|
15002
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15003
|
+
// return the response
|
|
15004
|
+
return callback(irReturnData, null);
|
|
15005
|
+
});
|
|
15006
|
+
} catch (ex) {
|
|
15007
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15008
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15009
|
+
return callback(null, errorObj);
|
|
15010
|
+
}
|
|
15011
|
+
}
|
|
15012
|
+
|
|
15013
|
+
/**
|
|
15014
|
+
* @function addVNInFabric
|
|
15015
|
+
* @pronghornType method
|
|
15016
|
+
* @name addVNInFabric
|
|
15017
|
+
* @summary Add VN in fabric
|
|
15018
|
+
*
|
|
15019
|
+
* @param {object} request - request
|
|
15020
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15021
|
+
* @return {object} results - An object containing the response of the action
|
|
15022
|
+
*
|
|
15023
|
+
* @route {POST} /addVNInFabric
|
|
15024
|
+
* @roles admin
|
|
15025
|
+
* @task true
|
|
15026
|
+
*/
|
|
15027
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15028
|
+
addVNInFabric(request, callback) {
|
|
15029
|
+
const meth = 'adapter-addVNInFabric';
|
|
15030
|
+
const origin = `${this.id}-${meth}`;
|
|
15031
|
+
log.trace(origin);
|
|
15032
|
+
|
|
15033
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15034
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15035
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15036
|
+
return callback(null, errorObj);
|
|
15037
|
+
}
|
|
15038
|
+
|
|
15039
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15040
|
+
if (request === undefined || request === null || request === '') {
|
|
15041
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
15042
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15043
|
+
return callback(null, errorObj);
|
|
15044
|
+
}
|
|
15045
|
+
|
|
15046
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15047
|
+
const queryParamsAvailable = {};
|
|
15048
|
+
const queryParams = {};
|
|
15049
|
+
const pathVars = [];
|
|
15050
|
+
const bodyVars = request;
|
|
15051
|
+
|
|
15052
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15053
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15054
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15055
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15056
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15057
|
+
}
|
|
15058
|
+
});
|
|
15059
|
+
|
|
15060
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15061
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15062
|
+
const reqObj = {
|
|
15063
|
+
payload: bodyVars,
|
|
15064
|
+
uriPathVars: pathVars,
|
|
15065
|
+
uriQuery: queryParams
|
|
15066
|
+
};
|
|
15067
|
+
|
|
15068
|
+
try {
|
|
15069
|
+
// Make the call -
|
|
15070
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15071
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addVNInFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
15072
|
+
// if we received an error or their is no response on the results
|
|
15073
|
+
// return an error
|
|
15074
|
+
if (irReturnError) {
|
|
15075
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15076
|
+
return callback(null, irReturnError);
|
|
15077
|
+
}
|
|
15078
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15079
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addVNInFabric'], null, null, null);
|
|
15080
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15081
|
+
return callback(null, errorObj);
|
|
15082
|
+
}
|
|
15083
|
+
|
|
15084
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15085
|
+
// return the response
|
|
15086
|
+
return callback(irReturnData, null);
|
|
15087
|
+
});
|
|
15088
|
+
} catch (ex) {
|
|
15089
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15090
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15091
|
+
return callback(null, errorObj);
|
|
15092
|
+
}
|
|
15093
|
+
}
|
|
15094
|
+
|
|
15095
|
+
/**
|
|
15096
|
+
* @function deleteVNFromSDAFabric
|
|
15097
|
+
* @pronghornType method
|
|
15098
|
+
* @name deleteVNFromSDAFabric
|
|
15099
|
+
* @summary Delete VN from SDA Fabric
|
|
15100
|
+
*
|
|
15101
|
+
* @param {string} virtualNetworkName - virtualNetworkName
|
|
15102
|
+
* @param {string} siteNameHierarchy - siteNameHierarchy
|
|
15103
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15104
|
+
* @return {object} results - An object containing the response of the action
|
|
15105
|
+
*
|
|
15106
|
+
* @route {POST} /deleteVNFromSDAFabric
|
|
15107
|
+
* @roles admin
|
|
15108
|
+
* @task true
|
|
15109
|
+
*/
|
|
15110
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15111
|
+
deleteVNFromSDAFabric(virtualNetworkName, siteNameHierarchy, callback) {
|
|
15112
|
+
const meth = 'adapter-deleteVNFromSDAFabric';
|
|
15113
|
+
const origin = `${this.id}-${meth}`;
|
|
15114
|
+
log.trace(origin);
|
|
15115
|
+
|
|
15116
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15117
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15118
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15119
|
+
return callback(null, errorObj);
|
|
15120
|
+
}
|
|
15121
|
+
|
|
15122
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15123
|
+
if (virtualNetworkName === undefined || virtualNetworkName === null || virtualNetworkName === '') {
|
|
15124
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['virtualNetworkName'], null, null, null);
|
|
15125
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15126
|
+
return callback(null, errorObj);
|
|
15127
|
+
}
|
|
15128
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
15129
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
15130
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15131
|
+
return callback(null, errorObj);
|
|
15132
|
+
}
|
|
15133
|
+
|
|
15134
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15135
|
+
const queryParamsAvailable = { virtualNetworkName, siteNameHierarchy };
|
|
15136
|
+
const queryParams = {};
|
|
15137
|
+
const pathVars = [];
|
|
15138
|
+
const bodyVars = {};
|
|
15139
|
+
|
|
15140
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15141
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15142
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15143
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15144
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15145
|
+
}
|
|
15146
|
+
});
|
|
15147
|
+
|
|
15148
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15149
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15150
|
+
const reqObj = {
|
|
15151
|
+
payload: bodyVars,
|
|
15152
|
+
uriPathVars: pathVars,
|
|
15153
|
+
uriQuery: queryParams
|
|
15154
|
+
};
|
|
15155
|
+
|
|
15156
|
+
try {
|
|
15157
|
+
// Make the call -
|
|
15158
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15159
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteVNFromSDAFabric', reqObj, false, (irReturnData, irReturnError) => {
|
|
15160
|
+
// if we received an error or their is no response on the results
|
|
15161
|
+
// return an error
|
|
15162
|
+
if (irReturnError) {
|
|
15163
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15164
|
+
return callback(null, irReturnError);
|
|
15165
|
+
}
|
|
15166
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15167
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteVNFromSDAFabric'], null, null, null);
|
|
15168
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15169
|
+
return callback(null, errorObj);
|
|
15170
|
+
}
|
|
15171
|
+
|
|
15172
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15173
|
+
// return the response
|
|
15174
|
+
return callback(irReturnData, null);
|
|
15175
|
+
});
|
|
15176
|
+
} catch (ex) {
|
|
15177
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15178
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15179
|
+
return callback(null, errorObj);
|
|
15180
|
+
}
|
|
15181
|
+
}
|
|
15182
|
+
|
|
15183
|
+
/**
|
|
15184
|
+
* @function deleteDefaultAuthenticationProfileFromSDAFabric
|
|
15185
|
+
* @pronghornType method
|
|
15186
|
+
* @name deleteDefaultAuthenticationProfileFromSDAFabric
|
|
15187
|
+
* @summary Delete default authentication profile from SDA Fabric
|
|
15188
|
+
*
|
|
15189
|
+
* @param {string} siteNameHierarchy - siteNameHierarchy
|
|
15190
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15191
|
+
* @return {object} results - An object containing the response of the action
|
|
15192
|
+
*
|
|
15193
|
+
* @route {POST} /deleteDefaultAuthenticationProfileFromSDAFabric
|
|
15194
|
+
* @roles admin
|
|
15195
|
+
* @task true
|
|
15196
|
+
*/
|
|
15197
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15198
|
+
deleteDefaultAuthenticationProfileFromSDAFabric(siteNameHierarchy, callback) {
|
|
15199
|
+
const meth = 'adapter-deleteDefaultAuthenticationProfileFromSDAFabric';
|
|
15200
|
+
const origin = `${this.id}-${meth}`;
|
|
15201
|
+
log.trace(origin);
|
|
15202
|
+
|
|
15203
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15204
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15205
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15206
|
+
return callback(null, errorObj);
|
|
15207
|
+
}
|
|
15208
|
+
|
|
15209
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15210
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
15211
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
15212
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15213
|
+
return callback(null, errorObj);
|
|
15214
|
+
}
|
|
15215
|
+
|
|
15216
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15217
|
+
const queryParamsAvailable = { siteNameHierarchy };
|
|
15218
|
+
const queryParams = {};
|
|
15219
|
+
const pathVars = [];
|
|
15220
|
+
const bodyVars = {};
|
|
15221
|
+
|
|
15222
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15223
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15224
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15225
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15226
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15227
|
+
}
|
|
15228
|
+
});
|
|
15229
|
+
|
|
15230
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15231
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15232
|
+
const reqObj = {
|
|
15233
|
+
payload: bodyVars,
|
|
15234
|
+
uriPathVars: pathVars,
|
|
15235
|
+
uriQuery: queryParams
|
|
15236
|
+
};
|
|
15237
|
+
|
|
15238
|
+
try {
|
|
15239
|
+
// Make the call -
|
|
15240
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15241
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteDefaultAuthenticationProfileFromSDAFabric', reqObj, false, (irReturnData, irReturnError) => {
|
|
15242
|
+
// if we received an error or their is no response on the results
|
|
15243
|
+
// return an error
|
|
15244
|
+
if (irReturnError) {
|
|
15245
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15246
|
+
return callback(null, irReturnError);
|
|
15247
|
+
}
|
|
15248
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15249
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteDefaultAuthenticationProfileFromSDAFabric'], null, null, null);
|
|
15250
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15251
|
+
return callback(null, errorObj);
|
|
15252
|
+
}
|
|
15253
|
+
|
|
15254
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15255
|
+
// return the response
|
|
15256
|
+
return callback(irReturnData, null);
|
|
15257
|
+
});
|
|
15258
|
+
} catch (ex) {
|
|
15259
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15260
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15261
|
+
return callback(null, errorObj);
|
|
15262
|
+
}
|
|
15263
|
+
}
|
|
15264
|
+
|
|
15265
|
+
/**
|
|
15266
|
+
* @function updateDefaultAuthenticationProfileInSDAFabric
|
|
15267
|
+
* @pronghornType method
|
|
15268
|
+
* @name updateDefaultAuthenticationProfileInSDAFabric
|
|
15269
|
+
* @summary Update default authentication profile in SDA Fabric
|
|
15270
|
+
*
|
|
15271
|
+
* @param {array} request - request
|
|
15272
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15273
|
+
* @return {object} results - An object containing the response of the action
|
|
15274
|
+
*
|
|
15275
|
+
* @route {POST} /updateDefaultAuthenticationProfileInSDAFabric
|
|
15276
|
+
* @roles admin
|
|
15277
|
+
* @task true
|
|
15278
|
+
*/
|
|
15279
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15280
|
+
updateDefaultAuthenticationProfileInSDAFabric(request, callback) {
|
|
15281
|
+
const meth = 'adapter-updateDefaultAuthenticationProfileInSDAFabric';
|
|
15282
|
+
const origin = `${this.id}-${meth}`;
|
|
15283
|
+
log.trace(origin);
|
|
15284
|
+
|
|
15285
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15286
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15287
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15288
|
+
return callback(null, errorObj);
|
|
15289
|
+
}
|
|
15290
|
+
|
|
15291
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15292
|
+
if (request === undefined || request === null || request === '') {
|
|
15293
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
15294
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15295
|
+
return callback(null, errorObj);
|
|
15296
|
+
}
|
|
15297
|
+
|
|
15298
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15299
|
+
const queryParamsAvailable = {};
|
|
15300
|
+
const queryParams = {};
|
|
15301
|
+
const pathVars = [];
|
|
15302
|
+
const bodyVars = request;
|
|
15303
|
+
|
|
15304
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15305
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15306
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15307
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15308
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15309
|
+
}
|
|
15310
|
+
});
|
|
15311
|
+
|
|
15312
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15313
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15314
|
+
const reqObj = {
|
|
15315
|
+
payload: bodyVars,
|
|
15316
|
+
uriPathVars: pathVars,
|
|
15317
|
+
uriQuery: queryParams
|
|
15318
|
+
};
|
|
15319
|
+
|
|
15320
|
+
try {
|
|
15321
|
+
// Make the call -
|
|
15322
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15323
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'updateDefaultAuthenticationProfileInSDAFabric', reqObj, false, (irReturnData, irReturnError) => {
|
|
15324
|
+
// if we received an error or their is no response on the results
|
|
15325
|
+
// return an error
|
|
15326
|
+
if (irReturnError) {
|
|
15327
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15328
|
+
return callback(null, irReturnError);
|
|
15329
|
+
}
|
|
15330
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15331
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateDefaultAuthenticationProfileInSDAFabric'], null, null, null);
|
|
15332
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15333
|
+
return callback(null, errorObj);
|
|
15334
|
+
}
|
|
15335
|
+
|
|
15336
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15337
|
+
// return the response
|
|
15338
|
+
return callback(irReturnData, null);
|
|
15339
|
+
});
|
|
15340
|
+
} catch (ex) {
|
|
15341
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15342
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15343
|
+
return callback(null, errorObj);
|
|
15344
|
+
}
|
|
15345
|
+
}
|
|
15346
|
+
|
|
15347
|
+
/**
|
|
15348
|
+
* @function getDefaultAuthenticationProfileFromSDAFabric
|
|
15349
|
+
* @pronghornType method
|
|
15350
|
+
* @name getDefaultAuthenticationProfileFromSDAFabric
|
|
15351
|
+
* @summary Get default authentication profile from SDA Fabric
|
|
15352
|
+
*
|
|
15353
|
+
* @param {string} siteNameHierarchy - siteNameHierarchy
|
|
15354
|
+
* @param {string} [authenticateTemplateName] - authenticateTemplateName
|
|
15355
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15356
|
+
* @return {object} results - An object containing the response of the action
|
|
15357
|
+
*
|
|
15358
|
+
* @route {POST} /getDefaultAuthenticationProfileFromSDAFabric
|
|
15359
|
+
* @roles admin
|
|
15360
|
+
* @task true
|
|
15361
|
+
*/
|
|
15362
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15363
|
+
getDefaultAuthenticationProfileFromSDAFabric(siteNameHierarchy, authenticateTemplateName, callback) {
|
|
15364
|
+
const meth = 'adapter-getDefaultAuthenticationProfileFromSDAFabric';
|
|
15365
|
+
const origin = `${this.id}-${meth}`;
|
|
15366
|
+
log.trace(origin);
|
|
15367
|
+
|
|
15368
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15369
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15370
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15371
|
+
return callback(null, errorObj);
|
|
15372
|
+
}
|
|
15373
|
+
|
|
15374
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15375
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
15376
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
15377
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15378
|
+
return callback(null, errorObj);
|
|
15379
|
+
}
|
|
15380
|
+
|
|
15381
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15382
|
+
const queryParamsAvailable = { siteNameHierarchy, authenticateTemplateName };
|
|
15383
|
+
const queryParams = {};
|
|
15384
|
+
const pathVars = [];
|
|
15385
|
+
const bodyVars = {};
|
|
15386
|
+
|
|
15387
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15388
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15389
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15390
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15391
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15392
|
+
}
|
|
15393
|
+
});
|
|
15394
|
+
|
|
15395
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15396
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15397
|
+
const reqObj = {
|
|
15398
|
+
payload: bodyVars,
|
|
15399
|
+
uriPathVars: pathVars,
|
|
15400
|
+
uriQuery: queryParams
|
|
15401
|
+
};
|
|
15402
|
+
|
|
15403
|
+
try {
|
|
15404
|
+
// Make the call -
|
|
15405
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15406
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getDefaultAuthenticationProfileFromSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
15407
|
+
// if we received an error or their is no response on the results
|
|
15408
|
+
// return an error
|
|
15409
|
+
if (irReturnError) {
|
|
15410
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15411
|
+
return callback(null, irReturnError);
|
|
15412
|
+
}
|
|
15413
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15414
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDefaultAuthenticationProfileFromSDAFabric'], null, null, null);
|
|
15415
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15416
|
+
return callback(null, errorObj);
|
|
15417
|
+
}
|
|
15418
|
+
|
|
15419
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15420
|
+
// return the response
|
|
15421
|
+
return callback(irReturnData, null);
|
|
15422
|
+
});
|
|
15423
|
+
} catch (ex) {
|
|
15424
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15425
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15426
|
+
return callback(null, errorObj);
|
|
15427
|
+
}
|
|
15428
|
+
}
|
|
15429
|
+
|
|
15430
|
+
/**
|
|
15431
|
+
* @function addDefaultAuthenticationTemplateInSDAFabric
|
|
15432
|
+
* @pronghornType method
|
|
15433
|
+
* @name addDefaultAuthenticationTemplateInSDAFabric
|
|
15434
|
+
* @summary Add default authentication template in SDA Fabric
|
|
15435
|
+
*
|
|
15436
|
+
* @param {array} request - request
|
|
15437
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15438
|
+
* @return {object} results - An object containing the response of the action
|
|
15439
|
+
*
|
|
15440
|
+
* @route {POST} /addDefaultAuthenticationTemplateInSDAFabric
|
|
15441
|
+
* @roles admin
|
|
15442
|
+
* @task true
|
|
15443
|
+
*/
|
|
15444
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15445
|
+
addDefaultAuthenticationTemplateInSDAFabric(request, callback) {
|
|
15446
|
+
const meth = 'adapter-addDefaultAuthenticationTemplateInSDAFabric';
|
|
15447
|
+
const origin = `${this.id}-${meth}`;
|
|
15448
|
+
log.trace(origin);
|
|
15449
|
+
|
|
15450
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15451
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15452
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15453
|
+
return callback(null, errorObj);
|
|
15454
|
+
}
|
|
15455
|
+
|
|
15456
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15457
|
+
if (request === undefined || request === null || request === '') {
|
|
15458
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
15459
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15460
|
+
return callback(null, errorObj);
|
|
15461
|
+
}
|
|
15462
|
+
|
|
15463
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15464
|
+
const queryParamsAvailable = {};
|
|
15465
|
+
const queryParams = {};
|
|
15466
|
+
const pathVars = [];
|
|
15467
|
+
const bodyVars = request;
|
|
15468
|
+
|
|
15469
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15470
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15471
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15472
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15473
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15474
|
+
}
|
|
15475
|
+
});
|
|
15476
|
+
|
|
15477
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15478
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15479
|
+
const reqObj = {
|
|
15480
|
+
payload: bodyVars,
|
|
15481
|
+
uriPathVars: pathVars,
|
|
15482
|
+
uriQuery: queryParams
|
|
15483
|
+
};
|
|
15484
|
+
|
|
15485
|
+
try {
|
|
15486
|
+
// Make the call -
|
|
15487
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15488
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addDefaultAuthenticationTemplateInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
15489
|
+
// if we received an error or their is no response on the results
|
|
15490
|
+
// return an error
|
|
15491
|
+
if (irReturnError) {
|
|
15492
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15493
|
+
return callback(null, irReturnError);
|
|
15494
|
+
}
|
|
15495
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15496
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addDefaultAuthenticationTemplateInSDAFabric'], null, null, null);
|
|
15497
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15498
|
+
return callback(null, errorObj);
|
|
15499
|
+
}
|
|
15500
|
+
|
|
15501
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15502
|
+
// return the response
|
|
15503
|
+
return callback(irReturnData, null);
|
|
15504
|
+
});
|
|
15505
|
+
} catch (ex) {
|
|
15506
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15507
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15508
|
+
return callback(null, errorObj);
|
|
15509
|
+
}
|
|
15510
|
+
}
|
|
15511
|
+
|
|
15512
|
+
/**
|
|
15513
|
+
* @function deleteSiteFromSDAFabric
|
|
15514
|
+
* @pronghornType method
|
|
15515
|
+
* @name deleteSiteFromSDAFabric
|
|
15516
|
+
* @summary Delete Site from SDA Fabric
|
|
15517
|
+
*
|
|
15518
|
+
* @param {string} siteNameHierarchy - Site Name Hierarchy
|
|
15519
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15520
|
+
* @return {object} results - An object containing the response of the action
|
|
15521
|
+
*
|
|
15522
|
+
* @route {POST} /deleteSiteFromSDAFabric
|
|
15523
|
+
* @roles admin
|
|
15524
|
+
* @task true
|
|
15525
|
+
*/
|
|
15526
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15527
|
+
deleteSiteFromSDAFabric(siteNameHierarchy, callback) {
|
|
15528
|
+
const meth = 'adapter-deleteSiteFromSDAFabric';
|
|
15529
|
+
const origin = `${this.id}-${meth}`;
|
|
15530
|
+
log.trace(origin);
|
|
15531
|
+
|
|
15532
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15533
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15534
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15535
|
+
return callback(null, errorObj);
|
|
15536
|
+
}
|
|
15537
|
+
|
|
15538
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15539
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
15540
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
15541
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15542
|
+
return callback(null, errorObj);
|
|
15543
|
+
}
|
|
15544
|
+
|
|
15545
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15546
|
+
const queryParamsAvailable = { siteNameHierarchy };
|
|
15547
|
+
const queryParams = {};
|
|
15548
|
+
const pathVars = [];
|
|
15549
|
+
const bodyVars = {};
|
|
15550
|
+
|
|
15551
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15552
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15553
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15554
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15555
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15556
|
+
}
|
|
15557
|
+
});
|
|
15558
|
+
|
|
15559
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15560
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15561
|
+
const reqObj = {
|
|
15562
|
+
payload: bodyVars,
|
|
15563
|
+
uriPathVars: pathVars,
|
|
15564
|
+
uriQuery: queryParams
|
|
15565
|
+
};
|
|
15566
|
+
|
|
15567
|
+
try {
|
|
15568
|
+
// Make the call -
|
|
15569
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15570
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteSiteFromSDAFabric', reqObj, false, (irReturnData, irReturnError) => {
|
|
15571
|
+
// if we received an error or their is no response on the results
|
|
15572
|
+
// return an error
|
|
15573
|
+
if (irReturnError) {
|
|
15574
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15575
|
+
return callback(null, irReturnError);
|
|
15576
|
+
}
|
|
15577
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15578
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteSiteFromSDAFabric'], null, null, null);
|
|
15579
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15580
|
+
return callback(null, errorObj);
|
|
15581
|
+
}
|
|
15582
|
+
|
|
15583
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15584
|
+
// return the response
|
|
15585
|
+
return callback(irReturnData, null);
|
|
15586
|
+
});
|
|
15587
|
+
} catch (ex) {
|
|
15588
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15589
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15590
|
+
return callback(null, errorObj);
|
|
15591
|
+
}
|
|
15592
|
+
}
|
|
15593
|
+
|
|
15594
|
+
/**
|
|
15595
|
+
* @function getSiteFromSDAFabric
|
|
15596
|
+
* @pronghornType method
|
|
15597
|
+
* @name getSiteFromSDAFabric
|
|
15598
|
+
* @summary Get Site from SDA Fabric
|
|
15599
|
+
*
|
|
15600
|
+
* @param {string} siteNameHierarchy - Site Name Hierarchy
|
|
15601
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15602
|
+
* @return {object} results - An object containing the response of the action
|
|
15603
|
+
*
|
|
15604
|
+
* @route {POST} /getSiteFromSDAFabric
|
|
15605
|
+
* @roles admin
|
|
15606
|
+
* @task true
|
|
15607
|
+
*/
|
|
15608
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15609
|
+
getSiteFromSDAFabric(siteNameHierarchy, callback) {
|
|
15610
|
+
const meth = 'adapter-getSiteFromSDAFabric';
|
|
15611
|
+
const origin = `${this.id}-${meth}`;
|
|
15612
|
+
log.trace(origin);
|
|
15613
|
+
|
|
15614
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15615
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15616
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15617
|
+
return callback(null, errorObj);
|
|
15618
|
+
}
|
|
15619
|
+
|
|
15620
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15621
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
15622
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
15623
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15624
|
+
return callback(null, errorObj);
|
|
15625
|
+
}
|
|
15626
|
+
|
|
15627
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15628
|
+
const queryParamsAvailable = { siteNameHierarchy };
|
|
15629
|
+
const queryParams = {};
|
|
15630
|
+
const pathVars = [];
|
|
15631
|
+
const bodyVars = {};
|
|
15632
|
+
|
|
15633
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15634
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15635
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15636
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15637
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15638
|
+
}
|
|
15639
|
+
});
|
|
15640
|
+
|
|
15641
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15642
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15643
|
+
const reqObj = {
|
|
15644
|
+
payload: bodyVars,
|
|
15645
|
+
uriPathVars: pathVars,
|
|
15646
|
+
uriQuery: queryParams
|
|
15647
|
+
};
|
|
15648
|
+
|
|
15649
|
+
try {
|
|
15650
|
+
// Make the call -
|
|
15651
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15652
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getSiteFromSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
15653
|
+
// if we received an error or their is no response on the results
|
|
15654
|
+
// return an error
|
|
15655
|
+
if (irReturnError) {
|
|
15656
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15657
|
+
return callback(null, irReturnError);
|
|
15658
|
+
}
|
|
15659
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15660
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getSiteFromSDAFabric'], null, null, null);
|
|
15661
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15662
|
+
return callback(null, errorObj);
|
|
15663
|
+
}
|
|
15664
|
+
|
|
15665
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15666
|
+
// return the response
|
|
15667
|
+
return callback(irReturnData, null);
|
|
15668
|
+
});
|
|
15669
|
+
} catch (ex) {
|
|
15670
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15671
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15672
|
+
return callback(null, errorObj);
|
|
15673
|
+
}
|
|
15674
|
+
}
|
|
15675
|
+
|
|
15676
|
+
/**
|
|
15677
|
+
* @function addSiteInSDAFabric
|
|
15678
|
+
* @pronghornType method
|
|
15679
|
+
* @name addSiteInSDAFabric
|
|
15680
|
+
* @summary Add Site in SDA Fabric
|
|
15681
|
+
*
|
|
15682
|
+
* @param {object} request - request
|
|
15683
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15684
|
+
* @return {object} results - An object containing the response of the action
|
|
15685
|
+
*
|
|
15686
|
+
* @route {POST} /addSiteInSDAFabric
|
|
15687
|
+
* @roles admin
|
|
15688
|
+
* @task true
|
|
15689
|
+
*/
|
|
15690
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15691
|
+
addSiteInSDAFabric(request, callback) {
|
|
15692
|
+
const meth = 'adapter-addSiteInSDAFabric';
|
|
15693
|
+
const origin = `${this.id}-${meth}`;
|
|
15694
|
+
log.trace(origin);
|
|
15695
|
+
|
|
15696
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15697
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15698
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15699
|
+
return callback(null, errorObj);
|
|
15700
|
+
}
|
|
15701
|
+
|
|
15702
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15703
|
+
if (request === undefined || request === null || request === '') {
|
|
15704
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
15705
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15706
|
+
return callback(null, errorObj);
|
|
15707
|
+
}
|
|
15708
|
+
|
|
15709
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15710
|
+
const queryParamsAvailable = {};
|
|
15711
|
+
const queryParams = {};
|
|
15712
|
+
const pathVars = [];
|
|
15713
|
+
const bodyVars = request;
|
|
15714
|
+
|
|
15715
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15716
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15717
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15718
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15719
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15720
|
+
}
|
|
15721
|
+
});
|
|
15722
|
+
|
|
15723
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15724
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15725
|
+
const reqObj = {
|
|
15726
|
+
payload: bodyVars,
|
|
15727
|
+
uriPathVars: pathVars,
|
|
15728
|
+
uriQuery: queryParams
|
|
15729
|
+
};
|
|
15730
|
+
|
|
15731
|
+
try {
|
|
15732
|
+
// Make the call -
|
|
15733
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15734
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addSiteInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
15735
|
+
// if we received an error or their is no response on the results
|
|
15736
|
+
// return an error
|
|
15737
|
+
if (irReturnError) {
|
|
15738
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15739
|
+
return callback(null, irReturnError);
|
|
15740
|
+
}
|
|
15741
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15742
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addSiteInSDAFabric'], null, null, null);
|
|
15743
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15744
|
+
return callback(null, errorObj);
|
|
15745
|
+
}
|
|
15746
|
+
|
|
15747
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15748
|
+
// return the response
|
|
15749
|
+
return callback(irReturnData, null);
|
|
15750
|
+
});
|
|
15751
|
+
} catch (ex) {
|
|
15752
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15753
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15754
|
+
return callback(null, errorObj);
|
|
15755
|
+
}
|
|
15756
|
+
}
|
|
15757
|
+
|
|
15758
|
+
/**
|
|
15759
|
+
* @function reProvisionWiredDevice
|
|
15760
|
+
* @pronghornType method
|
|
15761
|
+
* @name reProvisionWiredDevice
|
|
15762
|
+
* @summary Re-Provision Wired Device
|
|
15763
|
+
*
|
|
15764
|
+
* @param {object} request - request
|
|
15765
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15766
|
+
* @return {object} results - An object containing the response of the action
|
|
15767
|
+
*
|
|
15768
|
+
* @route {POST} /reProvisionWiredDevice
|
|
15769
|
+
* @roles admin
|
|
15770
|
+
* @task true
|
|
15771
|
+
*/
|
|
15772
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15773
|
+
reProvisionWiredDevice(request, callback) {
|
|
15774
|
+
const meth = 'adapter-reProvisionWiredDevice';
|
|
15775
|
+
const origin = `${this.id}-${meth}`;
|
|
15776
|
+
log.trace(origin);
|
|
15777
|
+
|
|
15778
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15779
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15780
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15781
|
+
return callback(null, errorObj);
|
|
15782
|
+
}
|
|
15783
|
+
|
|
15784
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15785
|
+
if (request === undefined || request === null || request === '') {
|
|
15786
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
15787
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15788
|
+
return callback(null, errorObj);
|
|
15789
|
+
}
|
|
15790
|
+
|
|
15791
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15792
|
+
const queryParamsAvailable = {};
|
|
15793
|
+
const queryParams = {};
|
|
15794
|
+
const pathVars = [];
|
|
15795
|
+
const bodyVars = request;
|
|
15796
|
+
|
|
15797
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15798
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15799
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15800
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15801
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15802
|
+
}
|
|
15803
|
+
});
|
|
15804
|
+
|
|
15805
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15806
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15807
|
+
const reqObj = {
|
|
15808
|
+
payload: bodyVars,
|
|
15809
|
+
uriPathVars: pathVars,
|
|
15810
|
+
uriQuery: queryParams
|
|
15811
|
+
};
|
|
15812
|
+
|
|
15813
|
+
try {
|
|
15814
|
+
// Make the call -
|
|
15815
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15816
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'reProvisionWiredDevice', reqObj, false, (irReturnData, irReturnError) => {
|
|
15817
|
+
// if we received an error or their is no response on the results
|
|
15818
|
+
// return an error
|
|
15819
|
+
if (irReturnError) {
|
|
15820
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15821
|
+
return callback(null, irReturnError);
|
|
15822
|
+
}
|
|
15823
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15824
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['reProvisionWiredDevice'], null, null, null);
|
|
15825
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15826
|
+
return callback(null, errorObj);
|
|
15827
|
+
}
|
|
15828
|
+
|
|
15829
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15830
|
+
// return the response
|
|
15831
|
+
return callback(irReturnData, null);
|
|
15832
|
+
});
|
|
15833
|
+
} catch (ex) {
|
|
15834
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15835
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15836
|
+
return callback(null, errorObj);
|
|
15837
|
+
}
|
|
15838
|
+
}
|
|
15839
|
+
|
|
15840
|
+
/**
|
|
15841
|
+
* @function provisionWiredDevice
|
|
15842
|
+
* @pronghornType method
|
|
15843
|
+
* @name provisionWiredDevice
|
|
15844
|
+
* @summary Provision Wired Device
|
|
15845
|
+
*
|
|
15846
|
+
* @param {object} request - request
|
|
15847
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15848
|
+
* @return {object} results - An object containing the response of the action
|
|
15849
|
+
*
|
|
15850
|
+
* @route {POST} /provisionWiredDevice
|
|
15851
|
+
* @roles admin
|
|
15852
|
+
* @task true
|
|
15853
|
+
*/
|
|
15854
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15855
|
+
provisionWiredDevice(request, callback) {
|
|
15856
|
+
const meth = 'adapter-provisionWiredDevice';
|
|
15857
|
+
const origin = `${this.id}-${meth}`;
|
|
15858
|
+
log.trace(origin);
|
|
15859
|
+
|
|
15860
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15861
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15862
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15863
|
+
return callback(null, errorObj);
|
|
15864
|
+
}
|
|
15865
|
+
|
|
15866
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15867
|
+
if (request === undefined || request === null || request === '') {
|
|
15868
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
15869
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15870
|
+
return callback(null, errorObj);
|
|
15871
|
+
}
|
|
15872
|
+
|
|
15873
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15874
|
+
const queryParamsAvailable = {};
|
|
15875
|
+
const queryParams = {};
|
|
15876
|
+
const pathVars = [];
|
|
15877
|
+
const bodyVars = request;
|
|
15878
|
+
|
|
15879
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15880
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15881
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15882
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15883
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15884
|
+
}
|
|
15885
|
+
});
|
|
15886
|
+
|
|
15887
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15888
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15889
|
+
const reqObj = {
|
|
15890
|
+
payload: bodyVars,
|
|
15891
|
+
uriPathVars: pathVars,
|
|
15892
|
+
uriQuery: queryParams
|
|
15893
|
+
};
|
|
15894
|
+
|
|
15895
|
+
try {
|
|
15896
|
+
// Make the call -
|
|
15897
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15898
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'provisionWiredDevice', reqObj, true, (irReturnData, irReturnError) => {
|
|
15899
|
+
// if we received an error or their is no response on the results
|
|
15900
|
+
// return an error
|
|
15901
|
+
if (irReturnError) {
|
|
15902
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15903
|
+
return callback(null, irReturnError);
|
|
15904
|
+
}
|
|
15905
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15906
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['provisionWiredDevice'], null, null, null);
|
|
15907
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15908
|
+
return callback(null, errorObj);
|
|
15909
|
+
}
|
|
15910
|
+
|
|
15911
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15912
|
+
// return the response
|
|
15913
|
+
return callback(irReturnData, null);
|
|
15914
|
+
});
|
|
15915
|
+
} catch (ex) {
|
|
15916
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15917
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15918
|
+
return callback(null, errorObj);
|
|
15919
|
+
}
|
|
15920
|
+
}
|
|
15921
|
+
|
|
15922
|
+
/**
|
|
15923
|
+
* @function getProvisionedWiredDevice
|
|
15924
|
+
* @pronghornType method
|
|
15925
|
+
* @name getProvisionedWiredDevice
|
|
15926
|
+
* @summary Get Provisioned Wired Device
|
|
15927
|
+
*
|
|
15928
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
15929
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
15930
|
+
* @return {object} results - An object containing the response of the action
|
|
15931
|
+
*
|
|
15932
|
+
* @route {POST} /getProvisionedWiredDevice
|
|
15933
|
+
* @roles admin
|
|
15934
|
+
* @task true
|
|
15935
|
+
*/
|
|
15936
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
15937
|
+
getProvisionedWiredDevice(deviceManagementIpAddress, callback) {
|
|
15938
|
+
const meth = 'adapter-getProvisionedWiredDevice';
|
|
15939
|
+
const origin = `${this.id}-${meth}`;
|
|
15940
|
+
log.trace(origin);
|
|
15941
|
+
|
|
15942
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
15943
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
15944
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15945
|
+
return callback(null, errorObj);
|
|
15946
|
+
}
|
|
15947
|
+
|
|
15948
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
15949
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
15950
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
15951
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15952
|
+
return callback(null, errorObj);
|
|
15953
|
+
}
|
|
15954
|
+
|
|
15955
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
15956
|
+
const queryParamsAvailable = { deviceManagementIpAddress };
|
|
15957
|
+
const queryParams = {};
|
|
15958
|
+
const pathVars = [];
|
|
15959
|
+
const bodyVars = {};
|
|
15960
|
+
|
|
15961
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
15962
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
15963
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
15964
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
15965
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
15966
|
+
}
|
|
15967
|
+
});
|
|
15968
|
+
|
|
15969
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
15970
|
+
// see adapter code documentation for more information on the request object's fields
|
|
15971
|
+
const reqObj = {
|
|
15972
|
+
payload: bodyVars,
|
|
15973
|
+
uriPathVars: pathVars,
|
|
15974
|
+
uriQuery: queryParams
|
|
15975
|
+
};
|
|
15976
|
+
|
|
15977
|
+
try {
|
|
15978
|
+
// Make the call -
|
|
15979
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
15980
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getProvisionedWiredDevice', reqObj, true, (irReturnData, irReturnError) => {
|
|
15981
|
+
// if we received an error or their is no response on the results
|
|
15982
|
+
// return an error
|
|
15983
|
+
if (irReturnError) {
|
|
15984
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
15985
|
+
return callback(null, irReturnError);
|
|
15986
|
+
}
|
|
15987
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
15988
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getProvisionedWiredDevice'], null, null, null);
|
|
15989
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
15990
|
+
return callback(null, errorObj);
|
|
15991
|
+
}
|
|
15992
|
+
|
|
15993
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
15994
|
+
// return the response
|
|
15995
|
+
return callback(irReturnData, null);
|
|
15996
|
+
});
|
|
15997
|
+
} catch (ex) {
|
|
15998
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
15999
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16000
|
+
return callback(null, errorObj);
|
|
16001
|
+
}
|
|
16002
|
+
}
|
|
16003
|
+
|
|
16004
|
+
/**
|
|
16005
|
+
* @function deleteProvisionedWiredDevice
|
|
16006
|
+
* @pronghornType method
|
|
16007
|
+
* @name deleteProvisionedWiredDevice
|
|
16008
|
+
* @summary Delete provisioned Wired Device
|
|
16009
|
+
*
|
|
16010
|
+
* @param {string} deviceManagementIpAddress - Valid IP address of the device currently provisioned in a fabric site
|
|
16011
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16012
|
+
* @return {object} results - An object containing the response of the action
|
|
16013
|
+
*
|
|
16014
|
+
* @route {POST} /deleteProvisionedWiredDevice
|
|
16015
|
+
* @roles admin
|
|
16016
|
+
* @task true
|
|
16017
|
+
*/
|
|
16018
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16019
|
+
deleteProvisionedWiredDevice(deviceManagementIpAddress, callback) {
|
|
16020
|
+
const meth = 'adapter-deleteProvisionedWiredDevice';
|
|
16021
|
+
const origin = `${this.id}-${meth}`;
|
|
16022
|
+
log.trace(origin);
|
|
16023
|
+
|
|
16024
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16025
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16026
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16027
|
+
return callback(null, errorObj);
|
|
16028
|
+
}
|
|
16029
|
+
|
|
16030
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16031
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
16032
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
16033
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16034
|
+
return callback(null, errorObj);
|
|
16035
|
+
}
|
|
16036
|
+
|
|
16037
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16038
|
+
const queryParamsAvailable = { deviceManagementIpAddress };
|
|
16039
|
+
const queryParams = {};
|
|
16040
|
+
const pathVars = [];
|
|
16041
|
+
const bodyVars = {};
|
|
16042
|
+
|
|
16043
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16044
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16045
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16046
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16047
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16048
|
+
}
|
|
16049
|
+
});
|
|
16050
|
+
|
|
16051
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16052
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16053
|
+
const reqObj = {
|
|
16054
|
+
payload: bodyVars,
|
|
16055
|
+
uriPathVars: pathVars,
|
|
16056
|
+
uriQuery: queryParams
|
|
16057
|
+
};
|
|
16058
|
+
|
|
16059
|
+
try {
|
|
16060
|
+
// Make the call -
|
|
16061
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16062
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteProvisionedWiredDevice', reqObj, false, (irReturnData, irReturnError) => {
|
|
16063
|
+
// if we received an error or their is no response on the results
|
|
16064
|
+
// return an error
|
|
16065
|
+
if (irReturnError) {
|
|
16066
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16067
|
+
return callback(null, irReturnError);
|
|
16068
|
+
}
|
|
16069
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16070
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteProvisionedWiredDevice'], null, null, null);
|
|
16071
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16072
|
+
return callback(null, errorObj);
|
|
16073
|
+
}
|
|
16074
|
+
|
|
16075
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16076
|
+
// return the response
|
|
16077
|
+
return callback(irReturnData, null);
|
|
16078
|
+
});
|
|
16079
|
+
} catch (ex) {
|
|
16080
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16081
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16082
|
+
return callback(null, errorObj);
|
|
16083
|
+
}
|
|
16084
|
+
}
|
|
16085
|
+
|
|
16086
|
+
/**
|
|
16087
|
+
* @function getVirtualNetworkSummary
|
|
16088
|
+
* @pronghornType method
|
|
16089
|
+
* @name getVirtualNetworkSummary
|
|
16090
|
+
* @summary Get Virtual Network Summary
|
|
16091
|
+
*
|
|
16092
|
+
* @param {string} siteNameHierarchy - Complete fabric siteNameHierarchy Path
|
|
16093
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16094
|
+
* @return {object} results - An object containing the response of the action
|
|
16095
|
+
*
|
|
16096
|
+
* @route {POST} /getVirtualNetworkSummary
|
|
16097
|
+
* @roles admin
|
|
16098
|
+
* @task true
|
|
16099
|
+
*/
|
|
16100
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16101
|
+
getVirtualNetworkSummary(siteNameHierarchy, callback) {
|
|
16102
|
+
const meth = 'adapter-getVirtualNetworkSummary';
|
|
16103
|
+
const origin = `${this.id}-${meth}`;
|
|
16104
|
+
log.trace(origin);
|
|
16105
|
+
|
|
16106
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16107
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16108
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16109
|
+
return callback(null, errorObj);
|
|
16110
|
+
}
|
|
16111
|
+
|
|
16112
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16113
|
+
if (siteNameHierarchy === undefined || siteNameHierarchy === null || siteNameHierarchy === '') {
|
|
16114
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['siteNameHierarchy'], null, null, null);
|
|
16115
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16116
|
+
return callback(null, errorObj);
|
|
16117
|
+
}
|
|
16118
|
+
|
|
16119
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16120
|
+
const queryParamsAvailable = { siteNameHierarchy };
|
|
16121
|
+
const queryParams = {};
|
|
16122
|
+
const pathVars = [];
|
|
16123
|
+
const bodyVars = {};
|
|
16124
|
+
|
|
16125
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16126
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16127
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16128
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16129
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16130
|
+
}
|
|
16131
|
+
});
|
|
16132
|
+
|
|
16133
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16134
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16135
|
+
const reqObj = {
|
|
16136
|
+
payload: bodyVars,
|
|
16137
|
+
uriPathVars: pathVars,
|
|
16138
|
+
uriQuery: queryParams
|
|
16139
|
+
};
|
|
16140
|
+
|
|
16141
|
+
try {
|
|
16142
|
+
// Make the call -
|
|
16143
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16144
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getVirtualNetworkSummary', reqObj, true, (irReturnData, irReturnError) => {
|
|
16145
|
+
// if we received an error or their is no response on the results
|
|
16146
|
+
// return an error
|
|
16147
|
+
if (irReturnError) {
|
|
16148
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16149
|
+
return callback(null, irReturnError);
|
|
16150
|
+
}
|
|
16151
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16152
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getVirtualNetworkSummary'], null, null, null);
|
|
16153
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16154
|
+
return callback(null, errorObj);
|
|
16155
|
+
}
|
|
16156
|
+
|
|
16157
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16158
|
+
// return the response
|
|
16159
|
+
return callback(irReturnData, null);
|
|
16160
|
+
});
|
|
16161
|
+
} catch (ex) {
|
|
16162
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16163
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16164
|
+
return callback(null, errorObj);
|
|
16165
|
+
}
|
|
16166
|
+
}
|
|
16167
|
+
|
|
16168
|
+
/**
|
|
16169
|
+
* @function getDeviceRoleInSDAFabric
|
|
16170
|
+
* @pronghornType method
|
|
16171
|
+
* @name getDeviceRoleInSDAFabric
|
|
16172
|
+
* @summary Get device role in SDA Fabric
|
|
16173
|
+
*
|
|
16174
|
+
* @param {string} deviceManagementIpAddress - Device Management IP Address
|
|
16175
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16176
|
+
* @return {object} results - An object containing the response of the action
|
|
16177
|
+
*
|
|
16178
|
+
* @route {POST} /getDeviceRoleInSDAFabric
|
|
16179
|
+
* @roles admin
|
|
16180
|
+
* @task true
|
|
16181
|
+
*/
|
|
16182
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16183
|
+
getDeviceRoleInSDAFabric(deviceManagementIpAddress, callback) {
|
|
16184
|
+
const meth = 'adapter-getDeviceRoleInSDAFabric';
|
|
16185
|
+
const origin = `${this.id}-${meth}`;
|
|
16186
|
+
log.trace(origin);
|
|
16187
|
+
|
|
16188
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16189
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16190
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16191
|
+
return callback(null, errorObj);
|
|
16192
|
+
}
|
|
16193
|
+
|
|
16194
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16195
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
16196
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
16197
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16198
|
+
return callback(null, errorObj);
|
|
16199
|
+
}
|
|
16200
|
+
|
|
16201
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16202
|
+
const queryParamsAvailable = { deviceManagementIpAddress };
|
|
16203
|
+
const queryParams = {};
|
|
16204
|
+
const pathVars = [];
|
|
16205
|
+
const bodyVars = {};
|
|
16206
|
+
|
|
16207
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16208
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16209
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16210
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16211
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16212
|
+
}
|
|
16213
|
+
});
|
|
16214
|
+
|
|
16215
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16216
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16217
|
+
const reqObj = {
|
|
16218
|
+
payload: bodyVars,
|
|
16219
|
+
uriPathVars: pathVars,
|
|
16220
|
+
uriQuery: queryParams
|
|
16221
|
+
};
|
|
16222
|
+
|
|
16223
|
+
try {
|
|
16224
|
+
// Make the call -
|
|
16225
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16226
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getDeviceRoleInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
16227
|
+
// if we received an error or their is no response on the results
|
|
16228
|
+
// return an error
|
|
16229
|
+
if (irReturnError) {
|
|
16230
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16231
|
+
return callback(null, irReturnError);
|
|
16232
|
+
}
|
|
16233
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16234
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getDeviceRoleInSDAFabric'], null, null, null);
|
|
16235
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16236
|
+
return callback(null, errorObj);
|
|
16237
|
+
}
|
|
16238
|
+
|
|
16239
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16240
|
+
// return the response
|
|
16241
|
+
return callback(irReturnData, null);
|
|
16242
|
+
});
|
|
16243
|
+
} catch (ex) {
|
|
16244
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16245
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16246
|
+
return callback(null, errorObj);
|
|
16247
|
+
}
|
|
16248
|
+
}
|
|
16249
|
+
|
|
16250
|
+
/**
|
|
16251
|
+
* @function addPortAssignmentForUserDeviceInSDAFabric
|
|
16252
|
+
* @pronghornType method
|
|
16253
|
+
* @name addPortAssignmentForUserDeviceInSDAFabric
|
|
16254
|
+
* @summary Add Port assignment for user device in SDA Fabric
|
|
16255
|
+
*
|
|
16256
|
+
* @param {object} request - request
|
|
16257
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16258
|
+
* @return {object} results - An object containing the response of the action
|
|
16259
|
+
*
|
|
16260
|
+
* @route {POST} /addPortAssignmentForUserDeviceInSDAFabric
|
|
16261
|
+
* @roles admin
|
|
16262
|
+
* @task true
|
|
16263
|
+
*/
|
|
16264
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16265
|
+
addPortAssignmentForUserDeviceInSDAFabric(request, callback) {
|
|
16266
|
+
const meth = 'adapter-addPortAssignmentForUserDeviceInSDAFabric';
|
|
16267
|
+
const origin = `${this.id}-${meth}`;
|
|
16268
|
+
log.trace(origin);
|
|
16269
|
+
|
|
16270
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16271
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16272
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16273
|
+
return callback(null, errorObj);
|
|
16274
|
+
}
|
|
16275
|
+
|
|
16276
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16277
|
+
if (request === undefined || request === null || request === '') {
|
|
16278
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
16279
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16280
|
+
return callback(null, errorObj);
|
|
16281
|
+
}
|
|
16282
|
+
|
|
16283
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16284
|
+
const queryParamsAvailable = {};
|
|
16285
|
+
const queryParams = {};
|
|
16286
|
+
const pathVars = [];
|
|
16287
|
+
const bodyVars = request;
|
|
16288
|
+
|
|
16289
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16290
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16291
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16292
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16293
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16294
|
+
}
|
|
16295
|
+
});
|
|
16296
|
+
|
|
16297
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16298
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16299
|
+
const reqObj = {
|
|
16300
|
+
payload: bodyVars,
|
|
16301
|
+
uriPathVars: pathVars,
|
|
16302
|
+
uriQuery: queryParams
|
|
16303
|
+
};
|
|
16304
|
+
|
|
16305
|
+
try {
|
|
16306
|
+
// Make the call -
|
|
16307
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16308
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addPortAssignmentForUserDeviceInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
16309
|
+
// if we received an error or their is no response on the results
|
|
16310
|
+
// return an error
|
|
16311
|
+
if (irReturnError) {
|
|
16312
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16313
|
+
return callback(null, irReturnError);
|
|
16314
|
+
}
|
|
16315
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16316
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addPortAssignmentForUserDeviceInSDAFabric'], null, null, null);
|
|
16317
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16318
|
+
return callback(null, errorObj);
|
|
16319
|
+
}
|
|
16320
|
+
|
|
16321
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16322
|
+
// return the response
|
|
16323
|
+
return callback(irReturnData, null);
|
|
16324
|
+
});
|
|
16325
|
+
} catch (ex) {
|
|
16326
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16327
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16328
|
+
return callback(null, errorObj);
|
|
16329
|
+
}
|
|
16330
|
+
}
|
|
16331
|
+
|
|
16332
|
+
/**
|
|
16333
|
+
* @function getPortAssignmentForUserDeviceInSDAFabric
|
|
16334
|
+
* @pronghornType method
|
|
16335
|
+
* @name getPortAssignmentForUserDeviceInSDAFabric
|
|
16336
|
+
* @summary Get Port assignment for user device in SDA Fabric
|
|
16337
|
+
*
|
|
16338
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
16339
|
+
* @param {string} interfaceName - interfaceName
|
|
16340
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16341
|
+
* @return {object} results - An object containing the response of the action
|
|
16342
|
+
*
|
|
16343
|
+
* @route {POST} /getPortAssignmentForUserDeviceInSDAFabric
|
|
16344
|
+
* @roles admin
|
|
16345
|
+
* @task true
|
|
16346
|
+
*/
|
|
16347
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16348
|
+
getPortAssignmentForUserDeviceInSDAFabric(deviceManagementIpAddress, interfaceName, callback) {
|
|
16349
|
+
const meth = 'adapter-getPortAssignmentForUserDeviceInSDAFabric';
|
|
16350
|
+
const origin = `${this.id}-${meth}`;
|
|
16351
|
+
log.trace(origin);
|
|
16352
|
+
|
|
16353
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16354
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16355
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16356
|
+
return callback(null, errorObj);
|
|
16357
|
+
}
|
|
16358
|
+
|
|
16359
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16360
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
16361
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
16362
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16363
|
+
return callback(null, errorObj);
|
|
16364
|
+
}
|
|
16365
|
+
if (interfaceName === undefined || interfaceName === null || interfaceName === '') {
|
|
16366
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['interfaceName'], null, null, null);
|
|
16367
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16368
|
+
return callback(null, errorObj);
|
|
16369
|
+
}
|
|
16370
|
+
|
|
16371
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16372
|
+
const queryParamsAvailable = { deviceManagementIpAddress, interfaceName };
|
|
16373
|
+
const queryParams = {};
|
|
16374
|
+
const pathVars = [];
|
|
16375
|
+
const bodyVars = {};
|
|
16376
|
+
|
|
16377
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16378
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16379
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16380
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16381
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16382
|
+
}
|
|
16383
|
+
});
|
|
16384
|
+
|
|
16385
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16386
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16387
|
+
const reqObj = {
|
|
16388
|
+
payload: bodyVars,
|
|
16389
|
+
uriPathVars: pathVars,
|
|
16390
|
+
uriQuery: queryParams
|
|
16391
|
+
};
|
|
16392
|
+
|
|
16393
|
+
try {
|
|
16394
|
+
// Make the call -
|
|
16395
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16396
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getPortAssignmentForUserDeviceInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
16397
|
+
// if we received an error or their is no response on the results
|
|
16398
|
+
// return an error
|
|
16399
|
+
if (irReturnError) {
|
|
16400
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16401
|
+
return callback(null, irReturnError);
|
|
16402
|
+
}
|
|
16403
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16404
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getPortAssignmentForUserDeviceInSDAFabric'], null, null, null);
|
|
16405
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16406
|
+
return callback(null, errorObj);
|
|
16407
|
+
}
|
|
16408
|
+
|
|
16409
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16410
|
+
// return the response
|
|
16411
|
+
return callback(irReturnData, null);
|
|
16412
|
+
});
|
|
16413
|
+
} catch (ex) {
|
|
16414
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16415
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16416
|
+
return callback(null, errorObj);
|
|
16417
|
+
}
|
|
16418
|
+
}
|
|
16419
|
+
|
|
16420
|
+
/**
|
|
16421
|
+
* @function deletePortAssignmentForUserDeviceInSDAFabric
|
|
16422
|
+
* @pronghornType method
|
|
16423
|
+
* @name deletePortAssignmentForUserDeviceInSDAFabric
|
|
16424
|
+
* @summary Delete Port assignment for user device in SDA Fabric
|
|
16425
|
+
*
|
|
16426
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
16427
|
+
* @param {string} interfaceName - interfaceName
|
|
16428
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16429
|
+
* @return {object} results - An object containing the response of the action
|
|
16430
|
+
*
|
|
16431
|
+
* @route {POST} /deletePortAssignmentForUserDeviceInSDAFabric
|
|
16432
|
+
* @roles admin
|
|
16433
|
+
* @task true
|
|
16434
|
+
*/
|
|
16435
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16436
|
+
deletePortAssignmentForUserDeviceInSDAFabric(deviceManagementIpAddress, interfaceName, callback) {
|
|
16437
|
+
const meth = 'adapter-deletePortAssignmentForUserDeviceInSDAFabric';
|
|
16438
|
+
const origin = `${this.id}-${meth}`;
|
|
16439
|
+
log.trace(origin);
|
|
16440
|
+
|
|
16441
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16442
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16443
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16444
|
+
return callback(null, errorObj);
|
|
16445
|
+
}
|
|
16446
|
+
|
|
16447
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16448
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
16449
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
16450
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16451
|
+
return callback(null, errorObj);
|
|
16452
|
+
}
|
|
16453
|
+
if (interfaceName === undefined || interfaceName === null || interfaceName === '') {
|
|
16454
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['interfaceName'], null, null, null);
|
|
16455
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16456
|
+
return callback(null, errorObj);
|
|
16457
|
+
}
|
|
16458
|
+
|
|
16459
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16460
|
+
const queryParamsAvailable = { deviceManagementIpAddress, interfaceName };
|
|
16461
|
+
const queryParams = {};
|
|
16462
|
+
const pathVars = [];
|
|
16463
|
+
const bodyVars = {};
|
|
16464
|
+
|
|
16465
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16466
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16467
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16468
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16469
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16470
|
+
}
|
|
16471
|
+
});
|
|
16472
|
+
|
|
16473
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16474
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16475
|
+
const reqObj = {
|
|
16476
|
+
payload: bodyVars,
|
|
16477
|
+
uriPathVars: pathVars,
|
|
16478
|
+
uriQuery: queryParams
|
|
16479
|
+
};
|
|
16480
|
+
|
|
16481
|
+
try {
|
|
16482
|
+
// Make the call -
|
|
16483
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16484
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deletePortAssignmentForUserDeviceInSDAFabric', reqObj, false, (irReturnData, irReturnError) => {
|
|
16485
|
+
// if we received an error or their is no response on the results
|
|
16486
|
+
// return an error
|
|
16487
|
+
if (irReturnError) {
|
|
16488
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16489
|
+
return callback(null, irReturnError);
|
|
16490
|
+
}
|
|
16491
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16492
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletePortAssignmentForUserDeviceInSDAFabric'], null, null, null);
|
|
16493
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16494
|
+
return callback(null, errorObj);
|
|
16495
|
+
}
|
|
16496
|
+
|
|
16497
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16498
|
+
// return the response
|
|
16499
|
+
return callback(irReturnData, null);
|
|
16500
|
+
});
|
|
16501
|
+
} catch (ex) {
|
|
16502
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16503
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16504
|
+
return callback(null, errorObj);
|
|
16505
|
+
}
|
|
16506
|
+
}
|
|
16507
|
+
|
|
16508
|
+
/**
|
|
16509
|
+
* @function getBorderDeviceDetailFromSDAFabric
|
|
16510
|
+
* @pronghornType method
|
|
16511
|
+
* @name getBorderDeviceDetailFromSDAFabric
|
|
16512
|
+
* @summary Get border device detail from SDA Fabric
|
|
16513
|
+
*
|
|
16514
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
16515
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16516
|
+
* @return {object} results - An object containing the response of the action
|
|
16517
|
+
*
|
|
16518
|
+
* @route {POST} /getBorderDeviceDetailFromSDAFabric
|
|
16519
|
+
* @roles admin
|
|
16520
|
+
* @task true
|
|
16521
|
+
*/
|
|
16522
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16523
|
+
getBorderDeviceDetailFromSDAFabric(deviceManagementIpAddress, callback) {
|
|
16524
|
+
const meth = 'adapter-getBorderDeviceDetailFromSDAFabric';
|
|
16525
|
+
const origin = `${this.id}-${meth}`;
|
|
16526
|
+
log.trace(origin);
|
|
16527
|
+
|
|
16528
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16529
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16530
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16531
|
+
return callback(null, errorObj);
|
|
16532
|
+
}
|
|
16533
|
+
|
|
16534
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16535
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
16536
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
16537
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16538
|
+
return callback(null, errorObj);
|
|
16539
|
+
}
|
|
16540
|
+
|
|
16541
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16542
|
+
const queryParamsAvailable = { deviceManagementIpAddress };
|
|
16543
|
+
const queryParams = {};
|
|
16544
|
+
const pathVars = [];
|
|
16545
|
+
const bodyVars = {};
|
|
16546
|
+
|
|
16547
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16548
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16549
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16550
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16551
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16552
|
+
}
|
|
16553
|
+
});
|
|
16554
|
+
|
|
16555
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16556
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16557
|
+
const reqObj = {
|
|
16558
|
+
payload: bodyVars,
|
|
16559
|
+
uriPathVars: pathVars,
|
|
16560
|
+
uriQuery: queryParams
|
|
16561
|
+
};
|
|
16562
|
+
|
|
16563
|
+
try {
|
|
16564
|
+
// Make the call -
|
|
16565
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16566
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getBorderDeviceDetailFromSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
16567
|
+
// if we received an error or their is no response on the results
|
|
16568
|
+
// return an error
|
|
16569
|
+
if (irReturnError) {
|
|
16570
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16571
|
+
return callback(null, irReturnError);
|
|
16572
|
+
}
|
|
16573
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16574
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getBorderDeviceDetailFromSDAFabric'], null, null, null);
|
|
16575
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16576
|
+
return callback(null, errorObj);
|
|
16577
|
+
}
|
|
16578
|
+
|
|
16579
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16580
|
+
// return the response
|
|
16581
|
+
return callback(irReturnData, null);
|
|
16582
|
+
});
|
|
16583
|
+
} catch (ex) {
|
|
16584
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16585
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16586
|
+
return callback(null, errorObj);
|
|
16587
|
+
}
|
|
16588
|
+
}
|
|
16589
|
+
|
|
16590
|
+
/**
|
|
16591
|
+
* @function addBorderDeviceInSDAFabric
|
|
16592
|
+
* @pronghornType method
|
|
16593
|
+
* @name addBorderDeviceInSDAFabric
|
|
16594
|
+
* @summary Add border device in SDA Fabric
|
|
16595
|
+
*
|
|
16596
|
+
* @param {array} request - request
|
|
16597
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16598
|
+
* @return {object} results - An object containing the response of the action
|
|
16599
|
+
*
|
|
16600
|
+
* @route {POST} /addBorderDeviceInSDAFabric
|
|
16601
|
+
* @roles admin
|
|
16602
|
+
* @task true
|
|
16603
|
+
*/
|
|
16604
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16605
|
+
addBorderDeviceInSDAFabric(request, callback) {
|
|
16606
|
+
const meth = 'adapter-addBorderDeviceInSDAFabric';
|
|
16607
|
+
const origin = `${this.id}-${meth}`;
|
|
16608
|
+
log.trace(origin);
|
|
16609
|
+
|
|
16610
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16611
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16612
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16613
|
+
return callback(null, errorObj);
|
|
16614
|
+
}
|
|
16615
|
+
|
|
16616
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16617
|
+
if (request === undefined || request === null || request === '') {
|
|
16618
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
16619
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16620
|
+
return callback(null, errorObj);
|
|
16621
|
+
}
|
|
16622
|
+
|
|
16623
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16624
|
+
const queryParamsAvailable = {};
|
|
16625
|
+
const queryParams = {};
|
|
16626
|
+
const pathVars = [];
|
|
16627
|
+
const bodyVars = request;
|
|
16628
|
+
|
|
16629
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16630
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16631
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16632
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16633
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16634
|
+
}
|
|
16635
|
+
});
|
|
16636
|
+
|
|
16637
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16638
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16639
|
+
const reqObj = {
|
|
16640
|
+
payload: bodyVars,
|
|
16641
|
+
uriPathVars: pathVars,
|
|
16642
|
+
uriQuery: queryParams
|
|
16643
|
+
};
|
|
16644
|
+
|
|
16645
|
+
try {
|
|
16646
|
+
// Make the call -
|
|
16647
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16648
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addBorderDeviceInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
16649
|
+
// if we received an error or their is no response on the results
|
|
16650
|
+
// return an error
|
|
16651
|
+
if (irReturnError) {
|
|
16652
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16653
|
+
return callback(null, irReturnError);
|
|
16654
|
+
}
|
|
16655
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16656
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addBorderDeviceInSDAFabric'], null, null, null);
|
|
16657
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16658
|
+
return callback(null, errorObj);
|
|
16659
|
+
}
|
|
16660
|
+
|
|
16661
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16662
|
+
// return the response
|
|
16663
|
+
return callback(irReturnData, null);
|
|
16664
|
+
});
|
|
16665
|
+
} catch (ex) {
|
|
16666
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16667
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16668
|
+
return callback(null, errorObj);
|
|
16669
|
+
}
|
|
16670
|
+
}
|
|
16671
|
+
|
|
16672
|
+
/**
|
|
16673
|
+
* @function deleteBorderDeviceFromSDAFabric
|
|
16674
|
+
* @pronghornType method
|
|
16675
|
+
* @name deleteBorderDeviceFromSDAFabric
|
|
16676
|
+
* @summary Delete border device from SDA Fabric
|
|
16677
|
+
*
|
|
16678
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
16679
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16680
|
+
* @return {object} results - An object containing the response of the action
|
|
16681
|
+
*
|
|
16682
|
+
* @route {POST} /deleteBorderDeviceFromSDAFabric
|
|
16683
|
+
* @roles admin
|
|
16684
|
+
* @task true
|
|
16685
|
+
*/
|
|
16686
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16687
|
+
deleteBorderDeviceFromSDAFabric(deviceManagementIpAddress, callback) {
|
|
16688
|
+
const meth = 'adapter-deleteBorderDeviceFromSDAFabric';
|
|
16689
|
+
const origin = `${this.id}-${meth}`;
|
|
16690
|
+
log.trace(origin);
|
|
16691
|
+
|
|
16692
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16693
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16694
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16695
|
+
return callback(null, errorObj);
|
|
16696
|
+
}
|
|
16697
|
+
|
|
16698
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16699
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
16700
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
16701
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16702
|
+
return callback(null, errorObj);
|
|
16703
|
+
}
|
|
16704
|
+
|
|
16705
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16706
|
+
const queryParamsAvailable = { deviceManagementIpAddress };
|
|
16707
|
+
const queryParams = {};
|
|
16708
|
+
const pathVars = [];
|
|
16709
|
+
const bodyVars = {};
|
|
16710
|
+
|
|
16711
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16712
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16713
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16714
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16715
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16716
|
+
}
|
|
16717
|
+
});
|
|
16718
|
+
|
|
16719
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16720
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16721
|
+
const reqObj = {
|
|
16722
|
+
payload: bodyVars,
|
|
16723
|
+
uriPathVars: pathVars,
|
|
16724
|
+
uriQuery: queryParams
|
|
16725
|
+
};
|
|
16726
|
+
|
|
16727
|
+
try {
|
|
16728
|
+
// Make the call -
|
|
16729
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16730
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteBorderDeviceFromSDAFabric', reqObj, false, (irReturnData, irReturnError) => {
|
|
16731
|
+
// if we received an error or their is no response on the results
|
|
16732
|
+
// return an error
|
|
16733
|
+
if (irReturnError) {
|
|
16734
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16735
|
+
return callback(null, irReturnError);
|
|
16736
|
+
}
|
|
16737
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16738
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteBorderDeviceFromSDAFabric'], null, null, null);
|
|
16739
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16740
|
+
return callback(null, errorObj);
|
|
16741
|
+
}
|
|
16742
|
+
|
|
16743
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16744
|
+
// return the response
|
|
16745
|
+
return callback(irReturnData, null);
|
|
16746
|
+
});
|
|
16747
|
+
} catch (ex) {
|
|
16748
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16749
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16750
|
+
return callback(null, errorObj);
|
|
16751
|
+
}
|
|
16752
|
+
}
|
|
16753
|
+
|
|
16754
|
+
/**
|
|
16755
|
+
* @function getControlPlaneDeviceFromSDAFabric
|
|
16756
|
+
* @pronghornType method
|
|
16757
|
+
* @name getControlPlaneDeviceFromSDAFabric
|
|
16758
|
+
* @summary Get control plane device from SDA Fabric
|
|
16759
|
+
*
|
|
16760
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
16761
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16762
|
+
* @return {object} results - An object containing the response of the action
|
|
16763
|
+
*
|
|
16764
|
+
* @route {POST} /getControlPlaneDeviceFromSDAFabric
|
|
16765
|
+
* @roles admin
|
|
16766
|
+
* @task true
|
|
16767
|
+
*/
|
|
16768
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16769
|
+
getControlPlaneDeviceFromSDAFabric(deviceManagementIpAddress, callback) {
|
|
16770
|
+
const meth = 'adapter-getControlPlaneDeviceFromSDAFabric';
|
|
16771
|
+
const origin = `${this.id}-${meth}`;
|
|
16772
|
+
log.trace(origin);
|
|
16773
|
+
|
|
16774
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16775
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16776
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16777
|
+
return callback(null, errorObj);
|
|
16778
|
+
}
|
|
16779
|
+
|
|
16780
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16781
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
16782
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
16783
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16784
|
+
return callback(null, errorObj);
|
|
16785
|
+
}
|
|
16786
|
+
|
|
16787
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16788
|
+
const queryParamsAvailable = { deviceManagementIpAddress };
|
|
16789
|
+
const queryParams = {};
|
|
16790
|
+
const pathVars = [];
|
|
16791
|
+
const bodyVars = {};
|
|
16792
|
+
|
|
16793
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16794
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16795
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16796
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16797
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16798
|
+
}
|
|
16799
|
+
});
|
|
16800
|
+
|
|
16801
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16802
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16803
|
+
const reqObj = {
|
|
16804
|
+
payload: bodyVars,
|
|
16805
|
+
uriPathVars: pathVars,
|
|
16806
|
+
uriQuery: queryParams
|
|
16807
|
+
};
|
|
16808
|
+
|
|
16809
|
+
try {
|
|
16810
|
+
// Make the call -
|
|
16811
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16812
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getControlPlaneDeviceFromSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
16813
|
+
// if we received an error or their is no response on the results
|
|
16814
|
+
// return an error
|
|
16815
|
+
if (irReturnError) {
|
|
16816
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16817
|
+
return callback(null, irReturnError);
|
|
16818
|
+
}
|
|
16819
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16820
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getControlPlaneDeviceFromSDAFabric'], null, null, null);
|
|
16821
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16822
|
+
return callback(null, errorObj);
|
|
16823
|
+
}
|
|
16824
|
+
|
|
16825
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16826
|
+
// return the response
|
|
16827
|
+
return callback(irReturnData, null);
|
|
16828
|
+
});
|
|
16829
|
+
} catch (ex) {
|
|
16830
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16831
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16832
|
+
return callback(null, errorObj);
|
|
16833
|
+
}
|
|
16834
|
+
}
|
|
16835
|
+
|
|
16836
|
+
/**
|
|
16837
|
+
* @function addControlPlaneDeviceInSDAFabric
|
|
16838
|
+
* @pronghornType method
|
|
16839
|
+
* @name addControlPlaneDeviceInSDAFabric
|
|
16840
|
+
* @summary Add control plane device in SDA Fabric
|
|
16841
|
+
*
|
|
16842
|
+
* @param {object} request - request
|
|
16843
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16844
|
+
* @return {object} results - An object containing the response of the action
|
|
16845
|
+
*
|
|
16846
|
+
* @route {POST} /addControlPlaneDeviceInSDAFabric
|
|
16847
|
+
* @roles admin
|
|
16848
|
+
* @task true
|
|
16849
|
+
*/
|
|
16850
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16851
|
+
addControlPlaneDeviceInSDAFabric(request, callback) {
|
|
16852
|
+
const meth = 'adapter-addControlPlaneDeviceInSDAFabric';
|
|
16853
|
+
const origin = `${this.id}-${meth}`;
|
|
16854
|
+
log.trace(origin);
|
|
16855
|
+
|
|
16856
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16857
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16858
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16859
|
+
return callback(null, errorObj);
|
|
16860
|
+
}
|
|
16861
|
+
|
|
16862
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16863
|
+
if (request === undefined || request === null || request === '') {
|
|
16864
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
16865
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16866
|
+
return callback(null, errorObj);
|
|
16867
|
+
}
|
|
16868
|
+
|
|
16869
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16870
|
+
const queryParamsAvailable = {};
|
|
16871
|
+
const queryParams = {};
|
|
16872
|
+
const pathVars = [];
|
|
16873
|
+
const bodyVars = request;
|
|
16874
|
+
|
|
16875
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16876
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16877
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16878
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16879
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16880
|
+
}
|
|
16881
|
+
});
|
|
16882
|
+
|
|
16883
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16884
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16885
|
+
const reqObj = {
|
|
16886
|
+
payload: bodyVars,
|
|
16887
|
+
uriPathVars: pathVars,
|
|
16888
|
+
uriQuery: queryParams
|
|
16889
|
+
};
|
|
16890
|
+
|
|
16891
|
+
try {
|
|
16892
|
+
// Make the call -
|
|
16893
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16894
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addControlPlaneDeviceInSDAFabric', reqObj, true, (irReturnData, irReturnError) => {
|
|
16895
|
+
// if we received an error or their is no response on the results
|
|
16896
|
+
// return an error
|
|
16897
|
+
if (irReturnError) {
|
|
16898
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16899
|
+
return callback(null, irReturnError);
|
|
16900
|
+
}
|
|
16901
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16902
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addControlPlaneDeviceInSDAFabric'], null, null, null);
|
|
16903
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16904
|
+
return callback(null, errorObj);
|
|
16905
|
+
}
|
|
16906
|
+
|
|
16907
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16908
|
+
// return the response
|
|
16909
|
+
return callback(irReturnData, null);
|
|
16910
|
+
});
|
|
16911
|
+
} catch (ex) {
|
|
16912
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16913
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16914
|
+
return callback(null, errorObj);
|
|
16915
|
+
}
|
|
16916
|
+
}
|
|
16917
|
+
|
|
16918
|
+
/**
|
|
16919
|
+
* @function deleteControlPlaneDeviceInSDAFabric
|
|
16920
|
+
* @pronghornType method
|
|
16921
|
+
* @name deleteControlPlaneDeviceInSDAFabric
|
|
16922
|
+
* @summary Delete control plane device in SDA Fabric
|
|
16923
|
+
*
|
|
16924
|
+
* @param {string} deviceManagementIpAddress - deviceManagementIpAddress
|
|
16925
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
16926
|
+
* @return {object} results - An object containing the response of the action
|
|
16927
|
+
*
|
|
16928
|
+
* @route {POST} /deleteControlPlaneDeviceInSDAFabric
|
|
16929
|
+
* @roles admin
|
|
16930
|
+
* @task true
|
|
16931
|
+
*/
|
|
16932
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
16933
|
+
deleteControlPlaneDeviceInSDAFabric(deviceManagementIpAddress, callback) {
|
|
16934
|
+
const meth = 'adapter-deleteControlPlaneDeviceInSDAFabric';
|
|
16935
|
+
const origin = `${this.id}-${meth}`;
|
|
16936
|
+
log.trace(origin);
|
|
16937
|
+
|
|
16938
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
16939
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
16940
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16941
|
+
return callback(null, errorObj);
|
|
16942
|
+
}
|
|
16943
|
+
|
|
16944
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
16945
|
+
if (deviceManagementIpAddress === undefined || deviceManagementIpAddress === null || deviceManagementIpAddress === '') {
|
|
16946
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['deviceManagementIpAddress'], null, null, null);
|
|
16947
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16948
|
+
return callback(null, errorObj);
|
|
16949
|
+
}
|
|
16950
|
+
|
|
16951
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
16952
|
+
const queryParamsAvailable = { deviceManagementIpAddress };
|
|
16953
|
+
const queryParams = {};
|
|
16954
|
+
const pathVars = [];
|
|
16955
|
+
const bodyVars = {};
|
|
16956
|
+
|
|
16957
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
16958
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
16959
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
16960
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
16961
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
16962
|
+
}
|
|
16963
|
+
});
|
|
16964
|
+
|
|
16965
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
16966
|
+
// see adapter code documentation for more information on the request object's fields
|
|
16967
|
+
const reqObj = {
|
|
16968
|
+
payload: bodyVars,
|
|
16969
|
+
uriPathVars: pathVars,
|
|
16970
|
+
uriQuery: queryParams
|
|
16971
|
+
};
|
|
16972
|
+
|
|
16973
|
+
try {
|
|
16974
|
+
// Make the call -
|
|
16975
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
16976
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteControlPlaneDeviceInSDAFabric', reqObj, false, (irReturnData, irReturnError) => {
|
|
16977
|
+
// if we received an error or their is no response on the results
|
|
16978
|
+
// return an error
|
|
16979
|
+
if (irReturnError) {
|
|
16980
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
16981
|
+
return callback(null, irReturnError);
|
|
16982
|
+
}
|
|
16983
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
16984
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteControlPlaneDeviceInSDAFabric'], null, null, null);
|
|
16985
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16986
|
+
return callback(null, errorObj);
|
|
16987
|
+
}
|
|
16988
|
+
|
|
16989
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
16990
|
+
// return the response
|
|
16991
|
+
return callback(irReturnData, null);
|
|
16992
|
+
});
|
|
16993
|
+
} catch (ex) {
|
|
16994
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
16995
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
16996
|
+
return callback(null, errorObj);
|
|
16997
|
+
}
|
|
16998
|
+
}
|
|
16999
|
+
|
|
17000
|
+
/**
|
|
17001
|
+
* @function updateVirtualNetworkWithScalableGroups
|
|
17002
|
+
* @pronghornType method
|
|
17003
|
+
* @name updateVirtualNetworkWithScalableGroups
|
|
17004
|
+
* @summary Update virtual network with scalable groups
|
|
17005
|
+
*
|
|
17006
|
+
* @param {object} request - request
|
|
17007
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
17008
|
+
* @return {object} results - An object containing the response of the action
|
|
17009
|
+
*
|
|
17010
|
+
* @route {POST} /updateVirtualNetworkWithScalableGroups
|
|
17011
|
+
* @roles admin
|
|
17012
|
+
* @task true
|
|
17013
|
+
*/
|
|
17014
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
17015
|
+
updateVirtualNetworkWithScalableGroups(request, callback) {
|
|
17016
|
+
const meth = 'adapter-updateVirtualNetworkWithScalableGroups';
|
|
17017
|
+
const origin = `${this.id}-${meth}`;
|
|
17018
|
+
log.trace(origin);
|
|
17019
|
+
|
|
17020
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
17021
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
17022
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17023
|
+
return callback(null, errorObj);
|
|
17024
|
+
}
|
|
17025
|
+
|
|
17026
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
17027
|
+
if (request === undefined || request === null || request === '') {
|
|
17028
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
17029
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17030
|
+
return callback(null, errorObj);
|
|
17031
|
+
}
|
|
17032
|
+
|
|
17033
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
17034
|
+
const queryParamsAvailable = {};
|
|
17035
|
+
const queryParams = {};
|
|
17036
|
+
const pathVars = [];
|
|
17037
|
+
const bodyVars = request;
|
|
17038
|
+
|
|
17039
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
17040
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
17041
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
17042
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
17043
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
17044
|
+
}
|
|
17045
|
+
});
|
|
17046
|
+
|
|
17047
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
17048
|
+
// see adapter code documentation for more information on the request object's fields
|
|
17049
|
+
const reqObj = {
|
|
17050
|
+
payload: bodyVars,
|
|
17051
|
+
uriPathVars: pathVars,
|
|
17052
|
+
uriQuery: queryParams
|
|
17053
|
+
};
|
|
17054
|
+
|
|
17055
|
+
try {
|
|
17056
|
+
// Make the call -
|
|
17057
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
17058
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'updateVirtualNetworkWithScalableGroups', reqObj, false, (irReturnData, irReturnError) => {
|
|
17059
|
+
// if we received an error or their is no response on the results
|
|
17060
|
+
// return an error
|
|
17061
|
+
if (irReturnError) {
|
|
17062
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
17063
|
+
return callback(null, irReturnError);
|
|
17064
|
+
}
|
|
17065
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
17066
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['updateVirtualNetworkWithScalableGroups'], null, null, null);
|
|
17067
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17068
|
+
return callback(null, errorObj);
|
|
17069
|
+
}
|
|
17070
|
+
|
|
17071
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
17072
|
+
// return the response
|
|
17073
|
+
return callback(irReturnData, null);
|
|
17074
|
+
});
|
|
17075
|
+
} catch (ex) {
|
|
17076
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
17077
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17078
|
+
return callback(null, errorObj);
|
|
17079
|
+
}
|
|
17080
|
+
}
|
|
17081
|
+
|
|
17082
|
+
/**
|
|
17083
|
+
* @function deleteVirtualNetworkWithScalableGroups
|
|
17084
|
+
* @pronghornType method
|
|
17085
|
+
* @name deleteVirtualNetworkWithScalableGroups
|
|
17086
|
+
* @summary Delete virtual network with scalable groups
|
|
17087
|
+
*
|
|
17088
|
+
* @param {string} virtualNetworkName - virtualNetworkName
|
|
17089
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
17090
|
+
* @return {object} results - An object containing the response of the action
|
|
17091
|
+
*
|
|
17092
|
+
* @route {POST} /deleteVirtualNetworkWithScalableGroups
|
|
17093
|
+
* @roles admin
|
|
17094
|
+
* @task true
|
|
17095
|
+
*/
|
|
17096
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
17097
|
+
deleteVirtualNetworkWithScalableGroups(virtualNetworkName, callback) {
|
|
17098
|
+
const meth = 'adapter-deleteVirtualNetworkWithScalableGroups';
|
|
17099
|
+
const origin = `${this.id}-${meth}`;
|
|
17100
|
+
log.trace(origin);
|
|
17101
|
+
|
|
17102
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
17103
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
17104
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17105
|
+
return callback(null, errorObj);
|
|
17106
|
+
}
|
|
17107
|
+
|
|
17108
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
17109
|
+
if (virtualNetworkName === undefined || virtualNetworkName === null || virtualNetworkName === '') {
|
|
17110
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['virtualNetworkName'], null, null, null);
|
|
17111
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17112
|
+
return callback(null, errorObj);
|
|
17113
|
+
}
|
|
17114
|
+
|
|
17115
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
17116
|
+
const queryParamsAvailable = { virtualNetworkName };
|
|
17117
|
+
const queryParams = {};
|
|
17118
|
+
const pathVars = [];
|
|
17119
|
+
const bodyVars = {};
|
|
17120
|
+
|
|
17121
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
17122
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
17123
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
17124
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
17125
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
17126
|
+
}
|
|
17127
|
+
});
|
|
17128
|
+
|
|
17129
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
17130
|
+
// see adapter code documentation for more information on the request object's fields
|
|
17131
|
+
const reqObj = {
|
|
17132
|
+
payload: bodyVars,
|
|
17133
|
+
uriPathVars: pathVars,
|
|
17134
|
+
uriQuery: queryParams
|
|
17135
|
+
};
|
|
17136
|
+
|
|
17137
|
+
try {
|
|
17138
|
+
// Make the call -
|
|
17139
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
17140
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'deleteVirtualNetworkWithScalableGroups', reqObj, false, (irReturnData, irReturnError) => {
|
|
17141
|
+
// if we received an error or their is no response on the results
|
|
17142
|
+
// return an error
|
|
17143
|
+
if (irReturnError) {
|
|
17144
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
17145
|
+
return callback(null, irReturnError);
|
|
17146
|
+
}
|
|
17147
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
17148
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deleteVirtualNetworkWithScalableGroups'], null, null, null);
|
|
17149
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17150
|
+
return callback(null, errorObj);
|
|
17151
|
+
}
|
|
17152
|
+
|
|
17153
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
17154
|
+
// return the response
|
|
17155
|
+
return callback(irReturnData, null);
|
|
17156
|
+
});
|
|
17157
|
+
} catch (ex) {
|
|
17158
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
17159
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17160
|
+
return callback(null, errorObj);
|
|
17161
|
+
}
|
|
17162
|
+
}
|
|
17163
|
+
|
|
17164
|
+
/**
|
|
17165
|
+
* @function getVirtualNetworkWithScalableGroups
|
|
17166
|
+
* @pronghornType method
|
|
17167
|
+
* @name getVirtualNetworkWithScalableGroups
|
|
17168
|
+
* @summary Get virtual network with scalable groups
|
|
17169
|
+
*
|
|
17170
|
+
* @param {string} virtualNetworkName - virtualNetworkName
|
|
17171
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
17172
|
+
* @return {object} results - An object containing the response of the action
|
|
17173
|
+
*
|
|
17174
|
+
* @route {POST} /getVirtualNetworkWithScalableGroups
|
|
17175
|
+
* @roles admin
|
|
17176
|
+
* @task true
|
|
17177
|
+
*/
|
|
17178
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
17179
|
+
getVirtualNetworkWithScalableGroups(virtualNetworkName, callback) {
|
|
17180
|
+
const meth = 'adapter-getVirtualNetworkWithScalableGroups';
|
|
17181
|
+
const origin = `${this.id}-${meth}`;
|
|
17182
|
+
log.trace(origin);
|
|
17183
|
+
|
|
17184
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
17185
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
17186
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17187
|
+
return callback(null, errorObj);
|
|
17188
|
+
}
|
|
17189
|
+
|
|
17190
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
17191
|
+
if (virtualNetworkName === undefined || virtualNetworkName === null || virtualNetworkName === '') {
|
|
17192
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['virtualNetworkName'], null, null, null);
|
|
17193
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17194
|
+
return callback(null, errorObj);
|
|
17195
|
+
}
|
|
17196
|
+
|
|
17197
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
17198
|
+
const queryParamsAvailable = { virtualNetworkName };
|
|
17199
|
+
const queryParams = {};
|
|
17200
|
+
const pathVars = [];
|
|
17201
|
+
const bodyVars = {};
|
|
17202
|
+
|
|
17203
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
17204
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
17205
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
17206
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
17207
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
17208
|
+
}
|
|
17209
|
+
});
|
|
17210
|
+
|
|
17211
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
17212
|
+
// see adapter code documentation for more information on the request object's fields
|
|
17213
|
+
const reqObj = {
|
|
17214
|
+
payload: bodyVars,
|
|
17215
|
+
uriPathVars: pathVars,
|
|
17216
|
+
uriQuery: queryParams
|
|
17217
|
+
};
|
|
17218
|
+
|
|
17219
|
+
try {
|
|
17220
|
+
// Make the call -
|
|
17221
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
17222
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'getVirtualNetworkWithScalableGroups', reqObj, true, (irReturnData, irReturnError) => {
|
|
17223
|
+
// if we received an error or their is no response on the results
|
|
17224
|
+
// return an error
|
|
17225
|
+
if (irReturnError) {
|
|
17226
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
17227
|
+
return callback(null, irReturnError);
|
|
17228
|
+
}
|
|
17229
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
17230
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getVirtualNetworkWithScalableGroups'], null, null, null);
|
|
17231
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17232
|
+
return callback(null, errorObj);
|
|
17233
|
+
}
|
|
17234
|
+
|
|
17235
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
17236
|
+
// return the response
|
|
17237
|
+
return callback(irReturnData, null);
|
|
17238
|
+
});
|
|
17239
|
+
} catch (ex) {
|
|
17240
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
17241
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17242
|
+
return callback(null, errorObj);
|
|
17243
|
+
}
|
|
17244
|
+
}
|
|
17245
|
+
|
|
17246
|
+
/**
|
|
17247
|
+
* @function addVirtualNetworkWithScalableGroups
|
|
17248
|
+
* @pronghornType method
|
|
17249
|
+
* @name addVirtualNetworkWithScalableGroups
|
|
17250
|
+
* @summary Add virtual network with scalable groups
|
|
17251
|
+
*
|
|
17252
|
+
* @param {object} request - request
|
|
17253
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
17254
|
+
* @return {object} results - An object containing the response of the action
|
|
17255
|
+
*
|
|
17256
|
+
* @route {POST} /addVirtualNetworkWithScalableGroups
|
|
17257
|
+
* @roles admin
|
|
17258
|
+
* @task true
|
|
17259
|
+
*/
|
|
17260
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
17261
|
+
addVirtualNetworkWithScalableGroups(request, callback) {
|
|
17262
|
+
const meth = 'adapter-addVirtualNetworkWithScalableGroups';
|
|
17263
|
+
const origin = `${this.id}-${meth}`;
|
|
17264
|
+
log.trace(origin);
|
|
17265
|
+
|
|
17266
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
17267
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
17268
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17269
|
+
return callback(null, errorObj);
|
|
17270
|
+
}
|
|
17271
|
+
|
|
17272
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
17273
|
+
if (request === undefined || request === null || request === '') {
|
|
17274
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['request'], null, null, null);
|
|
17275
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17276
|
+
return callback(null, errorObj);
|
|
17277
|
+
}
|
|
17278
|
+
|
|
17279
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
17280
|
+
const queryParamsAvailable = {};
|
|
17281
|
+
const queryParams = {};
|
|
17282
|
+
const pathVars = [];
|
|
17283
|
+
const bodyVars = request;
|
|
17284
|
+
|
|
17285
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
17286
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
17287
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
17288
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
17289
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
17290
|
+
}
|
|
17291
|
+
});
|
|
17292
|
+
|
|
17293
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
17294
|
+
// see adapter code documentation for more information on the request object's fields
|
|
17295
|
+
const reqObj = {
|
|
17296
|
+
payload: bodyVars,
|
|
17297
|
+
uriPathVars: pathVars,
|
|
17298
|
+
uriQuery: queryParams
|
|
17299
|
+
};
|
|
17300
|
+
|
|
17301
|
+
try {
|
|
17302
|
+
// Make the call -
|
|
17303
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
17304
|
+
return this.requestHandlerInst.identifyRequest('SDA', 'addVirtualNetworkWithScalableGroups', reqObj, true, (irReturnData, irReturnError) => {
|
|
17305
|
+
// if we received an error or their is no response on the results
|
|
17306
|
+
// return an error
|
|
17307
|
+
if (irReturnError) {
|
|
17308
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
17309
|
+
return callback(null, irReturnError);
|
|
17310
|
+
}
|
|
17311
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
17312
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['addVirtualNetworkWithScalableGroups'], null, null, null);
|
|
17313
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17314
|
+
return callback(null, errorObj);
|
|
17315
|
+
}
|
|
17316
|
+
|
|
17317
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
17318
|
+
// return the response
|
|
17319
|
+
return callback(irReturnData, null);
|
|
17320
|
+
});
|
|
17321
|
+
} catch (ex) {
|
|
17322
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
17323
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
17324
|
+
return callback(null, errorObj);
|
|
17325
|
+
}
|
|
17326
|
+
}
|
|
13576
17327
|
}
|
|
13577
17328
|
|
|
13578
17329
|
module.exports = DnaCenter;
|