@itentialopensource/adapter-nokia_nsp_network 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +6 -0
- package/.eslintrc.js +18 -0
- package/.gitlab/.gitkeep +0 -0
- package/.gitlab/issue_templates/.gitkeep +0 -0
- package/.gitlab/issue_templates/Default.md +17 -0
- package/.gitlab/issue_templates/bugReportTemplate.md +76 -0
- package/.gitlab/issue_templates/featureRequestTemplate.md +14 -0
- package/.jshintrc +0 -0
- package/AUTH.md +39 -0
- package/BROKER.md +199 -0
- package/CALLS.md +170 -0
- package/CHANGELOG.md +9 -0
- package/CODE_OF_CONDUCT.md +43 -0
- package/CONTRIBUTING.md +172 -0
- package/ENHANCE.md +69 -0
- package/LICENSE +201 -0
- package/PROPERTIES.md +641 -0
- package/README.md +337 -0
- package/SUMMARY.md +9 -0
- package/SYSTEMINFO.md +11 -0
- package/TROUBLESHOOT.md +47 -0
- package/adapter.js +3443 -0
- package/adapterBase.js +1787 -0
- package/entities/.generic/action.json +214 -0
- package/entities/.generic/schema.json +28 -0
- package/entities/.system/action.json +50 -0
- package/entities/.system/mockdatafiles/getToken-default.json +3 -0
- package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
- package/entities/.system/schema.json +19 -0
- package/entities/.system/schemaTokenReq.json +53 -0
- package/entities/.system/schemaTokenResp.json +53 -0
- package/entities/CardSlots/action.json +46 -0
- package/entities/CardSlots/mockdatafiles/getCardSlotsUsingGET-default.json +256 -0
- package/entities/CardSlots/schema.json +20 -0
- package/entities/Cards/action.json +46 -0
- package/entities/Cards/mockdatafiles/getCardsUsingGET-default.json +103 -0
- package/entities/Cards/schema.json +20 -0
- package/entities/Lags/action.json +46 -0
- package/entities/Lags/mockdatafiles/getLAGsUsingGET-default.json +1054 -0
- package/entities/Lags/schema.json +20 -0
- package/entities/NetworkElements/action.json +298 -0
- package/entities/NetworkElements/mockdatafiles/getCardPortsUsingGET-default.json +235 -0
- package/entities/NetworkElements/mockdatafiles/getLagMembersUsingGET-default.json +60 -0
- package/entities/NetworkElements/mockdatafiles/getNELAGsUsingGET-default.json +1226 -0
- package/entities/NetworkElements/mockdatafiles/getNERadioEquipmentsUsingGET-default.json +338 -0
- package/entities/NetworkElements/mockdatafiles/getNEShelvesUsingGET-default.json +86 -0
- package/entities/NetworkElements/mockdatafiles/getNEsUsingGET-default.json +166 -0
- package/entities/NetworkElements/mockdatafiles/getRadioEquipmentCardPortsUsingGET-default.json +410 -0
- package/entities/NetworkElements/mockdatafiles/getRadioEquipmentLagMembersUsingGET-default.json +19 -0
- package/entities/NetworkElements/mockdatafiles/getRadioEquipmentLagsUsingGET-default.json +312 -0
- package/entities/NetworkElements/mockdatafiles/getRadioEquipmentShelfCardsUsingGET-default.json +106 -0
- package/entities/NetworkElements/mockdatafiles/getRadioEquipmentShelvesUsingGET-default.json +66 -0
- package/entities/NetworkElements/mockdatafiles/getShelfCardsUsingGET-default.json +218 -0
- package/entities/NetworkElements/mockdatafiles/getShelfPortsUsingGET-default.json +342 -0
- package/entities/NetworkElements/schema.json +32 -0
- package/entities/PhysicalLinks/action.json +86 -0
- package/entities/PhysicalLinks/mockdatafiles/getPhysicalLinksUsingGET-default.json +283 -0
- package/entities/PhysicalLinks/schema.json +22 -0
- package/entities/Ports/action.json +46 -0
- package/entities/Ports/mockdatafiles/getPortsUsingGET-default.json +440 -0
- package/entities/Ports/schema.json +20 -0
- package/entities/RadioEquipment/action.json +46 -0
- package/entities/RadioEquipment/mockdatafiles/getRadioEquipmentsUsingGET-default.json +86 -0
- package/entities/RadioEquipment/schema.json +20 -0
- package/entities/Shelves/action.json +46 -0
- package/entities/Shelves/mockdatafiles/getShelvesUsingGET-default.json +90 -0
- package/entities/Shelves/schema.json +20 -0
- package/error.json +190 -0
- package/package.json +86 -0
- package/pronghorn.json +8731 -0
- package/propertiesDecorators.json +14 -0
- package/propertiesSchema.json +1248 -0
- package/refs?service=git-upload-pack +0 -0
- package/report/creationReport.json +365 -0
- package/report/networkSupervision-22.9-v1.json-Swagger20.json +5789 -0
- package/sampleProperties.json +195 -0
- package/test/integration/adapterTestBasicGet.js +83 -0
- package/test/integration/adapterTestConnectivity.js +93 -0
- package/test/integration/adapterTestIntegration.js +1143 -0
- package/test/unit/adapterBaseTestUnit.js +949 -0
- package/test/unit/adapterTestUnit.js +2283 -0
- package/utils/adapterInfo.js +206 -0
- package/utils/addAuth.js +94 -0
- package/utils/artifactize.js +146 -0
- package/utils/basicGet.js +50 -0
- package/utils/checkMigrate.js +63 -0
- package/utils/entitiesToDB.js +178 -0
- package/utils/findPath.js +74 -0
- package/utils/methodDocumentor.js +225 -0
- package/utils/modify.js +154 -0
- package/utils/packModificationScript.js +35 -0
- package/utils/patches2bundledDeps.js +90 -0
- package/utils/pre-commit.sh +32 -0
- package/utils/removeHooks.js +20 -0
- package/utils/setup.js +33 -0
- package/utils/tbScript.js +246 -0
- package/utils/tbUtils.js +490 -0
- package/utils/testRunner.js +298 -0
- package/utils/troubleshootingAdapter.js +195 -0
- package/workflows/README.md +3 -0
package/adapter.js
ADDED
|
@@ -0,0 +1,3443 @@
|
|
|
1
|
+
/* @copyright Itential, LLC 2019 (pre-modifications) */
|
|
2
|
+
|
|
3
|
+
/* eslint import/no-dynamic-require: warn */
|
|
4
|
+
/* eslint object-curly-newline: warn */
|
|
5
|
+
|
|
6
|
+
// Set globals
|
|
7
|
+
/* global log */
|
|
8
|
+
|
|
9
|
+
/* Required libraries. */
|
|
10
|
+
const path = require('path');
|
|
11
|
+
|
|
12
|
+
/* Fetch in the other needed components for the this Adaptor */
|
|
13
|
+
const AdapterBaseCl = require(path.join(__dirname, 'adapterBase.js'));
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* This is the adapter/interface into Nokia_nsp_network
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/* GENERAL ADAPTER FUNCTIONS */
|
|
20
|
+
class NokiaNspNetwork extends AdapterBaseCl {
|
|
21
|
+
/**
|
|
22
|
+
* NokiaNspNetwork Adapter
|
|
23
|
+
* @constructor
|
|
24
|
+
*/
|
|
25
|
+
/* Working on changing the way we do Emit methods due to size and time constrainsts
|
|
26
|
+
constructor(prongid, properties) {
|
|
27
|
+
// Instantiate the AdapterBase super class
|
|
28
|
+
super(prongid, properties);
|
|
29
|
+
|
|
30
|
+
const restFunctionNames = this.iapGetAdapterWorkflowFunctions();
|
|
31
|
+
|
|
32
|
+
// Dynamically bind emit functions
|
|
33
|
+
for (let i = 0; i < restFunctionNames.length; i += 1) {
|
|
34
|
+
// Bind function to have name fnNameEmit for fnName
|
|
35
|
+
const version = restFunctionNames[i].match(/__v[0-9]+/);
|
|
36
|
+
const baseFnName = restFunctionNames[i].replace(/__v[0-9]+/, '');
|
|
37
|
+
const fnNameEmit = version ? `${baseFnName}Emit${version}` : `${baseFnName}Emit`;
|
|
38
|
+
this[fnNameEmit] = function (...args) {
|
|
39
|
+
// extract the callback
|
|
40
|
+
const callback = args[args.length - 1];
|
|
41
|
+
// slice the callback from args so we can insert our own
|
|
42
|
+
const functionArgs = args.slice(0, args.length - 1);
|
|
43
|
+
// create a random name for the listener
|
|
44
|
+
const eventName = `${restFunctionNames[i]}:${Math.random().toString(36)}`;
|
|
45
|
+
// tell the calling class to start listening
|
|
46
|
+
callback({ event: eventName, status: 'received' });
|
|
47
|
+
// store parent for use of this context later
|
|
48
|
+
const parent = this;
|
|
49
|
+
// store emission function
|
|
50
|
+
const func = function (val, err) {
|
|
51
|
+
parent.removeListener(eventName, func);
|
|
52
|
+
parent.emit(eventName, val, err);
|
|
53
|
+
};
|
|
54
|
+
// Use apply to call the function in a specific context
|
|
55
|
+
this[restFunctionNames[i]].apply(this, functionArgs.concat([func])); // eslint-disable-line prefer-spread
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Uncomment if you have things to add to the constructor like using your own properties.
|
|
60
|
+
// Otherwise the constructor in the adapterBase will be used.
|
|
61
|
+
// Capture my own properties - they need to be defined in propertiesSchema.json
|
|
62
|
+
// if (this.allProps && this.allProps.myownproperty) {
|
|
63
|
+
// mypropvariable = this.allProps.myownproperty;
|
|
64
|
+
// }
|
|
65
|
+
}
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @callback healthCallback
|
|
70
|
+
* @param {Object} reqObj - the request to send into the healthcheck
|
|
71
|
+
* @param {Callback} callback - The results of the call
|
|
72
|
+
*/
|
|
73
|
+
healthCheck(reqObj, callback) {
|
|
74
|
+
// you can modify what is passed into the healthcheck by changing things in the newReq
|
|
75
|
+
let newReq = null;
|
|
76
|
+
if (reqObj) {
|
|
77
|
+
newReq = Object.assign(...reqObj);
|
|
78
|
+
}
|
|
79
|
+
super.healthCheck(newReq, callback);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @iapGetAdapterWorkflowFunctions
|
|
84
|
+
*/
|
|
85
|
+
iapGetAdapterWorkflowFunctions(inIgnore) {
|
|
86
|
+
let myIgnore = [
|
|
87
|
+
'healthCheck',
|
|
88
|
+
'iapGetAdapterWorkflowFunctions',
|
|
89
|
+
'iapHasAdapterEntity',
|
|
90
|
+
'iapVerifyAdapterCapability',
|
|
91
|
+
'iapUpdateAdapterEntityCache',
|
|
92
|
+
'hasEntities'
|
|
93
|
+
];
|
|
94
|
+
if (!inIgnore && Array.isArray(inIgnore)) {
|
|
95
|
+
myIgnore = inIgnore;
|
|
96
|
+
} else if (!inIgnore && typeof inIgnore === 'string') {
|
|
97
|
+
myIgnore = [inIgnore];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// The generic adapter functions should already be ignored (e.g. healthCheck)
|
|
101
|
+
// you can add specific methods that you do not want to be workflow functions to ignore like below
|
|
102
|
+
// myIgnore.push('myMethodNotInWorkflow');
|
|
103
|
+
|
|
104
|
+
return super.iapGetAdapterWorkflowFunctions(myIgnore);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* iapUpdateAdapterConfiguration is used to update any of the adapter configuration files. This
|
|
109
|
+
* allows customers to make changes to adapter configuration without having to be on the
|
|
110
|
+
* file system.
|
|
111
|
+
*
|
|
112
|
+
* @function iapUpdateAdapterConfiguration
|
|
113
|
+
* @param {string} configFile - the name of the file being updated (required)
|
|
114
|
+
* @param {Object} changes - an object containing all of the changes = formatted like the configuration file (required)
|
|
115
|
+
* @param {string} entity - the entity to be changed, if an action, schema or mock data file (optional)
|
|
116
|
+
* @param {string} type - the type of entity file to change, (action, schema, mock) (optional)
|
|
117
|
+
* @param {string} action - the action to be changed, if an action, schema or mock data file (optional)
|
|
118
|
+
* @param {Callback} callback - The results of the call
|
|
119
|
+
*/
|
|
120
|
+
iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback) {
|
|
121
|
+
const meth = 'adapter-iapUpdateAdapterConfiguration';
|
|
122
|
+
const origin = `${this.id}-${meth}`;
|
|
123
|
+
log.trace(origin);
|
|
124
|
+
|
|
125
|
+
super.iapUpdateAdapterConfiguration(configFile, changes, entity, type, action, callback);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* See if the API path provided is found in this adapter
|
|
130
|
+
*
|
|
131
|
+
* @function iapFindAdapterPath
|
|
132
|
+
* @param {string} apiPath - the api path to check on
|
|
133
|
+
* @param {Callback} callback - The results of the call
|
|
134
|
+
*/
|
|
135
|
+
iapFindAdapterPath(apiPath, callback) {
|
|
136
|
+
const meth = 'adapter-iapFindAdapterPath';
|
|
137
|
+
const origin = `${this.id}-${meth}`;
|
|
138
|
+
log.trace(origin);
|
|
139
|
+
|
|
140
|
+
super.iapFindAdapterPath(apiPath, callback);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* @summary Suspends adapter
|
|
145
|
+
*
|
|
146
|
+
* @function iapSuspendAdapter
|
|
147
|
+
* @param {Callback} callback - callback function
|
|
148
|
+
*/
|
|
149
|
+
iapSuspendAdapter(mode, callback) {
|
|
150
|
+
const meth = 'adapter-iapSuspendAdapter';
|
|
151
|
+
const origin = `${this.id}-${meth}`;
|
|
152
|
+
log.trace(origin);
|
|
153
|
+
|
|
154
|
+
try {
|
|
155
|
+
return super.iapSuspendAdapter(mode, callback);
|
|
156
|
+
} catch (error) {
|
|
157
|
+
log.error(`${origin}: ${error}`);
|
|
158
|
+
return callback(null, error);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* @summary Unsuspends adapter
|
|
164
|
+
*
|
|
165
|
+
* @function iapUnsuspendAdapter
|
|
166
|
+
* @param {Callback} callback - callback function
|
|
167
|
+
*/
|
|
168
|
+
iapUnsuspendAdapter(callback) {
|
|
169
|
+
const meth = 'adapter-iapUnsuspendAdapter';
|
|
170
|
+
const origin = `${this.id}-${meth}`;
|
|
171
|
+
log.trace(origin);
|
|
172
|
+
|
|
173
|
+
try {
|
|
174
|
+
return super.iapUnsuspendAdapter(callback);
|
|
175
|
+
} catch (error) {
|
|
176
|
+
log.error(`${origin}: ${error}`);
|
|
177
|
+
return callback(null, error);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @summary Get the Adaoter Queue
|
|
183
|
+
*
|
|
184
|
+
* @function iapGetAdapterQueue
|
|
185
|
+
* @param {Callback} callback - callback function
|
|
186
|
+
*/
|
|
187
|
+
iapGetAdapterQueue(callback) {
|
|
188
|
+
const meth = 'adapter-iapGetAdapterQueue';
|
|
189
|
+
const origin = `${this.id}-${meth}`;
|
|
190
|
+
log.trace(origin);
|
|
191
|
+
|
|
192
|
+
return super.iapGetAdapterQueue(callback);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* @summary Runs troubleshoot scripts for adapter
|
|
197
|
+
*
|
|
198
|
+
* @function iapTroubleshootAdapter
|
|
199
|
+
* @param {Object} props - the connection, healthcheck and authentication properties
|
|
200
|
+
*
|
|
201
|
+
* @param {boolean} persistFlag - whether the adapter properties should be updated
|
|
202
|
+
* @param {Callback} callback - The results of the call
|
|
203
|
+
*/
|
|
204
|
+
iapTroubleshootAdapter(props, persistFlag, callback) {
|
|
205
|
+
const meth = 'adapter-iapTroubleshootAdapter';
|
|
206
|
+
const origin = `${this.id}-${meth}`;
|
|
207
|
+
log.trace(origin);
|
|
208
|
+
|
|
209
|
+
try {
|
|
210
|
+
return super.iapTroubleshootAdapter(props, persistFlag, this, callback);
|
|
211
|
+
} catch (error) {
|
|
212
|
+
log.error(`${origin}: ${error}`);
|
|
213
|
+
return callback(null, error);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @summary runs healthcheck script for adapter
|
|
219
|
+
*
|
|
220
|
+
* @function iapRunAdapterHealthcheck
|
|
221
|
+
* @param {Adapter} adapter - adapter instance to troubleshoot
|
|
222
|
+
* @param {Callback} callback - callback function
|
|
223
|
+
*/
|
|
224
|
+
iapRunAdapterHealthcheck(callback) {
|
|
225
|
+
const meth = 'adapter-iapRunAdapterHealthcheck';
|
|
226
|
+
const origin = `${this.id}-${meth}`;
|
|
227
|
+
log.trace(origin);
|
|
228
|
+
|
|
229
|
+
try {
|
|
230
|
+
return super.iapRunAdapterHealthcheck(this, callback);
|
|
231
|
+
} catch (error) {
|
|
232
|
+
log.error(`${origin}: ${error}`);
|
|
233
|
+
return callback(null, error);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @summary runs connectivity check script for adapter
|
|
239
|
+
*
|
|
240
|
+
* @function iapRunAdapterConnectivity
|
|
241
|
+
* @param {Callback} callback - callback function
|
|
242
|
+
*/
|
|
243
|
+
iapRunAdapterConnectivity(callback) {
|
|
244
|
+
const meth = 'adapter-iapRunAdapterConnectivity';
|
|
245
|
+
const origin = `${this.id}-${meth}`;
|
|
246
|
+
log.trace(origin);
|
|
247
|
+
|
|
248
|
+
try {
|
|
249
|
+
return super.iapRunAdapterConnectivity(callback);
|
|
250
|
+
} catch (error) {
|
|
251
|
+
log.error(`${origin}: ${error}`);
|
|
252
|
+
return callback(null, error);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @summary runs basicGet script for adapter
|
|
258
|
+
*
|
|
259
|
+
* @function iapRunAdapterBasicGet
|
|
260
|
+
* @param {Callback} callback - callback function
|
|
261
|
+
*/
|
|
262
|
+
iapRunAdapterBasicGet(callback) {
|
|
263
|
+
const meth = 'adapter-iapRunAdapterBasicGet';
|
|
264
|
+
const origin = `${this.id}-${meth}`;
|
|
265
|
+
log.trace(origin);
|
|
266
|
+
|
|
267
|
+
try {
|
|
268
|
+
return super.iapRunAdapterBasicGet(callback);
|
|
269
|
+
} catch (error) {
|
|
270
|
+
log.error(`${origin}: ${error}`);
|
|
271
|
+
return callback(null, error);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* @summary moves entites into Mongo DB
|
|
277
|
+
*
|
|
278
|
+
* @function iapMoveAdapterEntitiesToDB
|
|
279
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
280
|
+
* or the error
|
|
281
|
+
*/
|
|
282
|
+
iapMoveAdapterEntitiesToDB(callback) {
|
|
283
|
+
const meth = 'adapter-iapMoveAdapterEntitiesToDB';
|
|
284
|
+
const origin = `${this.id}-${meth}`;
|
|
285
|
+
log.trace(origin);
|
|
286
|
+
|
|
287
|
+
try {
|
|
288
|
+
return super.iapMoveAdapterEntitiesToDB(callback);
|
|
289
|
+
} catch (err) {
|
|
290
|
+
log.error(`${origin}: ${err}`);
|
|
291
|
+
return callback(null, err);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
/* BROKER CALLS */
|
|
296
|
+
/**
|
|
297
|
+
* @summary Determines if this adapter supports the specific entity
|
|
298
|
+
*
|
|
299
|
+
* @function iapHasAdapterEntity
|
|
300
|
+
* @param {String} entityType - the entity type to check for
|
|
301
|
+
* @param {String/Array} entityId - the specific entity we are looking for
|
|
302
|
+
*
|
|
303
|
+
* @param {Callback} callback - An array of whether the adapter can has the
|
|
304
|
+
* desired capability or an error
|
|
305
|
+
*/
|
|
306
|
+
iapHasAdapterEntity(entityType, entityId, callback) {
|
|
307
|
+
const origin = `${this.id}-adapter-iapHasAdapterEntity`;
|
|
308
|
+
log.trace(origin);
|
|
309
|
+
|
|
310
|
+
// Make the call -
|
|
311
|
+
// iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
|
|
312
|
+
return this.iapVerifyAdapterCapability(entityType, null, entityId, callback);
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @summary Provides a way for the adapter to tell north bound integrations
|
|
317
|
+
* whether the adapter supports type, action and specific entity
|
|
318
|
+
*
|
|
319
|
+
* @function iapVerifyAdapterCapability
|
|
320
|
+
* @param {String} entityType - the entity type to check for
|
|
321
|
+
* @param {String} actionType - the action type to check for
|
|
322
|
+
* @param {String/Array} entityId - the specific entity we are looking for
|
|
323
|
+
*
|
|
324
|
+
* @param {Callback} callback - An array of whether the adapter can has the
|
|
325
|
+
* desired capability or an error
|
|
326
|
+
*/
|
|
327
|
+
iapVerifyAdapterCapability(entityType, actionType, entityId, callback) {
|
|
328
|
+
const meth = 'adapterBase-iapVerifyAdapterCapability';
|
|
329
|
+
const origin = `${this.id}-${meth}`;
|
|
330
|
+
log.trace(origin);
|
|
331
|
+
|
|
332
|
+
// if caching
|
|
333
|
+
if (this.caching) {
|
|
334
|
+
// Make the call - iapVerifyAdapterCapability(entityType, actionType, entityId, callback)
|
|
335
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (results, error) => {
|
|
336
|
+
if (error) {
|
|
337
|
+
return callback(null, error);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// if the cache needs to be updated, update and try again
|
|
341
|
+
if (results && results[0] === 'needupdate') {
|
|
342
|
+
switch (entityType) {
|
|
343
|
+
case 'template_entity': {
|
|
344
|
+
// if the cache is invalid, update the cache
|
|
345
|
+
return this.getEntities(null, null, null, null, (data, err) => {
|
|
346
|
+
if (err) {
|
|
347
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
|
|
348
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
349
|
+
return callback(null, errorObj);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// need to check the cache again since it has been updated
|
|
353
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, entityId, (vcapable, verror) => {
|
|
354
|
+
if (verror) {
|
|
355
|
+
return callback(null, verror);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
return this.capabilityResults(vcapable, callback);
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
default: {
|
|
363
|
+
// unsupported entity type
|
|
364
|
+
const result = [false];
|
|
365
|
+
|
|
366
|
+
// put false in array for all entities
|
|
367
|
+
if (Array.isArray(entityId)) {
|
|
368
|
+
for (let e = 1; e < entityId.length; e += 1) {
|
|
369
|
+
result.push(false);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
return callback(result);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// return the results
|
|
379
|
+
return this.capabilityResults(results, callback);
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
// if no entity id
|
|
384
|
+
if (!entityId) {
|
|
385
|
+
// need to check the cache again since it has been updated
|
|
386
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
|
|
387
|
+
if (verror) {
|
|
388
|
+
return callback(null, verror);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
return this.capabilityResults(vcapable, callback);
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
// if not caching
|
|
396
|
+
switch (entityType) {
|
|
397
|
+
case 'template_entity': {
|
|
398
|
+
// need to get the entities to check
|
|
399
|
+
return this.getEntities(null, null, null, null, (data, err) => {
|
|
400
|
+
if (err) {
|
|
401
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Could not update entity: $VARIABLE$, cache', [entityType], null, null, null);
|
|
402
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
403
|
+
return callback(null, errorObj);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
// need to check the cache again since it has been updated
|
|
407
|
+
return this.requestHandlerInst.iapVerifyAdapterCapability(entityType, actionType, null, (vcapable, verror) => {
|
|
408
|
+
if (verror) {
|
|
409
|
+
return callback(null, verror);
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
// is the entity in the list?
|
|
413
|
+
const isEntity = this.entityInList(entityId, data.response, callback);
|
|
414
|
+
const res = [];
|
|
415
|
+
|
|
416
|
+
// not found
|
|
417
|
+
for (let i = 0; i < isEntity.length; i += 1) {
|
|
418
|
+
if (vcapable) {
|
|
419
|
+
res.push(isEntity[i]);
|
|
420
|
+
} else {
|
|
421
|
+
res.push(false);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
return callback(res);
|
|
426
|
+
});
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
default: {
|
|
430
|
+
// unsupported entity type
|
|
431
|
+
const result = [false];
|
|
432
|
+
|
|
433
|
+
// put false in array for all entities
|
|
434
|
+
if (Array.isArray(entityId)) {
|
|
435
|
+
for (let e = 1; e < entityId.length; e += 1) {
|
|
436
|
+
result.push(false);
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
return callback(result);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* @summary Updates the cache for all entities by call the get All entity method
|
|
447
|
+
*
|
|
448
|
+
* @function iapUpdateAdapterEntityCache
|
|
449
|
+
*
|
|
450
|
+
*/
|
|
451
|
+
iapUpdateAdapterEntityCache() {
|
|
452
|
+
const origin = `${this.id}-adapter-iapUpdateAdapterEntityCache`;
|
|
453
|
+
log.trace(origin);
|
|
454
|
+
|
|
455
|
+
if (this.caching) {
|
|
456
|
+
// if the cache is invalid, update the cache
|
|
457
|
+
this.getEntities(null, null, null, null, (data, err) => {
|
|
458
|
+
if (err) {
|
|
459
|
+
log.trace(`${origin}: Could not load template_entity into cache - ${err}`);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* @summary Determines if this adapter supports any in a list of entities
|
|
467
|
+
*
|
|
468
|
+
* @function hasEntities
|
|
469
|
+
* @param {String} entityType - the entity type to check for
|
|
470
|
+
* @param {Array} entityList - the list of entities we are looking for
|
|
471
|
+
*
|
|
472
|
+
* @param {Callback} callback - A map where the entity is the key and the
|
|
473
|
+
* value is true or false
|
|
474
|
+
*/
|
|
475
|
+
hasEntities(entityType, entityList, callback) {
|
|
476
|
+
const meth = 'adapter-hasEntities';
|
|
477
|
+
const origin = `${this.id}-${meth}`;
|
|
478
|
+
log.trace(origin);
|
|
479
|
+
|
|
480
|
+
try {
|
|
481
|
+
return super.hasEntities(entityType, entityList, callback);
|
|
482
|
+
} catch (err) {
|
|
483
|
+
log.error(`${origin}: ${err}`);
|
|
484
|
+
return callback(null, err);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* @summary Get Appliance that match the deviceName
|
|
490
|
+
*
|
|
491
|
+
* @function getDevice
|
|
492
|
+
* @param {String} deviceName - the deviceName to find (required)
|
|
493
|
+
*
|
|
494
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
495
|
+
* (appliance) or the error
|
|
496
|
+
*/
|
|
497
|
+
getDevice(deviceName, callback) {
|
|
498
|
+
const meth = 'adapter-getDevice';
|
|
499
|
+
const origin = `${this.id}-${meth}`;
|
|
500
|
+
log.trace(origin);
|
|
501
|
+
|
|
502
|
+
try {
|
|
503
|
+
return super.getDevice(deviceName, callback);
|
|
504
|
+
} catch (err) {
|
|
505
|
+
log.error(`${origin}: ${err}`);
|
|
506
|
+
return callback(null, err);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* @summary Get Appliances that match the filter
|
|
512
|
+
*
|
|
513
|
+
* @function getDevicesFiltered
|
|
514
|
+
* @param {Object} options - the data to use to filter the appliances (optional)
|
|
515
|
+
*
|
|
516
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
517
|
+
* (appliances) or the error
|
|
518
|
+
*/
|
|
519
|
+
getDevicesFiltered(options, callback) {
|
|
520
|
+
const meth = 'adapter-getDevicesFiltered';
|
|
521
|
+
const origin = `${this.id}-${meth}`;
|
|
522
|
+
log.trace(origin);
|
|
523
|
+
|
|
524
|
+
try {
|
|
525
|
+
return super.getDevicesFiltered(options, callback);
|
|
526
|
+
} catch (err) {
|
|
527
|
+
log.error(`${origin}: ${err}`);
|
|
528
|
+
return callback(null, err);
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* @summary Gets the status for the provided appliance
|
|
534
|
+
*
|
|
535
|
+
* @function isAlive
|
|
536
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
537
|
+
*
|
|
538
|
+
* @param {configCallback} callback - callback function to return the result
|
|
539
|
+
* (appliance isAlive) or the error
|
|
540
|
+
*/
|
|
541
|
+
isAlive(deviceName, callback) {
|
|
542
|
+
const meth = 'adapter-isAlive';
|
|
543
|
+
const origin = `${this.id}-${meth}`;
|
|
544
|
+
log.trace(origin);
|
|
545
|
+
|
|
546
|
+
try {
|
|
547
|
+
return super.isAlive(deviceName, callback);
|
|
548
|
+
} catch (err) {
|
|
549
|
+
log.error(`${origin}: ${err}`);
|
|
550
|
+
return callback(null, err);
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
/**
|
|
555
|
+
* @summary Gets a config for the provided Appliance
|
|
556
|
+
*
|
|
557
|
+
* @function getConfig
|
|
558
|
+
* @param {String} deviceName - the deviceName of the appliance. (required)
|
|
559
|
+
* @param {String} format - the desired format of the config. (optional)
|
|
560
|
+
*
|
|
561
|
+
* @param {configCallback} callback - callback function to return the result
|
|
562
|
+
* (appliance config) or the error
|
|
563
|
+
*/
|
|
564
|
+
getConfig(deviceName, format, callback) {
|
|
565
|
+
const meth = 'adapter-getConfig';
|
|
566
|
+
const origin = `${this.id}-${meth}`;
|
|
567
|
+
log.trace(origin);
|
|
568
|
+
|
|
569
|
+
try {
|
|
570
|
+
return super.getConfig(deviceName, format, callback);
|
|
571
|
+
} catch (err) {
|
|
572
|
+
log.error(`${origin}: ${err}`);
|
|
573
|
+
return callback(null, err);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* @summary Gets the device count from the system
|
|
579
|
+
*
|
|
580
|
+
* @function iapGetDeviceCount
|
|
581
|
+
*
|
|
582
|
+
* @param {getCallback} callback - callback function to return the result
|
|
583
|
+
* (count) or the error
|
|
584
|
+
*/
|
|
585
|
+
iapGetDeviceCount(callback) {
|
|
586
|
+
const meth = 'adapter-iapGetDeviceCount';
|
|
587
|
+
const origin = `${this.id}-${meth}`;
|
|
588
|
+
log.trace(origin);
|
|
589
|
+
|
|
590
|
+
try {
|
|
591
|
+
return super.iapGetDeviceCount(callback);
|
|
592
|
+
} catch (err) {
|
|
593
|
+
log.error(`${origin}: ${err}`);
|
|
594
|
+
return callback(null, err);
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/* GENERIC ADAPTER REQUEST - allows extension of adapter without new calls being added */
|
|
599
|
+
/**
|
|
600
|
+
* Makes the requested generic call
|
|
601
|
+
*
|
|
602
|
+
* @function genericAdapterRequest
|
|
603
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
|
|
604
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
|
|
605
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
606
|
+
* Can be a stringified Object.
|
|
607
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
608
|
+
* Can be a stringified Object.
|
|
609
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
610
|
+
* Can be a stringified Object.
|
|
611
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
612
|
+
* or the error
|
|
613
|
+
*/
|
|
614
|
+
genericAdapterRequest(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
|
|
615
|
+
const meth = 'adapter-genericAdapterRequest';
|
|
616
|
+
const origin = `${this.id}-${meth}`;
|
|
617
|
+
log.trace(origin);
|
|
618
|
+
|
|
619
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
620
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
621
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
622
|
+
return callback(null, errorObj);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
626
|
+
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
627
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
628
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
629
|
+
return callback(null, errorObj);
|
|
630
|
+
}
|
|
631
|
+
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
632
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
633
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
634
|
+
return callback(null, errorObj);
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
638
|
+
// remove any leading / and split the uripath into path variables
|
|
639
|
+
let myPath = uriPath;
|
|
640
|
+
while (myPath.indexOf('/') === 0) {
|
|
641
|
+
myPath = myPath.substring(1);
|
|
642
|
+
}
|
|
643
|
+
const pathVars = myPath.split('/');
|
|
644
|
+
const queryParamsAvailable = queryData;
|
|
645
|
+
const queryParams = {};
|
|
646
|
+
const bodyVars = requestBody;
|
|
647
|
+
|
|
648
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
649
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
650
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
651
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
652
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
653
|
+
}
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
657
|
+
const reqObj = {
|
|
658
|
+
payload: bodyVars,
|
|
659
|
+
uriPathVars: pathVars,
|
|
660
|
+
uriQuery: queryParams,
|
|
661
|
+
uriOptions: {}
|
|
662
|
+
};
|
|
663
|
+
// add headers if provided
|
|
664
|
+
if (addlHeaders) {
|
|
665
|
+
reqObj.addlHeaders = addlHeaders;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
// determine the call and return flag
|
|
669
|
+
let action = 'getGenerics';
|
|
670
|
+
let returnF = true;
|
|
671
|
+
if (restMethod.toUpperCase() === 'POST') {
|
|
672
|
+
action = 'createGeneric';
|
|
673
|
+
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
674
|
+
action = 'updateGeneric';
|
|
675
|
+
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
676
|
+
action = 'patchGeneric';
|
|
677
|
+
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
678
|
+
action = 'deleteGeneric';
|
|
679
|
+
returnF = false;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
try {
|
|
683
|
+
// Make the call -
|
|
684
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
685
|
+
return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
|
|
686
|
+
// if we received an error or their is no response on the results
|
|
687
|
+
// return an error
|
|
688
|
+
if (irReturnError) {
|
|
689
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
690
|
+
return callback(null, irReturnError);
|
|
691
|
+
}
|
|
692
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
693
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequest'], null, null, null);
|
|
694
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
695
|
+
return callback(null, errorObj);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
699
|
+
// return the response
|
|
700
|
+
return callback(irReturnData, null);
|
|
701
|
+
});
|
|
702
|
+
} catch (ex) {
|
|
703
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
704
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
705
|
+
return callback(null, errorObj);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* Makes the requested generic call with no base path or version
|
|
711
|
+
*
|
|
712
|
+
* @function genericAdapterRequestNoBasePath
|
|
713
|
+
* @param {String} uriPath - the path of the api call - do not include the host, port, base path or version (required)
|
|
714
|
+
* @param {String} restMethod - the rest method (GET, POST, PUT, PATCH, DELETE) (required)
|
|
715
|
+
* @param {Object} queryData - the parameters to be put on the url (optional).
|
|
716
|
+
* Can be a stringified Object.
|
|
717
|
+
* @param {Object} requestBody - the body to add to the request (optional).
|
|
718
|
+
* Can be a stringified Object.
|
|
719
|
+
* @param {Object} addlHeaders - additional headers to be put on the call (optional).
|
|
720
|
+
* Can be a stringified Object.
|
|
721
|
+
* @param {getCallback} callback - a callback function to return the result (Generics)
|
|
722
|
+
* or the error
|
|
723
|
+
*/
|
|
724
|
+
genericAdapterRequestNoBasePath(uriPath, restMethod, queryData, requestBody, addlHeaders, callback) {
|
|
725
|
+
const meth = 'adapter-genericAdapterRequestNoBasePath';
|
|
726
|
+
const origin = `${this.id}-${meth}`;
|
|
727
|
+
log.trace(origin);
|
|
728
|
+
|
|
729
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
730
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
731
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
732
|
+
return callback(null, errorObj);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
736
|
+
if (uriPath === undefined || uriPath === null || uriPath === '') {
|
|
737
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['uriPath'], null, null, null);
|
|
738
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
739
|
+
return callback(null, errorObj);
|
|
740
|
+
}
|
|
741
|
+
if (restMethod === undefined || restMethod === null || restMethod === '') {
|
|
742
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['restMethod'], null, null, null);
|
|
743
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
744
|
+
return callback(null, errorObj);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
748
|
+
// remove any leading / and split the uripath into path variables
|
|
749
|
+
let myPath = uriPath;
|
|
750
|
+
while (myPath.indexOf('/') === 0) {
|
|
751
|
+
myPath = myPath.substring(1);
|
|
752
|
+
}
|
|
753
|
+
const pathVars = myPath.split('/');
|
|
754
|
+
const queryParamsAvailable = queryData;
|
|
755
|
+
const queryParams = {};
|
|
756
|
+
const bodyVars = requestBody;
|
|
757
|
+
|
|
758
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
759
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
760
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
761
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
762
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders
|
|
767
|
+
const reqObj = {
|
|
768
|
+
payload: bodyVars,
|
|
769
|
+
uriPathVars: pathVars,
|
|
770
|
+
uriQuery: queryParams,
|
|
771
|
+
uriOptions: {}
|
|
772
|
+
};
|
|
773
|
+
// add headers if provided
|
|
774
|
+
if (addlHeaders) {
|
|
775
|
+
reqObj.addlHeaders = addlHeaders;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
// determine the call and return flag
|
|
779
|
+
let action = 'getGenericsNoBase';
|
|
780
|
+
let returnF = true;
|
|
781
|
+
if (restMethod.toUpperCase() === 'POST') {
|
|
782
|
+
action = 'createGenericNoBase';
|
|
783
|
+
} else if (restMethod.toUpperCase() === 'PUT') {
|
|
784
|
+
action = 'updateGenericNoBase';
|
|
785
|
+
} else if (restMethod.toUpperCase() === 'PATCH') {
|
|
786
|
+
action = 'patchGenericNoBase';
|
|
787
|
+
} else if (restMethod.toUpperCase() === 'DELETE') {
|
|
788
|
+
action = 'deleteGenericNoBase';
|
|
789
|
+
returnF = false;
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
try {
|
|
793
|
+
// Make the call -
|
|
794
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
795
|
+
return this.requestHandlerInst.identifyRequest('.generic', action, reqObj, returnF, (irReturnData, irReturnError) => {
|
|
796
|
+
// if we received an error or their is no response on the results
|
|
797
|
+
// return an error
|
|
798
|
+
if (irReturnError) {
|
|
799
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
800
|
+
return callback(null, irReturnError);
|
|
801
|
+
}
|
|
802
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
803
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['genericAdapterRequestNoBasePath'], null, null, null);
|
|
804
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
805
|
+
return callback(null, errorObj);
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
809
|
+
// return the response
|
|
810
|
+
return callback(irReturnData, null);
|
|
811
|
+
});
|
|
812
|
+
} catch (ex) {
|
|
813
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
814
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
815
|
+
return callback(null, errorObj);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* @callback healthCallback
|
|
821
|
+
* @param {Object} result - the result of the get request (contains an id and a status)
|
|
822
|
+
*/
|
|
823
|
+
/**
|
|
824
|
+
* @callback getCallback
|
|
825
|
+
* @param {Object} result - the result of the get request (entity/ies)
|
|
826
|
+
* @param {String} error - any error that occurred
|
|
827
|
+
*/
|
|
828
|
+
/**
|
|
829
|
+
* @callback createCallback
|
|
830
|
+
* @param {Object} item - the newly created entity
|
|
831
|
+
* @param {String} error - any error that occurred
|
|
832
|
+
*/
|
|
833
|
+
/**
|
|
834
|
+
* @callback updateCallback
|
|
835
|
+
* @param {String} status - the status of the update action
|
|
836
|
+
* @param {String} error - any error that occurred
|
|
837
|
+
*/
|
|
838
|
+
/**
|
|
839
|
+
* @callback deleteCallback
|
|
840
|
+
* @param {String} status - the status of the delete action
|
|
841
|
+
* @param {String} error - any error that occurred
|
|
842
|
+
*/
|
|
843
|
+
|
|
844
|
+
/**
|
|
845
|
+
* @function getCardSlotsUsingGET
|
|
846
|
+
* @pronghornType method
|
|
847
|
+
* @name getCardSlotsUsingGET
|
|
848
|
+
* @summary getCardSlotsUsingGET
|
|
849
|
+
*
|
|
850
|
+
* @param {string} [fdns] - A comma-separated list of the Fully Distinguished Names of the NSP objects to query for.
|
|
851
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
852
|
+
|
|
853
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
854
|
+
* @param {number} [limit] - The limit on the number of objects returned (max: 1000)
|
|
855
|
+
* @param {number} [offset] - Start row for paged data (max: total number of objects)
|
|
856
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
857
|
+
* @return {object} results - An object containing the response of the action
|
|
858
|
+
*
|
|
859
|
+
* @route {POST} /getCardSlotsUsingGET
|
|
860
|
+
* @roles admin
|
|
861
|
+
* @task true
|
|
862
|
+
*/
|
|
863
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
864
|
+
getCardSlotsUsingGET(fdns, filter, limit, offset, callback) {
|
|
865
|
+
const meth = 'adapter-getCardSlotsUsingGET';
|
|
866
|
+
const origin = `${this.id}-${meth}`;
|
|
867
|
+
log.trace(origin);
|
|
868
|
+
|
|
869
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
870
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
871
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
872
|
+
return callback(null, errorObj);
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
876
|
+
|
|
877
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
878
|
+
const queryParamsAvailable = { fdns, filter, limit, offset };
|
|
879
|
+
const queryParams = {};
|
|
880
|
+
const pathVars = [];
|
|
881
|
+
const bodyVars = {};
|
|
882
|
+
|
|
883
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
884
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
885
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
886
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
887
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
|
|
891
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
892
|
+
// see adapter code documentation for more information on the request object's fields
|
|
893
|
+
const reqObj = {
|
|
894
|
+
payload: bodyVars,
|
|
895
|
+
uriPathVars: pathVars,
|
|
896
|
+
uriQuery: queryParams
|
|
897
|
+
};
|
|
898
|
+
|
|
899
|
+
try {
|
|
900
|
+
// Make the call -
|
|
901
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
902
|
+
return this.requestHandlerInst.identifyRequest('CardSlots', 'getCardSlotsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
903
|
+
// if we received an error or their is no response on the results
|
|
904
|
+
// return an error
|
|
905
|
+
if (irReturnError) {
|
|
906
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
907
|
+
return callback(null, irReturnError);
|
|
908
|
+
}
|
|
909
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
910
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getCardSlotsUsingGET'], null, null, null);
|
|
911
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
912
|
+
return callback(null, errorObj);
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
916
|
+
// return the response
|
|
917
|
+
return callback(irReturnData, null);
|
|
918
|
+
});
|
|
919
|
+
} catch (ex) {
|
|
920
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
921
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
922
|
+
return callback(null, errorObj);
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* @function getCardSlotUsingGET
|
|
928
|
+
* @pronghornType method
|
|
929
|
+
* @name getCardSlotUsingGET
|
|
930
|
+
* @summary getCardSlotUsingGET
|
|
931
|
+
*
|
|
932
|
+
* @param {string} cardSlotFdn - cardSlotFdn
|
|
933
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
934
|
+
* @return {object} results - An object containing the response of the action
|
|
935
|
+
*
|
|
936
|
+
* @route {POST} /getCardSlotUsingGET
|
|
937
|
+
* @roles admin
|
|
938
|
+
* @task true
|
|
939
|
+
*/
|
|
940
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
941
|
+
getCardSlotUsingGET(cardSlotFdn, callback) {
|
|
942
|
+
const meth = 'adapter-getCardSlotUsingGET';
|
|
943
|
+
const origin = `${this.id}-${meth}`;
|
|
944
|
+
log.trace(origin);
|
|
945
|
+
|
|
946
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
947
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
948
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
949
|
+
return callback(null, errorObj);
|
|
950
|
+
}
|
|
951
|
+
|
|
952
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
953
|
+
if (cardSlotFdn === undefined || cardSlotFdn === null || cardSlotFdn === '') {
|
|
954
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['cardSlotFdn'], null, null, null);
|
|
955
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
956
|
+
return callback(null, errorObj);
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
960
|
+
const queryParamsAvailable = {};
|
|
961
|
+
const queryParams = {};
|
|
962
|
+
const pathVars = [cardSlotFdn];
|
|
963
|
+
const bodyVars = {};
|
|
964
|
+
|
|
965
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
966
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
967
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
968
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
969
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
970
|
+
}
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
974
|
+
// see adapter code documentation for more information on the request object's fields
|
|
975
|
+
const reqObj = {
|
|
976
|
+
payload: bodyVars,
|
|
977
|
+
uriPathVars: pathVars,
|
|
978
|
+
uriQuery: queryParams
|
|
979
|
+
};
|
|
980
|
+
|
|
981
|
+
try {
|
|
982
|
+
// Make the call -
|
|
983
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
984
|
+
return this.requestHandlerInst.identifyRequest('CardSlots', 'getCardSlotUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
985
|
+
// if we received an error or their is no response on the results
|
|
986
|
+
// return an error
|
|
987
|
+
if (irReturnError) {
|
|
988
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
989
|
+
return callback(null, irReturnError);
|
|
990
|
+
}
|
|
991
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
992
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getCardSlotUsingGET'], null, null, null);
|
|
993
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
994
|
+
return callback(null, errorObj);
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
998
|
+
// return the response
|
|
999
|
+
return callback(irReturnData, null);
|
|
1000
|
+
});
|
|
1001
|
+
} catch (ex) {
|
|
1002
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1003
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1004
|
+
return callback(null, errorObj);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
/**
|
|
1009
|
+
* @function getCardsUsingGET
|
|
1010
|
+
* @pronghornType method
|
|
1011
|
+
* @name getCardsUsingGET
|
|
1012
|
+
* @summary getCardsUsingGET
|
|
1013
|
+
*
|
|
1014
|
+
* @param {string} [fdns] - A comma-separated list of the Fully Distinguished Names of the NSP objects to query for.
|
|
1015
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
1016
|
+
|
|
1017
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
1018
|
+
* @param {number} [limit] - The limit on the number of objects returned (max: 1000)
|
|
1019
|
+
* @param {number} [offset] - Start row for paged data (max: total number of objects)
|
|
1020
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1021
|
+
* @return {object} results - An object containing the response of the action
|
|
1022
|
+
*
|
|
1023
|
+
* @route {POST} /getCardsUsingGET
|
|
1024
|
+
* @roles admin
|
|
1025
|
+
* @task true
|
|
1026
|
+
*/
|
|
1027
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1028
|
+
getCardsUsingGET(fdns, filter, limit, offset, callback) {
|
|
1029
|
+
const meth = 'adapter-getCardsUsingGET';
|
|
1030
|
+
const origin = `${this.id}-${meth}`;
|
|
1031
|
+
log.trace(origin);
|
|
1032
|
+
|
|
1033
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1034
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1035
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1036
|
+
return callback(null, errorObj);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1039
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1040
|
+
|
|
1041
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1042
|
+
const queryParamsAvailable = { fdns, filter, limit, offset };
|
|
1043
|
+
const queryParams = {};
|
|
1044
|
+
const pathVars = [];
|
|
1045
|
+
const bodyVars = {};
|
|
1046
|
+
|
|
1047
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1048
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1049
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1050
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1051
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
|
|
1055
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1056
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1057
|
+
const reqObj = {
|
|
1058
|
+
payload: bodyVars,
|
|
1059
|
+
uriPathVars: pathVars,
|
|
1060
|
+
uriQuery: queryParams
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1063
|
+
try {
|
|
1064
|
+
// Make the call -
|
|
1065
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1066
|
+
return this.requestHandlerInst.identifyRequest('Cards', 'getCardsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1067
|
+
// if we received an error or their is no response on the results
|
|
1068
|
+
// return an error
|
|
1069
|
+
if (irReturnError) {
|
|
1070
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1071
|
+
return callback(null, irReturnError);
|
|
1072
|
+
}
|
|
1073
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1074
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getCardsUsingGET'], null, null, null);
|
|
1075
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1076
|
+
return callback(null, errorObj);
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1080
|
+
// return the response
|
|
1081
|
+
return callback(irReturnData, null);
|
|
1082
|
+
});
|
|
1083
|
+
} catch (ex) {
|
|
1084
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1085
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1086
|
+
return callback(null, errorObj);
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
/**
|
|
1091
|
+
* @function getCardUsingGET
|
|
1092
|
+
* @pronghornType method
|
|
1093
|
+
* @name getCardUsingGET
|
|
1094
|
+
* @summary getCardUsingGET
|
|
1095
|
+
*
|
|
1096
|
+
* @param {string} cardFdn - cardFdn
|
|
1097
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1098
|
+
* @return {object} results - An object containing the response of the action
|
|
1099
|
+
*
|
|
1100
|
+
* @route {POST} /getCardUsingGET
|
|
1101
|
+
* @roles admin
|
|
1102
|
+
* @task true
|
|
1103
|
+
*/
|
|
1104
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1105
|
+
getCardUsingGET(cardFdn, callback) {
|
|
1106
|
+
const meth = 'adapter-getCardUsingGET';
|
|
1107
|
+
const origin = `${this.id}-${meth}`;
|
|
1108
|
+
log.trace(origin);
|
|
1109
|
+
|
|
1110
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1111
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1112
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1113
|
+
return callback(null, errorObj);
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1117
|
+
if (cardFdn === undefined || cardFdn === null || cardFdn === '') {
|
|
1118
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['cardFdn'], null, null, null);
|
|
1119
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1120
|
+
return callback(null, errorObj);
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1124
|
+
const queryParamsAvailable = {};
|
|
1125
|
+
const queryParams = {};
|
|
1126
|
+
const pathVars = [cardFdn];
|
|
1127
|
+
const bodyVars = {};
|
|
1128
|
+
|
|
1129
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1130
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1131
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1132
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1133
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
|
|
1137
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1138
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1139
|
+
const reqObj = {
|
|
1140
|
+
payload: bodyVars,
|
|
1141
|
+
uriPathVars: pathVars,
|
|
1142
|
+
uriQuery: queryParams
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
try {
|
|
1146
|
+
// Make the call -
|
|
1147
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1148
|
+
return this.requestHandlerInst.identifyRequest('Cards', 'getCardUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1149
|
+
// if we received an error or their is no response on the results
|
|
1150
|
+
// return an error
|
|
1151
|
+
if (irReturnError) {
|
|
1152
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1153
|
+
return callback(null, irReturnError);
|
|
1154
|
+
}
|
|
1155
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1156
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getCardUsingGET'], null, null, null);
|
|
1157
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1158
|
+
return callback(null, errorObj);
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1162
|
+
// return the response
|
|
1163
|
+
return callback(irReturnData, null);
|
|
1164
|
+
});
|
|
1165
|
+
} catch (ex) {
|
|
1166
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1167
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1168
|
+
return callback(null, errorObj);
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* @function getLAGsUsingGET
|
|
1174
|
+
* @pronghornType method
|
|
1175
|
+
* @name getLAGsUsingGET
|
|
1176
|
+
* @summary getLAGsUsingGET
|
|
1177
|
+
*
|
|
1178
|
+
* @param {string} [fdns] - A comma-separated list of the Fully Distinguished Names of the NSP objects to query for.
|
|
1179
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
1180
|
+
|
|
1181
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
1182
|
+
* @param {number} [limit] - The limit on the number of objects returned (max: 1000)
|
|
1183
|
+
* @param {number} [offset] - Start row for paged data (max: total number of objects)
|
|
1184
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1185
|
+
* @return {object} results - An object containing the response of the action
|
|
1186
|
+
*
|
|
1187
|
+
* @route {POST} /getLAGsUsingGET
|
|
1188
|
+
* @roles admin
|
|
1189
|
+
* @task true
|
|
1190
|
+
*/
|
|
1191
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1192
|
+
getLAGsUsingGET(fdns, filter, limit, offset, callback) {
|
|
1193
|
+
const meth = 'adapter-getLAGsUsingGET';
|
|
1194
|
+
const origin = `${this.id}-${meth}`;
|
|
1195
|
+
log.trace(origin);
|
|
1196
|
+
|
|
1197
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1198
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1199
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1200
|
+
return callback(null, errorObj);
|
|
1201
|
+
}
|
|
1202
|
+
|
|
1203
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1204
|
+
|
|
1205
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1206
|
+
const queryParamsAvailable = { fdns, filter, limit, offset };
|
|
1207
|
+
const queryParams = {};
|
|
1208
|
+
const pathVars = [];
|
|
1209
|
+
const bodyVars = {};
|
|
1210
|
+
|
|
1211
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1212
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1213
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1214
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1215
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1216
|
+
}
|
|
1217
|
+
});
|
|
1218
|
+
|
|
1219
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1220
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1221
|
+
const reqObj = {
|
|
1222
|
+
payload: bodyVars,
|
|
1223
|
+
uriPathVars: pathVars,
|
|
1224
|
+
uriQuery: queryParams
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1227
|
+
try {
|
|
1228
|
+
// Make the call -
|
|
1229
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1230
|
+
return this.requestHandlerInst.identifyRequest('Lags', 'getLAGsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1231
|
+
// if we received an error or their is no response on the results
|
|
1232
|
+
// return an error
|
|
1233
|
+
if (irReturnError) {
|
|
1234
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1235
|
+
return callback(null, irReturnError);
|
|
1236
|
+
}
|
|
1237
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1238
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getLAGsUsingGET'], null, null, null);
|
|
1239
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1240
|
+
return callback(null, errorObj);
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1244
|
+
// return the response
|
|
1245
|
+
return callback(irReturnData, null);
|
|
1246
|
+
});
|
|
1247
|
+
} catch (ex) {
|
|
1248
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1249
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1250
|
+
return callback(null, errorObj);
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* @function getLAGUsingGET
|
|
1256
|
+
* @pronghornType method
|
|
1257
|
+
* @name getLAGUsingGET
|
|
1258
|
+
* @summary getLAGUsingGET
|
|
1259
|
+
*
|
|
1260
|
+
* @param {string} lagFdn - lagFdn
|
|
1261
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1262
|
+
* @return {object} results - An object containing the response of the action
|
|
1263
|
+
*
|
|
1264
|
+
* @route {POST} /getLAGUsingGET
|
|
1265
|
+
* @roles admin
|
|
1266
|
+
* @task true
|
|
1267
|
+
*/
|
|
1268
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1269
|
+
getLAGUsingGET(lagFdn, callback) {
|
|
1270
|
+
const meth = 'adapter-getLAGUsingGET';
|
|
1271
|
+
const origin = `${this.id}-${meth}`;
|
|
1272
|
+
log.trace(origin);
|
|
1273
|
+
|
|
1274
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1275
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1276
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1277
|
+
return callback(null, errorObj);
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1280
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1281
|
+
if (lagFdn === undefined || lagFdn === null || lagFdn === '') {
|
|
1282
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['lagFdn'], null, null, null);
|
|
1283
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1284
|
+
return callback(null, errorObj);
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1288
|
+
const queryParamsAvailable = {};
|
|
1289
|
+
const queryParams = {};
|
|
1290
|
+
const pathVars = [lagFdn];
|
|
1291
|
+
const bodyVars = {};
|
|
1292
|
+
|
|
1293
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1294
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1295
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1296
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1297
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1298
|
+
}
|
|
1299
|
+
});
|
|
1300
|
+
|
|
1301
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1302
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1303
|
+
const reqObj = {
|
|
1304
|
+
payload: bodyVars,
|
|
1305
|
+
uriPathVars: pathVars,
|
|
1306
|
+
uriQuery: queryParams
|
|
1307
|
+
};
|
|
1308
|
+
|
|
1309
|
+
try {
|
|
1310
|
+
// Make the call -
|
|
1311
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1312
|
+
return this.requestHandlerInst.identifyRequest('Lags', 'getLAGUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1313
|
+
// if we received an error or their is no response on the results
|
|
1314
|
+
// return an error
|
|
1315
|
+
if (irReturnError) {
|
|
1316
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1317
|
+
return callback(null, irReturnError);
|
|
1318
|
+
}
|
|
1319
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1320
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getLAGUsingGET'], null, null, null);
|
|
1321
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1322
|
+
return callback(null, errorObj);
|
|
1323
|
+
}
|
|
1324
|
+
|
|
1325
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1326
|
+
// return the response
|
|
1327
|
+
return callback(irReturnData, null);
|
|
1328
|
+
});
|
|
1329
|
+
} catch (ex) {
|
|
1330
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1331
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1332
|
+
return callback(null, errorObj);
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
/**
|
|
1337
|
+
* @function getNEsUsingGET
|
|
1338
|
+
* @pronghornType method
|
|
1339
|
+
* @name getNEsUsingGET
|
|
1340
|
+
* @summary getNEsUsingGET
|
|
1341
|
+
*
|
|
1342
|
+
* @param {string} [fdns] - A comma-separated list of the Fully Distinguished Names of the NSP objects to query for.
|
|
1343
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
1344
|
+
|
|
1345
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
1346
|
+
* @param {number} [limit] - The limit on the number of objects returned (max: 1000)
|
|
1347
|
+
* @param {number} [offset] - Start row for paged data (max: total number of objects)
|
|
1348
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1349
|
+
* @return {object} results - An object containing the response of the action
|
|
1350
|
+
*
|
|
1351
|
+
* @route {POST} /getNEsUsingGET
|
|
1352
|
+
* @roles admin
|
|
1353
|
+
* @task true
|
|
1354
|
+
*/
|
|
1355
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1356
|
+
getNEsUsingGET(fdns, filter, limit, offset, callback) {
|
|
1357
|
+
const meth = 'adapter-getNEsUsingGET';
|
|
1358
|
+
const origin = `${this.id}-${meth}`;
|
|
1359
|
+
log.trace(origin);
|
|
1360
|
+
|
|
1361
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1362
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1363
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1364
|
+
return callback(null, errorObj);
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1368
|
+
|
|
1369
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1370
|
+
const queryParamsAvailable = { fdns, filter, limit, offset };
|
|
1371
|
+
const queryParams = {};
|
|
1372
|
+
const pathVars = [];
|
|
1373
|
+
const bodyVars = {};
|
|
1374
|
+
|
|
1375
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1376
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1377
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1378
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1379
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1380
|
+
}
|
|
1381
|
+
});
|
|
1382
|
+
|
|
1383
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1384
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1385
|
+
const reqObj = {
|
|
1386
|
+
payload: bodyVars,
|
|
1387
|
+
uriPathVars: pathVars,
|
|
1388
|
+
uriQuery: queryParams
|
|
1389
|
+
};
|
|
1390
|
+
|
|
1391
|
+
try {
|
|
1392
|
+
// Make the call -
|
|
1393
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1394
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getNEsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1395
|
+
// if we received an error or their is no response on the results
|
|
1396
|
+
// return an error
|
|
1397
|
+
if (irReturnError) {
|
|
1398
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1399
|
+
return callback(null, irReturnError);
|
|
1400
|
+
}
|
|
1401
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1402
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getNEsUsingGET'], null, null, null);
|
|
1403
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1404
|
+
return callback(null, errorObj);
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1408
|
+
// return the response
|
|
1409
|
+
return callback(irReturnData, null);
|
|
1410
|
+
});
|
|
1411
|
+
} catch (ex) {
|
|
1412
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1413
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1414
|
+
return callback(null, errorObj);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* @function getNEUsingGET
|
|
1420
|
+
* @pronghornType method
|
|
1421
|
+
* @name getNEUsingGET
|
|
1422
|
+
* @summary getNEUsingGET
|
|
1423
|
+
*
|
|
1424
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
1425
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1426
|
+
* @return {object} results - An object containing the response of the action
|
|
1427
|
+
*
|
|
1428
|
+
* @route {POST} /getNEUsingGET
|
|
1429
|
+
* @roles admin
|
|
1430
|
+
* @task true
|
|
1431
|
+
*/
|
|
1432
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1433
|
+
getNEUsingGET(networkElementFdn, callback) {
|
|
1434
|
+
const meth = 'adapter-getNEUsingGET';
|
|
1435
|
+
const origin = `${this.id}-${meth}`;
|
|
1436
|
+
log.trace(origin);
|
|
1437
|
+
|
|
1438
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1439
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1440
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1441
|
+
return callback(null, errorObj);
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1445
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
1446
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
1447
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1448
|
+
return callback(null, errorObj);
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1452
|
+
const queryParamsAvailable = {};
|
|
1453
|
+
const queryParams = {};
|
|
1454
|
+
const pathVars = [networkElementFdn];
|
|
1455
|
+
const bodyVars = {};
|
|
1456
|
+
|
|
1457
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1458
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1459
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1460
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1461
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1462
|
+
}
|
|
1463
|
+
});
|
|
1464
|
+
|
|
1465
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1466
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1467
|
+
const reqObj = {
|
|
1468
|
+
payload: bodyVars,
|
|
1469
|
+
uriPathVars: pathVars,
|
|
1470
|
+
uriQuery: queryParams
|
|
1471
|
+
};
|
|
1472
|
+
|
|
1473
|
+
try {
|
|
1474
|
+
// Make the call -
|
|
1475
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1476
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getNEUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1477
|
+
// if we received an error or their is no response on the results
|
|
1478
|
+
// return an error
|
|
1479
|
+
if (irReturnError) {
|
|
1480
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1481
|
+
return callback(null, irReturnError);
|
|
1482
|
+
}
|
|
1483
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1484
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getNEUsingGET'], null, null, null);
|
|
1485
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1486
|
+
return callback(null, errorObj);
|
|
1487
|
+
}
|
|
1488
|
+
|
|
1489
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1490
|
+
// return the response
|
|
1491
|
+
return callback(irReturnData, null);
|
|
1492
|
+
});
|
|
1493
|
+
} catch (ex) {
|
|
1494
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1495
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1496
|
+
return callback(null, errorObj);
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
/**
|
|
1501
|
+
* @function getNELAGsUsingGET
|
|
1502
|
+
* @pronghornType method
|
|
1503
|
+
* @name getNELAGsUsingGET
|
|
1504
|
+
* @summary getNELAGsUsingGET
|
|
1505
|
+
*
|
|
1506
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
1507
|
+
|
|
1508
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
1509
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
1510
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1511
|
+
* @return {object} results - An object containing the response of the action
|
|
1512
|
+
*
|
|
1513
|
+
* @route {POST} /getNELAGsUsingGET
|
|
1514
|
+
* @roles admin
|
|
1515
|
+
* @task true
|
|
1516
|
+
*/
|
|
1517
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1518
|
+
getNELAGsUsingGET(filter, networkElementFdn, callback) {
|
|
1519
|
+
const meth = 'adapter-getNELAGsUsingGET';
|
|
1520
|
+
const origin = `${this.id}-${meth}`;
|
|
1521
|
+
log.trace(origin);
|
|
1522
|
+
|
|
1523
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1524
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1525
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1526
|
+
return callback(null, errorObj);
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1530
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
1531
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
1532
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1533
|
+
return callback(null, errorObj);
|
|
1534
|
+
}
|
|
1535
|
+
|
|
1536
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1537
|
+
const queryParamsAvailable = { filter };
|
|
1538
|
+
const queryParams = {};
|
|
1539
|
+
const pathVars = [networkElementFdn];
|
|
1540
|
+
const bodyVars = {};
|
|
1541
|
+
|
|
1542
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1543
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1544
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1545
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1546
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1547
|
+
}
|
|
1548
|
+
});
|
|
1549
|
+
|
|
1550
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1551
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1552
|
+
const reqObj = {
|
|
1553
|
+
payload: bodyVars,
|
|
1554
|
+
uriPathVars: pathVars,
|
|
1555
|
+
uriQuery: queryParams
|
|
1556
|
+
};
|
|
1557
|
+
|
|
1558
|
+
try {
|
|
1559
|
+
// Make the call -
|
|
1560
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1561
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getNELAGsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1562
|
+
// if we received an error or their is no response on the results
|
|
1563
|
+
// return an error
|
|
1564
|
+
if (irReturnError) {
|
|
1565
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1566
|
+
return callback(null, irReturnError);
|
|
1567
|
+
}
|
|
1568
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1569
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getNELAGsUsingGET'], null, null, null);
|
|
1570
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1571
|
+
return callback(null, errorObj);
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1575
|
+
// return the response
|
|
1576
|
+
return callback(irReturnData, null);
|
|
1577
|
+
});
|
|
1578
|
+
} catch (ex) {
|
|
1579
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1580
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1581
|
+
return callback(null, errorObj);
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* @function getLagMembersUsingGET
|
|
1587
|
+
* @pronghornType method
|
|
1588
|
+
* @name getLagMembersUsingGET
|
|
1589
|
+
* @summary getLagMembersUsingGET
|
|
1590
|
+
*
|
|
1591
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
1592
|
+
|
|
1593
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
1594
|
+
* @param {string} lagFdn - lagFdn
|
|
1595
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
1596
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1597
|
+
* @return {object} results - An object containing the response of the action
|
|
1598
|
+
*
|
|
1599
|
+
* @route {POST} /getLagMembersUsingGET
|
|
1600
|
+
* @roles admin
|
|
1601
|
+
* @task true
|
|
1602
|
+
*/
|
|
1603
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1604
|
+
getLagMembersUsingGET(filter, lagFdn, networkElementFdn, callback) {
|
|
1605
|
+
const meth = 'adapter-getLagMembersUsingGET';
|
|
1606
|
+
const origin = `${this.id}-${meth}`;
|
|
1607
|
+
log.trace(origin);
|
|
1608
|
+
|
|
1609
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1610
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1611
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1612
|
+
return callback(null, errorObj);
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1616
|
+
if (lagFdn === undefined || lagFdn === null || lagFdn === '') {
|
|
1617
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['lagFdn'], null, null, null);
|
|
1618
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1619
|
+
return callback(null, errorObj);
|
|
1620
|
+
}
|
|
1621
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
1622
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
1623
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1624
|
+
return callback(null, errorObj);
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1628
|
+
const queryParamsAvailable = { filter };
|
|
1629
|
+
const queryParams = {};
|
|
1630
|
+
const pathVars = [networkElementFdn, lagFdn];
|
|
1631
|
+
const bodyVars = {};
|
|
1632
|
+
|
|
1633
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1634
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1635
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1636
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1637
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1638
|
+
}
|
|
1639
|
+
});
|
|
1640
|
+
|
|
1641
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1642
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1643
|
+
const reqObj = {
|
|
1644
|
+
payload: bodyVars,
|
|
1645
|
+
uriPathVars: pathVars,
|
|
1646
|
+
uriQuery: queryParams
|
|
1647
|
+
};
|
|
1648
|
+
|
|
1649
|
+
try {
|
|
1650
|
+
// Make the call -
|
|
1651
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1652
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getLagMembersUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1653
|
+
// if we received an error or their is no response on the results
|
|
1654
|
+
// return an error
|
|
1655
|
+
if (irReturnError) {
|
|
1656
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1657
|
+
return callback(null, irReturnError);
|
|
1658
|
+
}
|
|
1659
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1660
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getLagMembersUsingGET'], null, null, null);
|
|
1661
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1662
|
+
return callback(null, errorObj);
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1666
|
+
// return the response
|
|
1667
|
+
return callback(irReturnData, null);
|
|
1668
|
+
});
|
|
1669
|
+
} catch (ex) {
|
|
1670
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1671
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1672
|
+
return callback(null, errorObj);
|
|
1673
|
+
}
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
/**
|
|
1677
|
+
* @function getNERadioEquipmentsUsingGET
|
|
1678
|
+
* @pronghornType method
|
|
1679
|
+
* @name getNERadioEquipmentsUsingGET
|
|
1680
|
+
* @summary getNERadioEquipmentsUsingGET
|
|
1681
|
+
*
|
|
1682
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
1683
|
+
|
|
1684
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
1685
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
1686
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1687
|
+
* @return {object} results - An object containing the response of the action
|
|
1688
|
+
*
|
|
1689
|
+
* @route {POST} /getNERadioEquipmentsUsingGET
|
|
1690
|
+
* @roles admin
|
|
1691
|
+
* @task true
|
|
1692
|
+
*/
|
|
1693
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1694
|
+
getNERadioEquipmentsUsingGET(filter, networkElementFdn, callback) {
|
|
1695
|
+
const meth = 'adapter-getNERadioEquipmentsUsingGET';
|
|
1696
|
+
const origin = `${this.id}-${meth}`;
|
|
1697
|
+
log.trace(origin);
|
|
1698
|
+
|
|
1699
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1700
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1701
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1702
|
+
return callback(null, errorObj);
|
|
1703
|
+
}
|
|
1704
|
+
|
|
1705
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1706
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
1707
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
1708
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1709
|
+
return callback(null, errorObj);
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1713
|
+
const queryParamsAvailable = { filter };
|
|
1714
|
+
const queryParams = {};
|
|
1715
|
+
const pathVars = [networkElementFdn];
|
|
1716
|
+
const bodyVars = {};
|
|
1717
|
+
|
|
1718
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1719
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1720
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1721
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1722
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1723
|
+
}
|
|
1724
|
+
});
|
|
1725
|
+
|
|
1726
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1727
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1728
|
+
const reqObj = {
|
|
1729
|
+
payload: bodyVars,
|
|
1730
|
+
uriPathVars: pathVars,
|
|
1731
|
+
uriQuery: queryParams
|
|
1732
|
+
};
|
|
1733
|
+
|
|
1734
|
+
try {
|
|
1735
|
+
// Make the call -
|
|
1736
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1737
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getNERadioEquipmentsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1738
|
+
// if we received an error or their is no response on the results
|
|
1739
|
+
// return an error
|
|
1740
|
+
if (irReturnError) {
|
|
1741
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1742
|
+
return callback(null, irReturnError);
|
|
1743
|
+
}
|
|
1744
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1745
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getNERadioEquipmentsUsingGET'], null, null, null);
|
|
1746
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1747
|
+
return callback(null, errorObj);
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1750
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1751
|
+
// return the response
|
|
1752
|
+
return callback(irReturnData, null);
|
|
1753
|
+
});
|
|
1754
|
+
} catch (ex) {
|
|
1755
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1756
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1757
|
+
return callback(null, errorObj);
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/**
|
|
1762
|
+
* @function getRadioEquipmentLagsUsingGET
|
|
1763
|
+
* @pronghornType method
|
|
1764
|
+
* @name getRadioEquipmentLagsUsingGET
|
|
1765
|
+
* @summary getRadioEquipmentLagsUsingGET
|
|
1766
|
+
*
|
|
1767
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
1768
|
+
|
|
1769
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
1770
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
1771
|
+
* @param {string} radioEquipmentFdn - radioEquipmentFdn
|
|
1772
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1773
|
+
* @return {object} results - An object containing the response of the action
|
|
1774
|
+
*
|
|
1775
|
+
* @route {POST} /getRadioEquipmentLagsUsingGET
|
|
1776
|
+
* @roles admin
|
|
1777
|
+
* @task true
|
|
1778
|
+
*/
|
|
1779
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1780
|
+
getRadioEquipmentLagsUsingGET(filter, networkElementFdn, radioEquipmentFdn, callback) {
|
|
1781
|
+
const meth = 'adapter-getRadioEquipmentLagsUsingGET';
|
|
1782
|
+
const origin = `${this.id}-${meth}`;
|
|
1783
|
+
log.trace(origin);
|
|
1784
|
+
|
|
1785
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1786
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1787
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1788
|
+
return callback(null, errorObj);
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1792
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
1793
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
1794
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1795
|
+
return callback(null, errorObj);
|
|
1796
|
+
}
|
|
1797
|
+
if (radioEquipmentFdn === undefined || radioEquipmentFdn === null || radioEquipmentFdn === '') {
|
|
1798
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['radioEquipmentFdn'], null, null, null);
|
|
1799
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1800
|
+
return callback(null, errorObj);
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1804
|
+
const queryParamsAvailable = { filter };
|
|
1805
|
+
const queryParams = {};
|
|
1806
|
+
const pathVars = [networkElementFdn, radioEquipmentFdn];
|
|
1807
|
+
const bodyVars = {};
|
|
1808
|
+
|
|
1809
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1810
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1811
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1812
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1813
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1814
|
+
}
|
|
1815
|
+
});
|
|
1816
|
+
|
|
1817
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1818
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1819
|
+
const reqObj = {
|
|
1820
|
+
payload: bodyVars,
|
|
1821
|
+
uriPathVars: pathVars,
|
|
1822
|
+
uriQuery: queryParams
|
|
1823
|
+
};
|
|
1824
|
+
|
|
1825
|
+
try {
|
|
1826
|
+
// Make the call -
|
|
1827
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1828
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getRadioEquipmentLagsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1829
|
+
// if we received an error or their is no response on the results
|
|
1830
|
+
// return an error
|
|
1831
|
+
if (irReturnError) {
|
|
1832
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1833
|
+
return callback(null, irReturnError);
|
|
1834
|
+
}
|
|
1835
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1836
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRadioEquipmentLagsUsingGET'], null, null, null);
|
|
1837
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1838
|
+
return callback(null, errorObj);
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1842
|
+
// return the response
|
|
1843
|
+
return callback(irReturnData, null);
|
|
1844
|
+
});
|
|
1845
|
+
} catch (ex) {
|
|
1846
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1847
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1848
|
+
return callback(null, errorObj);
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
/**
|
|
1853
|
+
* @function getRadioEquipmentLagMembersUsingGET
|
|
1854
|
+
* @pronghornType method
|
|
1855
|
+
* @name getRadioEquipmentLagMembersUsingGET
|
|
1856
|
+
* @summary getRadioEquipmentLagMembersUsingGET
|
|
1857
|
+
*
|
|
1858
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
1859
|
+
|
|
1860
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
1861
|
+
* @param {string} lagFdn - lagFdn
|
|
1862
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
1863
|
+
* @param {string} radioEquipmentFdn - radioEquipmentFdn
|
|
1864
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1865
|
+
* @return {object} results - An object containing the response of the action
|
|
1866
|
+
*
|
|
1867
|
+
* @route {POST} /getRadioEquipmentLagMembersUsingGET
|
|
1868
|
+
* @roles admin
|
|
1869
|
+
* @task true
|
|
1870
|
+
*/
|
|
1871
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1872
|
+
getRadioEquipmentLagMembersUsingGET(filter, lagFdn, networkElementFdn, radioEquipmentFdn, callback) {
|
|
1873
|
+
const meth = 'adapter-getRadioEquipmentLagMembersUsingGET';
|
|
1874
|
+
const origin = `${this.id}-${meth}`;
|
|
1875
|
+
log.trace(origin);
|
|
1876
|
+
|
|
1877
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1878
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1879
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1880
|
+
return callback(null, errorObj);
|
|
1881
|
+
}
|
|
1882
|
+
|
|
1883
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1884
|
+
if (lagFdn === undefined || lagFdn === null || lagFdn === '') {
|
|
1885
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['lagFdn'], null, null, null);
|
|
1886
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1887
|
+
return callback(null, errorObj);
|
|
1888
|
+
}
|
|
1889
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
1890
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
1891
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1892
|
+
return callback(null, errorObj);
|
|
1893
|
+
}
|
|
1894
|
+
if (radioEquipmentFdn === undefined || radioEquipmentFdn === null || radioEquipmentFdn === '') {
|
|
1895
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['radioEquipmentFdn'], null, null, null);
|
|
1896
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1897
|
+
return callback(null, errorObj);
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1901
|
+
const queryParamsAvailable = { filter };
|
|
1902
|
+
const queryParams = {};
|
|
1903
|
+
const pathVars = [networkElementFdn, radioEquipmentFdn, lagFdn];
|
|
1904
|
+
const bodyVars = {};
|
|
1905
|
+
|
|
1906
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1907
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1908
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
1909
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
1910
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
1911
|
+
}
|
|
1912
|
+
});
|
|
1913
|
+
|
|
1914
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
1915
|
+
// see adapter code documentation for more information on the request object's fields
|
|
1916
|
+
const reqObj = {
|
|
1917
|
+
payload: bodyVars,
|
|
1918
|
+
uriPathVars: pathVars,
|
|
1919
|
+
uriQuery: queryParams
|
|
1920
|
+
};
|
|
1921
|
+
|
|
1922
|
+
try {
|
|
1923
|
+
// Make the call -
|
|
1924
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
1925
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getRadioEquipmentLagMembersUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
1926
|
+
// if we received an error or their is no response on the results
|
|
1927
|
+
// return an error
|
|
1928
|
+
if (irReturnError) {
|
|
1929
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
1930
|
+
return callback(null, irReturnError);
|
|
1931
|
+
}
|
|
1932
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
1933
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRadioEquipmentLagMembersUsingGET'], null, null, null);
|
|
1934
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1935
|
+
return callback(null, errorObj);
|
|
1936
|
+
}
|
|
1937
|
+
|
|
1938
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
1939
|
+
// return the response
|
|
1940
|
+
return callback(irReturnData, null);
|
|
1941
|
+
});
|
|
1942
|
+
} catch (ex) {
|
|
1943
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
1944
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1945
|
+
return callback(null, errorObj);
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
/**
|
|
1950
|
+
* @function getRadioEquipmentShelvesUsingGET
|
|
1951
|
+
* @pronghornType method
|
|
1952
|
+
* @name getRadioEquipmentShelvesUsingGET
|
|
1953
|
+
* @summary getRadioEquipmentShelvesUsingGET
|
|
1954
|
+
*
|
|
1955
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
1956
|
+
|
|
1957
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
1958
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
1959
|
+
* @param {string} radioEquipmentFdn - radioEquipmentFdn
|
|
1960
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
1961
|
+
* @return {object} results - An object containing the response of the action
|
|
1962
|
+
*
|
|
1963
|
+
* @route {POST} /getRadioEquipmentShelvesUsingGET
|
|
1964
|
+
* @roles admin
|
|
1965
|
+
* @task true
|
|
1966
|
+
*/
|
|
1967
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
1968
|
+
getRadioEquipmentShelvesUsingGET(filter, networkElementFdn, radioEquipmentFdn, callback) {
|
|
1969
|
+
const meth = 'adapter-getRadioEquipmentShelvesUsingGET';
|
|
1970
|
+
const origin = `${this.id}-${meth}`;
|
|
1971
|
+
log.trace(origin);
|
|
1972
|
+
|
|
1973
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
1974
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
1975
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1976
|
+
return callback(null, errorObj);
|
|
1977
|
+
}
|
|
1978
|
+
|
|
1979
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
1980
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
1981
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
1982
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1983
|
+
return callback(null, errorObj);
|
|
1984
|
+
}
|
|
1985
|
+
if (radioEquipmentFdn === undefined || radioEquipmentFdn === null || radioEquipmentFdn === '') {
|
|
1986
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['radioEquipmentFdn'], null, null, null);
|
|
1987
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
1988
|
+
return callback(null, errorObj);
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
1992
|
+
const queryParamsAvailable = { filter };
|
|
1993
|
+
const queryParams = {};
|
|
1994
|
+
const pathVars = [networkElementFdn, radioEquipmentFdn];
|
|
1995
|
+
const bodyVars = {};
|
|
1996
|
+
|
|
1997
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
1998
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
1999
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2000
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2001
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2002
|
+
}
|
|
2003
|
+
});
|
|
2004
|
+
|
|
2005
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2006
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2007
|
+
const reqObj = {
|
|
2008
|
+
payload: bodyVars,
|
|
2009
|
+
uriPathVars: pathVars,
|
|
2010
|
+
uriQuery: queryParams
|
|
2011
|
+
};
|
|
2012
|
+
|
|
2013
|
+
try {
|
|
2014
|
+
// Make the call -
|
|
2015
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2016
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getRadioEquipmentShelvesUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
2017
|
+
// if we received an error or their is no response on the results
|
|
2018
|
+
// return an error
|
|
2019
|
+
if (irReturnError) {
|
|
2020
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2021
|
+
return callback(null, irReturnError);
|
|
2022
|
+
}
|
|
2023
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2024
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRadioEquipmentShelvesUsingGET'], null, null, null);
|
|
2025
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2026
|
+
return callback(null, errorObj);
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2030
|
+
// return the response
|
|
2031
|
+
return callback(irReturnData, null);
|
|
2032
|
+
});
|
|
2033
|
+
} catch (ex) {
|
|
2034
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2035
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2036
|
+
return callback(null, errorObj);
|
|
2037
|
+
}
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
/**
|
|
2041
|
+
* @function getRadioEquipmentShelfCardsUsingGET
|
|
2042
|
+
* @pronghornType method
|
|
2043
|
+
* @name getRadioEquipmentShelfCardsUsingGET
|
|
2044
|
+
* @summary getRadioEquipmentShelfCardsUsingGET
|
|
2045
|
+
*
|
|
2046
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
2047
|
+
|
|
2048
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
2049
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
2050
|
+
* @param {string} radioEquipmentFdn - radioEquipmentFdn
|
|
2051
|
+
* @param {string} shelfFdn - shelfFdn
|
|
2052
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2053
|
+
* @return {object} results - An object containing the response of the action
|
|
2054
|
+
*
|
|
2055
|
+
* @route {POST} /getRadioEquipmentShelfCardsUsingGET
|
|
2056
|
+
* @roles admin
|
|
2057
|
+
* @task true
|
|
2058
|
+
*/
|
|
2059
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2060
|
+
getRadioEquipmentShelfCardsUsingGET(filter, networkElementFdn, radioEquipmentFdn, shelfFdn, callback) {
|
|
2061
|
+
const meth = 'adapter-getRadioEquipmentShelfCardsUsingGET';
|
|
2062
|
+
const origin = `${this.id}-${meth}`;
|
|
2063
|
+
log.trace(origin);
|
|
2064
|
+
|
|
2065
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2066
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2067
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2068
|
+
return callback(null, errorObj);
|
|
2069
|
+
}
|
|
2070
|
+
|
|
2071
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2072
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
2073
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
2074
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2075
|
+
return callback(null, errorObj);
|
|
2076
|
+
}
|
|
2077
|
+
if (radioEquipmentFdn === undefined || radioEquipmentFdn === null || radioEquipmentFdn === '') {
|
|
2078
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['radioEquipmentFdn'], null, null, null);
|
|
2079
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2080
|
+
return callback(null, errorObj);
|
|
2081
|
+
}
|
|
2082
|
+
if (shelfFdn === undefined || shelfFdn === null || shelfFdn === '') {
|
|
2083
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfFdn'], null, null, null);
|
|
2084
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2085
|
+
return callback(null, errorObj);
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2089
|
+
const queryParamsAvailable = { filter };
|
|
2090
|
+
const queryParams = {};
|
|
2091
|
+
const pathVars = [networkElementFdn, radioEquipmentFdn, shelfFdn];
|
|
2092
|
+
const bodyVars = {};
|
|
2093
|
+
|
|
2094
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2095
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2096
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2097
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2098
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2099
|
+
}
|
|
2100
|
+
});
|
|
2101
|
+
|
|
2102
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2103
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2104
|
+
const reqObj = {
|
|
2105
|
+
payload: bodyVars,
|
|
2106
|
+
uriPathVars: pathVars,
|
|
2107
|
+
uriQuery: queryParams
|
|
2108
|
+
};
|
|
2109
|
+
|
|
2110
|
+
try {
|
|
2111
|
+
// Make the call -
|
|
2112
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2113
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getRadioEquipmentShelfCardsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
2114
|
+
// if we received an error or their is no response on the results
|
|
2115
|
+
// return an error
|
|
2116
|
+
if (irReturnError) {
|
|
2117
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2118
|
+
return callback(null, irReturnError);
|
|
2119
|
+
}
|
|
2120
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2121
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRadioEquipmentShelfCardsUsingGET'], null, null, null);
|
|
2122
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2123
|
+
return callback(null, errorObj);
|
|
2124
|
+
}
|
|
2125
|
+
|
|
2126
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2127
|
+
// return the response
|
|
2128
|
+
return callback(irReturnData, null);
|
|
2129
|
+
});
|
|
2130
|
+
} catch (ex) {
|
|
2131
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2132
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2133
|
+
return callback(null, errorObj);
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
|
|
2137
|
+
/**
|
|
2138
|
+
* @function getRadioEquipmentCardPortsUsingGET
|
|
2139
|
+
* @pronghornType method
|
|
2140
|
+
* @name getRadioEquipmentCardPortsUsingGET
|
|
2141
|
+
* @summary getRadioEquipmentCardPortsUsingGET
|
|
2142
|
+
*
|
|
2143
|
+
* @param {string} cardFdn - cardFdn
|
|
2144
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
2145
|
+
|
|
2146
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
2147
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
2148
|
+
* @param {string} radioEquipmentFdn - radioEquipmentFdn
|
|
2149
|
+
* @param {string} shelfFdn - shelfFdn
|
|
2150
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2151
|
+
* @return {object} results - An object containing the response of the action
|
|
2152
|
+
*
|
|
2153
|
+
* @route {POST} /getRadioEquipmentCardPortsUsingGET
|
|
2154
|
+
* @roles admin
|
|
2155
|
+
* @task true
|
|
2156
|
+
*/
|
|
2157
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2158
|
+
getRadioEquipmentCardPortsUsingGET(cardFdn, filter, networkElementFdn, radioEquipmentFdn, shelfFdn, callback) {
|
|
2159
|
+
const meth = 'adapter-getRadioEquipmentCardPortsUsingGET';
|
|
2160
|
+
const origin = `${this.id}-${meth}`;
|
|
2161
|
+
log.trace(origin);
|
|
2162
|
+
|
|
2163
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2164
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2165
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2166
|
+
return callback(null, errorObj);
|
|
2167
|
+
}
|
|
2168
|
+
|
|
2169
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2170
|
+
if (cardFdn === undefined || cardFdn === null || cardFdn === '') {
|
|
2171
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['cardFdn'], null, null, null);
|
|
2172
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2173
|
+
return callback(null, errorObj);
|
|
2174
|
+
}
|
|
2175
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
2176
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
2177
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2178
|
+
return callback(null, errorObj);
|
|
2179
|
+
}
|
|
2180
|
+
if (radioEquipmentFdn === undefined || radioEquipmentFdn === null || radioEquipmentFdn === '') {
|
|
2181
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['radioEquipmentFdn'], null, null, null);
|
|
2182
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2183
|
+
return callback(null, errorObj);
|
|
2184
|
+
}
|
|
2185
|
+
if (shelfFdn === undefined || shelfFdn === null || shelfFdn === '') {
|
|
2186
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfFdn'], null, null, null);
|
|
2187
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2188
|
+
return callback(null, errorObj);
|
|
2189
|
+
}
|
|
2190
|
+
|
|
2191
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2192
|
+
const queryParamsAvailable = { filter };
|
|
2193
|
+
const queryParams = {};
|
|
2194
|
+
const pathVars = [networkElementFdn, radioEquipmentFdn, shelfFdn, cardFdn];
|
|
2195
|
+
const bodyVars = {};
|
|
2196
|
+
|
|
2197
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2198
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2199
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2200
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2201
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2202
|
+
}
|
|
2203
|
+
});
|
|
2204
|
+
|
|
2205
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2206
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2207
|
+
const reqObj = {
|
|
2208
|
+
payload: bodyVars,
|
|
2209
|
+
uriPathVars: pathVars,
|
|
2210
|
+
uriQuery: queryParams
|
|
2211
|
+
};
|
|
2212
|
+
|
|
2213
|
+
try {
|
|
2214
|
+
// Make the call -
|
|
2215
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2216
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getRadioEquipmentCardPortsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
2217
|
+
// if we received an error or their is no response on the results
|
|
2218
|
+
// return an error
|
|
2219
|
+
if (irReturnError) {
|
|
2220
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2221
|
+
return callback(null, irReturnError);
|
|
2222
|
+
}
|
|
2223
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2224
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRadioEquipmentCardPortsUsingGET'], null, null, null);
|
|
2225
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2226
|
+
return callback(null, errorObj);
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2230
|
+
// return the response
|
|
2231
|
+
return callback(irReturnData, null);
|
|
2232
|
+
});
|
|
2233
|
+
} catch (ex) {
|
|
2234
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2235
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2236
|
+
return callback(null, errorObj);
|
|
2237
|
+
}
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
/**
|
|
2241
|
+
* @function getNEShelvesUsingGET
|
|
2242
|
+
* @pronghornType method
|
|
2243
|
+
* @name getNEShelvesUsingGET
|
|
2244
|
+
* @summary getNEShelvesUsingGET
|
|
2245
|
+
*
|
|
2246
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
2247
|
+
|
|
2248
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
2249
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
2250
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2251
|
+
* @return {object} results - An object containing the response of the action
|
|
2252
|
+
*
|
|
2253
|
+
* @route {POST} /getNEShelvesUsingGET
|
|
2254
|
+
* @roles admin
|
|
2255
|
+
* @task true
|
|
2256
|
+
*/
|
|
2257
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2258
|
+
getNEShelvesUsingGET(filter, networkElementFdn, callback) {
|
|
2259
|
+
const meth = 'adapter-getNEShelvesUsingGET';
|
|
2260
|
+
const origin = `${this.id}-${meth}`;
|
|
2261
|
+
log.trace(origin);
|
|
2262
|
+
|
|
2263
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2264
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2265
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2266
|
+
return callback(null, errorObj);
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2270
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
2271
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
2272
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2273
|
+
return callback(null, errorObj);
|
|
2274
|
+
}
|
|
2275
|
+
|
|
2276
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2277
|
+
const queryParamsAvailable = { filter };
|
|
2278
|
+
const queryParams = {};
|
|
2279
|
+
const pathVars = [networkElementFdn];
|
|
2280
|
+
const bodyVars = {};
|
|
2281
|
+
|
|
2282
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2283
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2284
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2285
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2286
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2287
|
+
}
|
|
2288
|
+
});
|
|
2289
|
+
|
|
2290
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2291
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2292
|
+
const reqObj = {
|
|
2293
|
+
payload: bodyVars,
|
|
2294
|
+
uriPathVars: pathVars,
|
|
2295
|
+
uriQuery: queryParams
|
|
2296
|
+
};
|
|
2297
|
+
|
|
2298
|
+
try {
|
|
2299
|
+
// Make the call -
|
|
2300
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2301
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getNEShelvesUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
2302
|
+
// if we received an error or their is no response on the results
|
|
2303
|
+
// return an error
|
|
2304
|
+
if (irReturnError) {
|
|
2305
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2306
|
+
return callback(null, irReturnError);
|
|
2307
|
+
}
|
|
2308
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2309
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getNEShelvesUsingGET'], null, null, null);
|
|
2310
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2311
|
+
return callback(null, errorObj);
|
|
2312
|
+
}
|
|
2313
|
+
|
|
2314
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2315
|
+
// return the response
|
|
2316
|
+
return callback(irReturnData, null);
|
|
2317
|
+
});
|
|
2318
|
+
} catch (ex) {
|
|
2319
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2320
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2321
|
+
return callback(null, errorObj);
|
|
2322
|
+
}
|
|
2323
|
+
}
|
|
2324
|
+
|
|
2325
|
+
/**
|
|
2326
|
+
* @function getShelfCardsUsingGET
|
|
2327
|
+
* @pronghornType method
|
|
2328
|
+
* @name getShelfCardsUsingGET
|
|
2329
|
+
* @summary getShelfCardsUsingGET
|
|
2330
|
+
*
|
|
2331
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
2332
|
+
|
|
2333
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
2334
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
2335
|
+
* @param {string} shelfFdn - shelfFdn
|
|
2336
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2337
|
+
* @return {object} results - An object containing the response of the action
|
|
2338
|
+
*
|
|
2339
|
+
* @route {POST} /getShelfCardsUsingGET
|
|
2340
|
+
* @roles admin
|
|
2341
|
+
* @task true
|
|
2342
|
+
*/
|
|
2343
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2344
|
+
getShelfCardsUsingGET(filter, networkElementFdn, shelfFdn, callback) {
|
|
2345
|
+
const meth = 'adapter-getShelfCardsUsingGET';
|
|
2346
|
+
const origin = `${this.id}-${meth}`;
|
|
2347
|
+
log.trace(origin);
|
|
2348
|
+
|
|
2349
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2350
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2351
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2352
|
+
return callback(null, errorObj);
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2356
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
2357
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
2358
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2359
|
+
return callback(null, errorObj);
|
|
2360
|
+
}
|
|
2361
|
+
if (shelfFdn === undefined || shelfFdn === null || shelfFdn === '') {
|
|
2362
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfFdn'], null, null, null);
|
|
2363
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2364
|
+
return callback(null, errorObj);
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2368
|
+
const queryParamsAvailable = { filter };
|
|
2369
|
+
const queryParams = {};
|
|
2370
|
+
const pathVars = [networkElementFdn, shelfFdn];
|
|
2371
|
+
const bodyVars = {};
|
|
2372
|
+
|
|
2373
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2374
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2375
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2376
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2377
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2378
|
+
}
|
|
2379
|
+
});
|
|
2380
|
+
|
|
2381
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2382
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2383
|
+
const reqObj = {
|
|
2384
|
+
payload: bodyVars,
|
|
2385
|
+
uriPathVars: pathVars,
|
|
2386
|
+
uriQuery: queryParams
|
|
2387
|
+
};
|
|
2388
|
+
|
|
2389
|
+
try {
|
|
2390
|
+
// Make the call -
|
|
2391
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2392
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getShelfCardsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
2393
|
+
// if we received an error or their is no response on the results
|
|
2394
|
+
// return an error
|
|
2395
|
+
if (irReturnError) {
|
|
2396
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2397
|
+
return callback(null, irReturnError);
|
|
2398
|
+
}
|
|
2399
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2400
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getShelfCardsUsingGET'], null, null, null);
|
|
2401
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2402
|
+
return callback(null, errorObj);
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2406
|
+
// return the response
|
|
2407
|
+
return callback(irReturnData, null);
|
|
2408
|
+
});
|
|
2409
|
+
} catch (ex) {
|
|
2410
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2411
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2412
|
+
return callback(null, errorObj);
|
|
2413
|
+
}
|
|
2414
|
+
}
|
|
2415
|
+
|
|
2416
|
+
/**
|
|
2417
|
+
* @function getCardPortsUsingGET
|
|
2418
|
+
* @pronghornType method
|
|
2419
|
+
* @name getCardPortsUsingGET
|
|
2420
|
+
* @summary getCardPortsUsingGET
|
|
2421
|
+
*
|
|
2422
|
+
* @param {string} cardFdn - cardFdn
|
|
2423
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
2424
|
+
|
|
2425
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
2426
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
2427
|
+
* @param {string} shelfFdn - shelfFdn
|
|
2428
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2429
|
+
* @return {object} results - An object containing the response of the action
|
|
2430
|
+
*
|
|
2431
|
+
* @route {POST} /getCardPortsUsingGET
|
|
2432
|
+
* @roles admin
|
|
2433
|
+
* @task true
|
|
2434
|
+
*/
|
|
2435
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2436
|
+
getCardPortsUsingGET(cardFdn, filter, networkElementFdn, shelfFdn, callback) {
|
|
2437
|
+
const meth = 'adapter-getCardPortsUsingGET';
|
|
2438
|
+
const origin = `${this.id}-${meth}`;
|
|
2439
|
+
log.trace(origin);
|
|
2440
|
+
|
|
2441
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2442
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2443
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2444
|
+
return callback(null, errorObj);
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2448
|
+
if (cardFdn === undefined || cardFdn === null || cardFdn === '') {
|
|
2449
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['cardFdn'], null, null, null);
|
|
2450
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2451
|
+
return callback(null, errorObj);
|
|
2452
|
+
}
|
|
2453
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
2454
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
2455
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2456
|
+
return callback(null, errorObj);
|
|
2457
|
+
}
|
|
2458
|
+
if (shelfFdn === undefined || shelfFdn === null || shelfFdn === '') {
|
|
2459
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfFdn'], null, null, null);
|
|
2460
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2461
|
+
return callback(null, errorObj);
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2465
|
+
const queryParamsAvailable = { filter };
|
|
2466
|
+
const queryParams = {};
|
|
2467
|
+
const pathVars = [networkElementFdn, shelfFdn, cardFdn];
|
|
2468
|
+
const bodyVars = {};
|
|
2469
|
+
|
|
2470
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2471
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2472
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2473
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2474
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2475
|
+
}
|
|
2476
|
+
});
|
|
2477
|
+
|
|
2478
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2479
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2480
|
+
const reqObj = {
|
|
2481
|
+
payload: bodyVars,
|
|
2482
|
+
uriPathVars: pathVars,
|
|
2483
|
+
uriQuery: queryParams
|
|
2484
|
+
};
|
|
2485
|
+
|
|
2486
|
+
try {
|
|
2487
|
+
// Make the call -
|
|
2488
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2489
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getCardPortsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
2490
|
+
// if we received an error or their is no response on the results
|
|
2491
|
+
// return an error
|
|
2492
|
+
if (irReturnError) {
|
|
2493
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2494
|
+
return callback(null, irReturnError);
|
|
2495
|
+
}
|
|
2496
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2497
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getCardPortsUsingGET'], null, null, null);
|
|
2498
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2499
|
+
return callback(null, errorObj);
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2503
|
+
// return the response
|
|
2504
|
+
return callback(irReturnData, null);
|
|
2505
|
+
});
|
|
2506
|
+
} catch (ex) {
|
|
2507
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2508
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2509
|
+
return callback(null, errorObj);
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
|
|
2513
|
+
/**
|
|
2514
|
+
* @function getShelfPortsUsingGET
|
|
2515
|
+
* @pronghornType method
|
|
2516
|
+
* @name getShelfPortsUsingGET
|
|
2517
|
+
* @summary getShelfPortsUsingGET
|
|
2518
|
+
*
|
|
2519
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
2520
|
+
|
|
2521
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
2522
|
+
* @param {string} networkElementFdn - networkElementFdn
|
|
2523
|
+
* @param {string} shelfFdn - shelfFdn
|
|
2524
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2525
|
+
* @return {object} results - An object containing the response of the action
|
|
2526
|
+
*
|
|
2527
|
+
* @route {POST} /getShelfPortsUsingGET
|
|
2528
|
+
* @roles admin
|
|
2529
|
+
* @task true
|
|
2530
|
+
*/
|
|
2531
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2532
|
+
getShelfPortsUsingGET(filter, networkElementFdn, shelfFdn, callback) {
|
|
2533
|
+
const meth = 'adapter-getShelfPortsUsingGET';
|
|
2534
|
+
const origin = `${this.id}-${meth}`;
|
|
2535
|
+
log.trace(origin);
|
|
2536
|
+
|
|
2537
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2538
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2539
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2540
|
+
return callback(null, errorObj);
|
|
2541
|
+
}
|
|
2542
|
+
|
|
2543
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2544
|
+
if (networkElementFdn === undefined || networkElementFdn === null || networkElementFdn === '') {
|
|
2545
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['networkElementFdn'], null, null, null);
|
|
2546
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2547
|
+
return callback(null, errorObj);
|
|
2548
|
+
}
|
|
2549
|
+
if (shelfFdn === undefined || shelfFdn === null || shelfFdn === '') {
|
|
2550
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfFdn'], null, null, null);
|
|
2551
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2552
|
+
return callback(null, errorObj);
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2556
|
+
const queryParamsAvailable = { filter };
|
|
2557
|
+
const queryParams = {};
|
|
2558
|
+
const pathVars = [networkElementFdn, shelfFdn];
|
|
2559
|
+
const bodyVars = {};
|
|
2560
|
+
|
|
2561
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2562
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2563
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2564
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2565
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2566
|
+
}
|
|
2567
|
+
});
|
|
2568
|
+
|
|
2569
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2570
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2571
|
+
const reqObj = {
|
|
2572
|
+
payload: bodyVars,
|
|
2573
|
+
uriPathVars: pathVars,
|
|
2574
|
+
uriQuery: queryParams
|
|
2575
|
+
};
|
|
2576
|
+
|
|
2577
|
+
try {
|
|
2578
|
+
// Make the call -
|
|
2579
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2580
|
+
return this.requestHandlerInst.identifyRequest('NetworkElements', 'getShelfPortsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
2581
|
+
// if we received an error or their is no response on the results
|
|
2582
|
+
// return an error
|
|
2583
|
+
if (irReturnError) {
|
|
2584
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2585
|
+
return callback(null, irReturnError);
|
|
2586
|
+
}
|
|
2587
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2588
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getShelfPortsUsingGET'], null, null, null);
|
|
2589
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2590
|
+
return callback(null, errorObj);
|
|
2591
|
+
}
|
|
2592
|
+
|
|
2593
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2594
|
+
// return the response
|
|
2595
|
+
return callback(irReturnData, null);
|
|
2596
|
+
});
|
|
2597
|
+
} catch (ex) {
|
|
2598
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2599
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2600
|
+
return callback(null, errorObj);
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
|
|
2604
|
+
/**
|
|
2605
|
+
* @function getPhysicalLinksUsingGET
|
|
2606
|
+
* @pronghornType method
|
|
2607
|
+
* @name getPhysicalLinksUsingGET
|
|
2608
|
+
* @summary getPhysicalLinksUsingGET
|
|
2609
|
+
*
|
|
2610
|
+
* @param {string} [fdns] - A comma-separated list of the Fully Distinguished Names of the NSP objects to query for.
|
|
2611
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
2612
|
+
|
|
2613
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
2614
|
+
* @param {number} [limit] - The limit on the number of objects returned (max: 1000)
|
|
2615
|
+
* @param {boolean} [neFetch] - A boolean value to determine whether to fetch NE data
|
|
2616
|
+
* @param {number} [offset] - Start row for paged data (max: total number of objects)
|
|
2617
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2618
|
+
* @return {object} results - An object containing the response of the action
|
|
2619
|
+
*
|
|
2620
|
+
* @route {POST} /getPhysicalLinksUsingGET
|
|
2621
|
+
* @roles admin
|
|
2622
|
+
* @task true
|
|
2623
|
+
*/
|
|
2624
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2625
|
+
getPhysicalLinksUsingGET(fdns, filter, limit, neFetch, offset, callback) {
|
|
2626
|
+
const meth = 'adapter-getPhysicalLinksUsingGET';
|
|
2627
|
+
const origin = `${this.id}-${meth}`;
|
|
2628
|
+
log.trace(origin);
|
|
2629
|
+
|
|
2630
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2631
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2632
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2633
|
+
return callback(null, errorObj);
|
|
2634
|
+
}
|
|
2635
|
+
|
|
2636
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2637
|
+
|
|
2638
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2639
|
+
const queryParamsAvailable = { fdns, filter, limit, neFetch, offset };
|
|
2640
|
+
const queryParams = {};
|
|
2641
|
+
const pathVars = [];
|
|
2642
|
+
const bodyVars = {};
|
|
2643
|
+
|
|
2644
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2645
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2646
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2647
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2648
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2649
|
+
}
|
|
2650
|
+
});
|
|
2651
|
+
|
|
2652
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2653
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2654
|
+
const reqObj = {
|
|
2655
|
+
payload: bodyVars,
|
|
2656
|
+
uriPathVars: pathVars,
|
|
2657
|
+
uriQuery: queryParams
|
|
2658
|
+
};
|
|
2659
|
+
|
|
2660
|
+
try {
|
|
2661
|
+
// Make the call -
|
|
2662
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2663
|
+
return this.requestHandlerInst.identifyRequest('PhysicalLinks', 'getPhysicalLinksUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
2664
|
+
// if we received an error or their is no response on the results
|
|
2665
|
+
// return an error
|
|
2666
|
+
if (irReturnError) {
|
|
2667
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2668
|
+
return callback(null, irReturnError);
|
|
2669
|
+
}
|
|
2670
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2671
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getPhysicalLinksUsingGET'], null, null, null);
|
|
2672
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2673
|
+
return callback(null, errorObj);
|
|
2674
|
+
}
|
|
2675
|
+
|
|
2676
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2677
|
+
// return the response
|
|
2678
|
+
return callback(irReturnData, null);
|
|
2679
|
+
});
|
|
2680
|
+
} catch (ex) {
|
|
2681
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2682
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2683
|
+
return callback(null, errorObj);
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
/**
|
|
2688
|
+
* @function createPhysicalLinkUsingPOST
|
|
2689
|
+
* @pronghornType method
|
|
2690
|
+
* @name createPhysicalLinkUsingPOST
|
|
2691
|
+
* @summary createPhysicalLinkUsingPOST
|
|
2692
|
+
*
|
|
2693
|
+
* @param {object} physicalLink - physicalLink
|
|
2694
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2695
|
+
* @return {object} results - An object containing the response of the action
|
|
2696
|
+
*
|
|
2697
|
+
* @route {POST} /createPhysicalLinkUsingPOST
|
|
2698
|
+
* @roles admin
|
|
2699
|
+
* @task true
|
|
2700
|
+
*/
|
|
2701
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2702
|
+
createPhysicalLinkUsingPOST(physicalLink, callback) {
|
|
2703
|
+
const meth = 'adapter-createPhysicalLinkUsingPOST';
|
|
2704
|
+
const origin = `${this.id}-${meth}`;
|
|
2705
|
+
log.trace(origin);
|
|
2706
|
+
|
|
2707
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2708
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2709
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2710
|
+
return callback(null, errorObj);
|
|
2711
|
+
}
|
|
2712
|
+
|
|
2713
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2714
|
+
if (physicalLink === undefined || physicalLink === null || physicalLink === '') {
|
|
2715
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['physicalLink'], null, null, null);
|
|
2716
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2717
|
+
return callback(null, errorObj);
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2721
|
+
const queryParamsAvailable = {};
|
|
2722
|
+
const queryParams = {};
|
|
2723
|
+
const pathVars = [];
|
|
2724
|
+
const bodyVars = physicalLink;
|
|
2725
|
+
|
|
2726
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2727
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2728
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2729
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2730
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2731
|
+
}
|
|
2732
|
+
});
|
|
2733
|
+
|
|
2734
|
+
// if you want to expose addlHeaders to workflow, add it to the method signature here and in pronghorn.json
|
|
2735
|
+
let thisHeaderData = null;
|
|
2736
|
+
// if the additional headers was passed in as a string parse the json into an object
|
|
2737
|
+
if (thisHeaderData !== null && thisHeaderData.constructor === String) {
|
|
2738
|
+
try {
|
|
2739
|
+
// parse the additional headers object that was passed in
|
|
2740
|
+
thisHeaderData = JSON.parse(thisHeaderData);
|
|
2741
|
+
} catch (err) {
|
|
2742
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'addlHeaders string must be a stringified JSON', [], null, null, null);
|
|
2743
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2744
|
+
return callback(null, errorObj);
|
|
2745
|
+
}
|
|
2746
|
+
} else if (thisHeaderData === null) {
|
|
2747
|
+
thisHeaderData = { contentType: '' };
|
|
2748
|
+
}
|
|
2749
|
+
|
|
2750
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2751
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2752
|
+
const reqObj = {
|
|
2753
|
+
payload: bodyVars,
|
|
2754
|
+
uriPathVars: pathVars,
|
|
2755
|
+
uriQuery: queryParams,
|
|
2756
|
+
addlHeaders: thisHeaderData
|
|
2757
|
+
};
|
|
2758
|
+
|
|
2759
|
+
try {
|
|
2760
|
+
// Make the call -
|
|
2761
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2762
|
+
return this.requestHandlerInst.identifyRequest('PhysicalLinks', 'createPhysicalLinkUsingPOST', reqObj, true, (irReturnData, irReturnError) => {
|
|
2763
|
+
// if we received an error or their is no response on the results
|
|
2764
|
+
// return an error
|
|
2765
|
+
if (irReturnError) {
|
|
2766
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2767
|
+
return callback(null, irReturnError);
|
|
2768
|
+
}
|
|
2769
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2770
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['createPhysicalLinkUsingPOST'], null, null, null);
|
|
2771
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2772
|
+
return callback(null, errorObj);
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2776
|
+
// return the response
|
|
2777
|
+
return callback(irReturnData, null);
|
|
2778
|
+
});
|
|
2779
|
+
} catch (ex) {
|
|
2780
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2781
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2782
|
+
return callback(null, errorObj);
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
/**
|
|
2787
|
+
* @function getPhysicalLinkUsingGET
|
|
2788
|
+
* @pronghornType method
|
|
2789
|
+
* @name getPhysicalLinkUsingGET
|
|
2790
|
+
* @summary getPhysicalLinkUsingGET
|
|
2791
|
+
*
|
|
2792
|
+
* @param {string} physicalLinkFdn - physicalLinkFdn
|
|
2793
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2794
|
+
* @return {object} results - An object containing the response of the action
|
|
2795
|
+
*
|
|
2796
|
+
* @route {POST} /getPhysicalLinkUsingGET
|
|
2797
|
+
* @roles admin
|
|
2798
|
+
* @task true
|
|
2799
|
+
*/
|
|
2800
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2801
|
+
getPhysicalLinkUsingGET(physicalLinkFdn, callback) {
|
|
2802
|
+
const meth = 'adapter-getPhysicalLinkUsingGET';
|
|
2803
|
+
const origin = `${this.id}-${meth}`;
|
|
2804
|
+
log.trace(origin);
|
|
2805
|
+
|
|
2806
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2807
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2808
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2809
|
+
return callback(null, errorObj);
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2813
|
+
if (physicalLinkFdn === undefined || physicalLinkFdn === null || physicalLinkFdn === '') {
|
|
2814
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['physicalLinkFdn'], null, null, null);
|
|
2815
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2816
|
+
return callback(null, errorObj);
|
|
2817
|
+
}
|
|
2818
|
+
|
|
2819
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2820
|
+
const queryParamsAvailable = {};
|
|
2821
|
+
const queryParams = {};
|
|
2822
|
+
const pathVars = [physicalLinkFdn];
|
|
2823
|
+
const bodyVars = {};
|
|
2824
|
+
|
|
2825
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2826
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2827
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2828
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2829
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2830
|
+
}
|
|
2831
|
+
});
|
|
2832
|
+
|
|
2833
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2834
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2835
|
+
const reqObj = {
|
|
2836
|
+
payload: bodyVars,
|
|
2837
|
+
uriPathVars: pathVars,
|
|
2838
|
+
uriQuery: queryParams
|
|
2839
|
+
};
|
|
2840
|
+
|
|
2841
|
+
try {
|
|
2842
|
+
// Make the call -
|
|
2843
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2844
|
+
return this.requestHandlerInst.identifyRequest('PhysicalLinks', 'getPhysicalLinkUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
2845
|
+
// if we received an error or their is no response on the results
|
|
2846
|
+
// return an error
|
|
2847
|
+
if (irReturnError) {
|
|
2848
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2849
|
+
return callback(null, irReturnError);
|
|
2850
|
+
}
|
|
2851
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2852
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getPhysicalLinkUsingGET'], null, null, null);
|
|
2853
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2854
|
+
return callback(null, errorObj);
|
|
2855
|
+
}
|
|
2856
|
+
|
|
2857
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2858
|
+
// return the response
|
|
2859
|
+
return callback(irReturnData, null);
|
|
2860
|
+
});
|
|
2861
|
+
} catch (ex) {
|
|
2862
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2863
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2864
|
+
return callback(null, errorObj);
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
|
|
2868
|
+
/**
|
|
2869
|
+
* @function deletePhysicalLinkUsingDELETE
|
|
2870
|
+
* @pronghornType method
|
|
2871
|
+
* @name deletePhysicalLinkUsingDELETE
|
|
2872
|
+
* @summary deletePhysicalLinkUsingDELETE
|
|
2873
|
+
*
|
|
2874
|
+
* @param {string} physicalLinkFdn - physicalLinkFdn
|
|
2875
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2876
|
+
* @return {object} results - An object containing the response of the action
|
|
2877
|
+
*
|
|
2878
|
+
* @route {POST} /deletePhysicalLinkUsingDELETE
|
|
2879
|
+
* @roles admin
|
|
2880
|
+
* @task true
|
|
2881
|
+
*/
|
|
2882
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2883
|
+
deletePhysicalLinkUsingDELETE(physicalLinkFdn, callback) {
|
|
2884
|
+
const meth = 'adapter-deletePhysicalLinkUsingDELETE';
|
|
2885
|
+
const origin = `${this.id}-${meth}`;
|
|
2886
|
+
log.trace(origin);
|
|
2887
|
+
|
|
2888
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2889
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2890
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2891
|
+
return callback(null, errorObj);
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2895
|
+
if (physicalLinkFdn === undefined || physicalLinkFdn === null || physicalLinkFdn === '') {
|
|
2896
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['physicalLinkFdn'], null, null, null);
|
|
2897
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2898
|
+
return callback(null, errorObj);
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2902
|
+
const queryParamsAvailable = {};
|
|
2903
|
+
const queryParams = {};
|
|
2904
|
+
const pathVars = [physicalLinkFdn];
|
|
2905
|
+
const bodyVars = {};
|
|
2906
|
+
|
|
2907
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2908
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2909
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2910
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2911
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2912
|
+
}
|
|
2913
|
+
});
|
|
2914
|
+
|
|
2915
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2916
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2917
|
+
const reqObj = {
|
|
2918
|
+
payload: bodyVars,
|
|
2919
|
+
uriPathVars: pathVars,
|
|
2920
|
+
uriQuery: queryParams
|
|
2921
|
+
};
|
|
2922
|
+
|
|
2923
|
+
try {
|
|
2924
|
+
// Make the call -
|
|
2925
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
2926
|
+
return this.requestHandlerInst.identifyRequest('PhysicalLinks', 'deletePhysicalLinkUsingDELETE', reqObj, false, (irReturnData, irReturnError) => {
|
|
2927
|
+
// if we received an error or their is no response on the results
|
|
2928
|
+
// return an error
|
|
2929
|
+
if (irReturnError) {
|
|
2930
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
2931
|
+
return callback(null, irReturnError);
|
|
2932
|
+
}
|
|
2933
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
2934
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['deletePhysicalLinkUsingDELETE'], null, null, null);
|
|
2935
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2936
|
+
return callback(null, errorObj);
|
|
2937
|
+
}
|
|
2938
|
+
|
|
2939
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
2940
|
+
// return the response
|
|
2941
|
+
return callback(irReturnData, null);
|
|
2942
|
+
});
|
|
2943
|
+
} catch (ex) {
|
|
2944
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
2945
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2946
|
+
return callback(null, errorObj);
|
|
2947
|
+
}
|
|
2948
|
+
}
|
|
2949
|
+
|
|
2950
|
+
/**
|
|
2951
|
+
* @function getPortsUsingGET
|
|
2952
|
+
* @pronghornType method
|
|
2953
|
+
* @name getPortsUsingGET
|
|
2954
|
+
* @summary getPortsUsingGET
|
|
2955
|
+
*
|
|
2956
|
+
* @param {string} [fdns] - A comma-separated list of the Fully Distinguished Names of the NSP objects to query for.
|
|
2957
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
2958
|
+
|
|
2959
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
2960
|
+
* @param {number} [limit] - The limit on the number of objects returned (max: 1000)
|
|
2961
|
+
* @param {number} [offset] - Start row for paged data (max: total number of objects)
|
|
2962
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
2963
|
+
* @return {object} results - An object containing the response of the action
|
|
2964
|
+
*
|
|
2965
|
+
* @route {POST} /getPortsUsingGET
|
|
2966
|
+
* @roles admin
|
|
2967
|
+
* @task true
|
|
2968
|
+
*/
|
|
2969
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
2970
|
+
getPortsUsingGET(fdns, filter, limit, offset, callback) {
|
|
2971
|
+
const meth = 'adapter-getPortsUsingGET';
|
|
2972
|
+
const origin = `${this.id}-${meth}`;
|
|
2973
|
+
log.trace(origin);
|
|
2974
|
+
|
|
2975
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
2976
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
2977
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
2978
|
+
return callback(null, errorObj);
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
2982
|
+
|
|
2983
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
2984
|
+
const queryParamsAvailable = { fdns, filter, limit, offset };
|
|
2985
|
+
const queryParams = {};
|
|
2986
|
+
const pathVars = [];
|
|
2987
|
+
const bodyVars = {};
|
|
2988
|
+
|
|
2989
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
2990
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
2991
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
2992
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
2993
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
2994
|
+
}
|
|
2995
|
+
});
|
|
2996
|
+
|
|
2997
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
2998
|
+
// see adapter code documentation for more information on the request object's fields
|
|
2999
|
+
const reqObj = {
|
|
3000
|
+
payload: bodyVars,
|
|
3001
|
+
uriPathVars: pathVars,
|
|
3002
|
+
uriQuery: queryParams
|
|
3003
|
+
};
|
|
3004
|
+
|
|
3005
|
+
try {
|
|
3006
|
+
// Make the call -
|
|
3007
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
3008
|
+
return this.requestHandlerInst.identifyRequest('Ports', 'getPortsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
3009
|
+
// if we received an error or their is no response on the results
|
|
3010
|
+
// return an error
|
|
3011
|
+
if (irReturnError) {
|
|
3012
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
3013
|
+
return callback(null, irReturnError);
|
|
3014
|
+
}
|
|
3015
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
3016
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getPortsUsingGET'], null, null, null);
|
|
3017
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3018
|
+
return callback(null, errorObj);
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
3022
|
+
// return the response
|
|
3023
|
+
return callback(irReturnData, null);
|
|
3024
|
+
});
|
|
3025
|
+
} catch (ex) {
|
|
3026
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
3027
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3028
|
+
return callback(null, errorObj);
|
|
3029
|
+
}
|
|
3030
|
+
}
|
|
3031
|
+
|
|
3032
|
+
/**
|
|
3033
|
+
* @function getPortUsingGET
|
|
3034
|
+
* @pronghornType method
|
|
3035
|
+
* @name getPortUsingGET
|
|
3036
|
+
* @summary getPortUsingGET
|
|
3037
|
+
*
|
|
3038
|
+
* @param {string} portFdn - portFdn
|
|
3039
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
3040
|
+
* @return {object} results - An object containing the response of the action
|
|
3041
|
+
*
|
|
3042
|
+
* @route {POST} /getPortUsingGET
|
|
3043
|
+
* @roles admin
|
|
3044
|
+
* @task true
|
|
3045
|
+
*/
|
|
3046
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
3047
|
+
getPortUsingGET(portFdn, callback) {
|
|
3048
|
+
const meth = 'adapter-getPortUsingGET';
|
|
3049
|
+
const origin = `${this.id}-${meth}`;
|
|
3050
|
+
log.trace(origin);
|
|
3051
|
+
|
|
3052
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
3053
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
3054
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3055
|
+
return callback(null, errorObj);
|
|
3056
|
+
}
|
|
3057
|
+
|
|
3058
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
3059
|
+
if (portFdn === undefined || portFdn === null || portFdn === '') {
|
|
3060
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['portFdn'], null, null, null);
|
|
3061
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3062
|
+
return callback(null, errorObj);
|
|
3063
|
+
}
|
|
3064
|
+
|
|
3065
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
3066
|
+
const queryParamsAvailable = {};
|
|
3067
|
+
const queryParams = {};
|
|
3068
|
+
const pathVars = [portFdn];
|
|
3069
|
+
const bodyVars = {};
|
|
3070
|
+
|
|
3071
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
3072
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
3073
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
3074
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
3075
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
3076
|
+
}
|
|
3077
|
+
});
|
|
3078
|
+
|
|
3079
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
3080
|
+
// see adapter code documentation for more information on the request object's fields
|
|
3081
|
+
const reqObj = {
|
|
3082
|
+
payload: bodyVars,
|
|
3083
|
+
uriPathVars: pathVars,
|
|
3084
|
+
uriQuery: queryParams
|
|
3085
|
+
};
|
|
3086
|
+
|
|
3087
|
+
try {
|
|
3088
|
+
// Make the call -
|
|
3089
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
3090
|
+
return this.requestHandlerInst.identifyRequest('Ports', 'getPortUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
3091
|
+
// if we received an error or their is no response on the results
|
|
3092
|
+
// return an error
|
|
3093
|
+
if (irReturnError) {
|
|
3094
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
3095
|
+
return callback(null, irReturnError);
|
|
3096
|
+
}
|
|
3097
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
3098
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getPortUsingGET'], null, null, null);
|
|
3099
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3100
|
+
return callback(null, errorObj);
|
|
3101
|
+
}
|
|
3102
|
+
|
|
3103
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
3104
|
+
// return the response
|
|
3105
|
+
return callback(irReturnData, null);
|
|
3106
|
+
});
|
|
3107
|
+
} catch (ex) {
|
|
3108
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
3109
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3110
|
+
return callback(null, errorObj);
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
|
|
3114
|
+
/**
|
|
3115
|
+
* @function getRadioEquipmentsUsingGET
|
|
3116
|
+
* @pronghornType method
|
|
3117
|
+
* @name getRadioEquipmentsUsingGET
|
|
3118
|
+
* @summary getRadioEquipmentsUsingGET
|
|
3119
|
+
*
|
|
3120
|
+
* @param {string} [fdns] - A comma-separated list of the Fully Distinguished Names of the NSP objects to query for.
|
|
3121
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
3122
|
+
|
|
3123
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
3124
|
+
* @param {number} [limit] - The limit on the number of objects returned (max: 1000)
|
|
3125
|
+
* @param {number} [offset] - Start row for paged data (max: total number of objects)
|
|
3126
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
3127
|
+
* @return {object} results - An object containing the response of the action
|
|
3128
|
+
*
|
|
3129
|
+
* @route {POST} /getRadioEquipmentsUsingGET
|
|
3130
|
+
* @roles admin
|
|
3131
|
+
* @task true
|
|
3132
|
+
*/
|
|
3133
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
3134
|
+
getRadioEquipmentsUsingGET(fdns, filter, limit, offset, callback) {
|
|
3135
|
+
const meth = 'adapter-getRadioEquipmentsUsingGET';
|
|
3136
|
+
const origin = `${this.id}-${meth}`;
|
|
3137
|
+
log.trace(origin);
|
|
3138
|
+
|
|
3139
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
3140
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
3141
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3142
|
+
return callback(null, errorObj);
|
|
3143
|
+
}
|
|
3144
|
+
|
|
3145
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
3146
|
+
|
|
3147
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
3148
|
+
const queryParamsAvailable = { fdns, filter, limit, offset };
|
|
3149
|
+
const queryParams = {};
|
|
3150
|
+
const pathVars = [];
|
|
3151
|
+
const bodyVars = {};
|
|
3152
|
+
|
|
3153
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
3154
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
3155
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
3156
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
3157
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
3158
|
+
}
|
|
3159
|
+
});
|
|
3160
|
+
|
|
3161
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
3162
|
+
// see adapter code documentation for more information on the request object's fields
|
|
3163
|
+
const reqObj = {
|
|
3164
|
+
payload: bodyVars,
|
|
3165
|
+
uriPathVars: pathVars,
|
|
3166
|
+
uriQuery: queryParams
|
|
3167
|
+
};
|
|
3168
|
+
|
|
3169
|
+
try {
|
|
3170
|
+
// Make the call -
|
|
3171
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
3172
|
+
return this.requestHandlerInst.identifyRequest('RadioEquipment', 'getRadioEquipmentsUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
3173
|
+
// if we received an error or their is no response on the results
|
|
3174
|
+
// return an error
|
|
3175
|
+
if (irReturnError) {
|
|
3176
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
3177
|
+
return callback(null, irReturnError);
|
|
3178
|
+
}
|
|
3179
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
3180
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRadioEquipmentsUsingGET'], null, null, null);
|
|
3181
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3182
|
+
return callback(null, errorObj);
|
|
3183
|
+
}
|
|
3184
|
+
|
|
3185
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
3186
|
+
// return the response
|
|
3187
|
+
return callback(irReturnData, null);
|
|
3188
|
+
});
|
|
3189
|
+
} catch (ex) {
|
|
3190
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
3191
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3192
|
+
return callback(null, errorObj);
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
|
|
3196
|
+
/**
|
|
3197
|
+
* @function getRadioEquipmentUsingGET
|
|
3198
|
+
* @pronghornType method
|
|
3199
|
+
* @name getRadioEquipmentUsingGET
|
|
3200
|
+
* @summary getRadioEquipmentUsingGET
|
|
3201
|
+
*
|
|
3202
|
+
* @param {string} radioEquipmentFdn - radioEquipmentFdn
|
|
3203
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
3204
|
+
* @return {object} results - An object containing the response of the action
|
|
3205
|
+
*
|
|
3206
|
+
* @route {POST} /getRadioEquipmentUsingGET
|
|
3207
|
+
* @roles admin
|
|
3208
|
+
* @task true
|
|
3209
|
+
*/
|
|
3210
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
3211
|
+
getRadioEquipmentUsingGET(radioEquipmentFdn, callback) {
|
|
3212
|
+
const meth = 'adapter-getRadioEquipmentUsingGET';
|
|
3213
|
+
const origin = `${this.id}-${meth}`;
|
|
3214
|
+
log.trace(origin);
|
|
3215
|
+
|
|
3216
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
3217
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
3218
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3219
|
+
return callback(null, errorObj);
|
|
3220
|
+
}
|
|
3221
|
+
|
|
3222
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
3223
|
+
if (radioEquipmentFdn === undefined || radioEquipmentFdn === null || radioEquipmentFdn === '') {
|
|
3224
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['radioEquipmentFdn'], null, null, null);
|
|
3225
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3226
|
+
return callback(null, errorObj);
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
3230
|
+
const queryParamsAvailable = {};
|
|
3231
|
+
const queryParams = {};
|
|
3232
|
+
const pathVars = [radioEquipmentFdn];
|
|
3233
|
+
const bodyVars = {};
|
|
3234
|
+
|
|
3235
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
3236
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
3237
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
3238
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
3239
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
3240
|
+
}
|
|
3241
|
+
});
|
|
3242
|
+
|
|
3243
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
3244
|
+
// see adapter code documentation for more information on the request object's fields
|
|
3245
|
+
const reqObj = {
|
|
3246
|
+
payload: bodyVars,
|
|
3247
|
+
uriPathVars: pathVars,
|
|
3248
|
+
uriQuery: queryParams
|
|
3249
|
+
};
|
|
3250
|
+
|
|
3251
|
+
try {
|
|
3252
|
+
// Make the call -
|
|
3253
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
3254
|
+
return this.requestHandlerInst.identifyRequest('RadioEquipment', 'getRadioEquipmentUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
3255
|
+
// if we received an error or their is no response on the results
|
|
3256
|
+
// return an error
|
|
3257
|
+
if (irReturnError) {
|
|
3258
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
3259
|
+
return callback(null, irReturnError);
|
|
3260
|
+
}
|
|
3261
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
3262
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getRadioEquipmentUsingGET'], null, null, null);
|
|
3263
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3264
|
+
return callback(null, errorObj);
|
|
3265
|
+
}
|
|
3266
|
+
|
|
3267
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
3268
|
+
// return the response
|
|
3269
|
+
return callback(irReturnData, null);
|
|
3270
|
+
});
|
|
3271
|
+
} catch (ex) {
|
|
3272
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
3273
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3274
|
+
return callback(null, errorObj);
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
/**
|
|
3279
|
+
* @function getShelvesUsingGET
|
|
3280
|
+
* @pronghornType method
|
|
3281
|
+
* @name getShelvesUsingGET
|
|
3282
|
+
* @summary getShelvesUsingGET
|
|
3283
|
+
*
|
|
3284
|
+
* @param {string} [fdns] - A comma-separated list of the Fully Distinguished Names of the NSP objects to query for.
|
|
3285
|
+
* @param {string} [filter] - The criteria to use for filtering. Filter parameter supports NBI standard query language.
|
|
3286
|
+
|
|
3287
|
+
For example, non-encoded filter string: ?filter=name='name' AND NOT (descripti...(description truncated)
|
|
3288
|
+
* @param {number} [limit] - The limit on the number of objects returned (max: 1000)
|
|
3289
|
+
* @param {number} [offset] - Start row for paged data (max: total number of objects)
|
|
3290
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
3291
|
+
* @return {object} results - An object containing the response of the action
|
|
3292
|
+
*
|
|
3293
|
+
* @route {POST} /getShelvesUsingGET
|
|
3294
|
+
* @roles admin
|
|
3295
|
+
* @task true
|
|
3296
|
+
*/
|
|
3297
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
3298
|
+
getShelvesUsingGET(fdns, filter, limit, offset, callback) {
|
|
3299
|
+
const meth = 'adapter-getShelvesUsingGET';
|
|
3300
|
+
const origin = `${this.id}-${meth}`;
|
|
3301
|
+
log.trace(origin);
|
|
3302
|
+
|
|
3303
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
3304
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
3305
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3306
|
+
return callback(null, errorObj);
|
|
3307
|
+
}
|
|
3308
|
+
|
|
3309
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
3310
|
+
|
|
3311
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
3312
|
+
const queryParamsAvailable = { fdns, filter, limit, offset };
|
|
3313
|
+
const queryParams = {};
|
|
3314
|
+
const pathVars = [];
|
|
3315
|
+
const bodyVars = {};
|
|
3316
|
+
|
|
3317
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
3318
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
3319
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
3320
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
3321
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
3322
|
+
}
|
|
3323
|
+
});
|
|
3324
|
+
|
|
3325
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
3326
|
+
// see adapter code documentation for more information on the request object's fields
|
|
3327
|
+
const reqObj = {
|
|
3328
|
+
payload: bodyVars,
|
|
3329
|
+
uriPathVars: pathVars,
|
|
3330
|
+
uriQuery: queryParams
|
|
3331
|
+
};
|
|
3332
|
+
|
|
3333
|
+
try {
|
|
3334
|
+
// Make the call -
|
|
3335
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
3336
|
+
return this.requestHandlerInst.identifyRequest('Shelves', 'getShelvesUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
3337
|
+
// if we received an error or their is no response on the results
|
|
3338
|
+
// return an error
|
|
3339
|
+
if (irReturnError) {
|
|
3340
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
3341
|
+
return callback(null, irReturnError);
|
|
3342
|
+
}
|
|
3343
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
3344
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getShelvesUsingGET'], null, null, null);
|
|
3345
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3346
|
+
return callback(null, errorObj);
|
|
3347
|
+
}
|
|
3348
|
+
|
|
3349
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
3350
|
+
// return the response
|
|
3351
|
+
return callback(irReturnData, null);
|
|
3352
|
+
});
|
|
3353
|
+
} catch (ex) {
|
|
3354
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
3355
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3356
|
+
return callback(null, errorObj);
|
|
3357
|
+
}
|
|
3358
|
+
}
|
|
3359
|
+
|
|
3360
|
+
/**
|
|
3361
|
+
* @function getShelfUsingGET
|
|
3362
|
+
* @pronghornType method
|
|
3363
|
+
* @name getShelfUsingGET
|
|
3364
|
+
* @summary getShelfUsingGET
|
|
3365
|
+
*
|
|
3366
|
+
* @param {string} shelfFdn - shelfFdn
|
|
3367
|
+
* @param {getCallback} callback - a callback function to return the result
|
|
3368
|
+
* @return {object} results - An object containing the response of the action
|
|
3369
|
+
*
|
|
3370
|
+
* @route {POST} /getShelfUsingGET
|
|
3371
|
+
* @roles admin
|
|
3372
|
+
* @task true
|
|
3373
|
+
*/
|
|
3374
|
+
/* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
|
|
3375
|
+
getShelfUsingGET(shelfFdn, callback) {
|
|
3376
|
+
const meth = 'adapter-getShelfUsingGET';
|
|
3377
|
+
const origin = `${this.id}-${meth}`;
|
|
3378
|
+
log.trace(origin);
|
|
3379
|
+
|
|
3380
|
+
if (this.suspended && this.suspendMode === 'error') {
|
|
3381
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
|
|
3382
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3383
|
+
return callback(null, errorObj);
|
|
3384
|
+
}
|
|
3385
|
+
|
|
3386
|
+
/* HERE IS WHERE YOU VALIDATE DATA */
|
|
3387
|
+
if (shelfFdn === undefined || shelfFdn === null || shelfFdn === '') {
|
|
3388
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Missing Data', ['shelfFdn'], null, null, null);
|
|
3389
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3390
|
+
return callback(null, errorObj);
|
|
3391
|
+
}
|
|
3392
|
+
|
|
3393
|
+
/* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
|
|
3394
|
+
const queryParamsAvailable = {};
|
|
3395
|
+
const queryParams = {};
|
|
3396
|
+
const pathVars = [shelfFdn];
|
|
3397
|
+
const bodyVars = {};
|
|
3398
|
+
|
|
3399
|
+
// loop in template. long callback arg name to avoid identifier conflicts
|
|
3400
|
+
Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
|
|
3401
|
+
if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
|
|
3402
|
+
&& queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
|
|
3403
|
+
queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
|
|
3404
|
+
}
|
|
3405
|
+
});
|
|
3406
|
+
|
|
3407
|
+
// set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
|
|
3408
|
+
// see adapter code documentation for more information on the request object's fields
|
|
3409
|
+
const reqObj = {
|
|
3410
|
+
payload: bodyVars,
|
|
3411
|
+
uriPathVars: pathVars,
|
|
3412
|
+
uriQuery: queryParams
|
|
3413
|
+
};
|
|
3414
|
+
|
|
3415
|
+
try {
|
|
3416
|
+
// Make the call -
|
|
3417
|
+
// identifyRequest(entity, action, requestObj, returnDataFlag, callback)
|
|
3418
|
+
return this.requestHandlerInst.identifyRequest('Shelves', 'getShelfUsingGET', reqObj, true, (irReturnData, irReturnError) => {
|
|
3419
|
+
// if we received an error or their is no response on the results
|
|
3420
|
+
// return an error
|
|
3421
|
+
if (irReturnError) {
|
|
3422
|
+
/* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
|
|
3423
|
+
return callback(null, irReturnError);
|
|
3424
|
+
}
|
|
3425
|
+
if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
|
|
3426
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['getShelfUsingGET'], null, null, null);
|
|
3427
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3428
|
+
return callback(null, errorObj);
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
/* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
|
|
3432
|
+
// return the response
|
|
3433
|
+
return callback(irReturnData, null);
|
|
3434
|
+
});
|
|
3435
|
+
} catch (ex) {
|
|
3436
|
+
const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
|
|
3437
|
+
log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
|
|
3438
|
+
return callback(null, errorObj);
|
|
3439
|
+
}
|
|
3440
|
+
}
|
|
3441
|
+
}
|
|
3442
|
+
|
|
3443
|
+
module.exports = NokiaNspNetwork;
|