@itentialopensource/adapter-nokia_nsp_nfm_p 0.3.0 → 0.3.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/CALLS.md CHANGED
@@ -9742,5 +9742,29 @@ Specific adapter calls are built based on the API of the Nokia_NSP_NFM-P. The Ad
9742
9742
  <td style="padding:15px">{base_path}/{version}/v2/wpp/WppHost/requestClearWppHostsLoggingOut?{query}</td>
9743
9743
  <td style="padding:15px">Yes</td>
9744
9744
  </tr>
9745
+ <tr>
9746
+ <td style="padding:15px">xmltojsonEndpoint(body, callback)</td>
9747
+ <td style="padding:15px">NFMP REST-API v3 convert XML to JSON command</td>
9748
+ <td style="padding:15px">{base_path}/{version}/v3/xml-to-json?{query}</td>
9749
+ <td style="padding:15px">Yes</td>
9750
+ </tr>
9751
+ <tr>
9752
+ <td style="padding:15px">xmlEndpoint(body, callback)</td>
9753
+ <td style="padding:15px">NFMP REST-API v3 'xml' command</td>
9754
+ <td style="padding:15px">{base_path}/{version}/v3/xml?{query}</td>
9755
+ <td style="padding:15px">Yes</td>
9756
+ </tr>
9757
+ <tr>
9758
+ <td style="padding:15px">requestEndpoint(body, callback)</td>
9759
+ <td style="padding:15px">NFMP REST-API v3 'request' command</td>
9760
+ <td style="padding:15px">{base_path}/{version}/v3/request?{query}</td>
9761
+ <td style="padding:15px">Yes</td>
9762
+ </tr>
9763
+ <tr>
9764
+ <td style="padding:15px">findEndpoint(body, callback)</td>
9765
+ <td style="padding:15px">NFMP REST-API v3 'find' command</td>
9766
+ <td style="padding:15px">{base_path}/{version}/v3/find?{query}</td>
9767
+ <td style="padding:15px">Yes</td>
9768
+ </tr>
9745
9769
  </table>
9746
9770
  <br>
package/CHANGELOG.md CHANGED
@@ -1,4 +1,12 @@
1
1
 
2
+ ## 0.3.1 [05-30-2024]
3
+
4
+ * Add New Calls
5
+
6
+ See merge request itentialopensource/adapters/adapter-nokia_nsp_nfm_p!10
7
+
8
+ ---
9
+
2
10
  ## 0.3.0 [05-09-2024]
3
11
 
4
12
  * Minor/2024 auto migration
package/TAB2.md CHANGED
@@ -314,7 +314,7 @@ Sample Properties can be used to help you configure the adapter in the Itential
314
314
  }
315
315
  }
316
316
  ```
317
- ### [Swagger](https://gitlab.com/itentialopensource/adapters/sd-wan/adapter-nokia_nsp_nfm_p/-/blob/master/report/adapter-openapi.json)
317
+ ### [Swagger](https://gitlab.com/itentialopensource/adapters/adapter-nokia_nsp_nfm_p/-/blob/master/report/adapter-openapi.json)
318
318
 
319
- ## [Generic Adapter Information](https://gitlab.com/itentialopensource/adapters/sd-wan/adapter-nokia_nsp_nfm_p/-/blob/master/README.md)
319
+ ## [Generic Adapter Information](https://gitlab.com/itentialopensource/adapters/adapter-nokia_nsp_nfm_p/-/blob/master/README.md)
320
320
 
package/adapter.js CHANGED
@@ -128041,6 +128041,314 @@ class NokiaNSPNFMP extends AdapterBaseCl {
128041
128041
  return callback(null, errorObj);
128042
128042
  }
128043
128043
  }
128044
+
128045
+ /**
128046
+ * @function xmltojsonEndpoint
128047
+ * @pronghornType method
128048
+ * @name xmltojsonEndpoint
128049
+ * @summary NFMP REST-API v3 convert XML to JSON command
128050
+ *
128051
+ * @param {string} [body] - body param
128052
+ * @param {getCallback} callback - a callback function to return the result
128053
+ * @return {object} results - An object containing the response of the action
128054
+ *
128055
+ * @route {POST} /xmltojsonEndpoint
128056
+ * @roles admin
128057
+ * @task true
128058
+ */
128059
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
128060
+ xmltojsonEndpoint(body, callback) {
128061
+ const meth = 'adapter-xmltojsonEndpoint';
128062
+ const origin = `${this.id}-${meth}`;
128063
+ log.trace(origin);
128064
+
128065
+ if (this.suspended && this.suspendMode === 'error') {
128066
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
128067
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128068
+ return callback(null, errorObj);
128069
+ }
128070
+
128071
+ /* HERE IS WHERE YOU VALIDATE DATA */
128072
+
128073
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
128074
+ const queryParamsAvailable = {};
128075
+ const queryParams = {};
128076
+ const pathVars = [];
128077
+ const bodyVars = { body };
128078
+
128079
+ // loop in template. long callback arg name to avoid identifier conflicts
128080
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
128081
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
128082
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
128083
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
128084
+ }
128085
+ });
128086
+
128087
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
128088
+ // see adapter code documentation for more information on the request object's fields
128089
+ const reqObj = {
128090
+ payload: bodyVars,
128091
+ uriPathVars: pathVars,
128092
+ uriQuery: queryParams
128093
+ };
128094
+
128095
+ try {
128096
+ // Make the call -
128097
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
128098
+ return this.requestHandlerInst.identifyRequest('APIV3', 'xmltojsonEndpoint', reqObj, true, (irReturnData, irReturnError) => {
128099
+ // if we received an error or their is no response on the results
128100
+ // return an error
128101
+ if (irReturnError) {
128102
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
128103
+ return callback(null, irReturnError);
128104
+ }
128105
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
128106
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['xmltojsonEndpoint'], null, null, null);
128107
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128108
+ return callback(null, errorObj);
128109
+ }
128110
+
128111
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
128112
+ // return the response
128113
+ return callback(irReturnData, null);
128114
+ });
128115
+ } catch (ex) {
128116
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
128117
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128118
+ return callback(null, errorObj);
128119
+ }
128120
+ }
128121
+
128122
+ /**
128123
+ * @function xmlEndpoint
128124
+ * @pronghornType method
128125
+ * @name xmlEndpoint
128126
+ * @summary NFMP REST-API v3 &#39;xml&#39; command
128127
+ *
128128
+ * @param {string} [body] - body param
128129
+ * @param {getCallback} callback - a callback function to return the result
128130
+ * @return {object} results - An object containing the response of the action
128131
+ *
128132
+ * @route {POST} /xmlEndpoint
128133
+ * @roles admin
128134
+ * @task true
128135
+ */
128136
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
128137
+ xmlEndpoint(body, callback) {
128138
+ const meth = 'adapter-xmlEndpoint';
128139
+ const origin = `${this.id}-${meth}`;
128140
+ log.trace(origin);
128141
+
128142
+ if (this.suspended && this.suspendMode === 'error') {
128143
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
128144
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128145
+ return callback(null, errorObj);
128146
+ }
128147
+
128148
+ /* HERE IS WHERE YOU VALIDATE DATA */
128149
+
128150
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
128151
+ const queryParamsAvailable = {};
128152
+ const queryParams = {};
128153
+ const pathVars = [];
128154
+ const bodyVars = { body };
128155
+
128156
+ // loop in template. long callback arg name to avoid identifier conflicts
128157
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
128158
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
128159
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
128160
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
128161
+ }
128162
+ });
128163
+
128164
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
128165
+ // see adapter code documentation for more information on the request object's fields
128166
+ const reqObj = {
128167
+ payload: bodyVars,
128168
+ uriPathVars: pathVars,
128169
+ uriQuery: queryParams
128170
+ };
128171
+
128172
+ try {
128173
+ // Make the call -
128174
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
128175
+ return this.requestHandlerInst.identifyRequest('APIV3', 'xmlEndpoint', reqObj, true, (irReturnData, irReturnError) => {
128176
+ // if we received an error or their is no response on the results
128177
+ // return an error
128178
+ if (irReturnError) {
128179
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
128180
+ return callback(null, irReturnError);
128181
+ }
128182
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
128183
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['xmlEndpoint'], null, null, null);
128184
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128185
+ return callback(null, errorObj);
128186
+ }
128187
+
128188
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
128189
+ // return the response
128190
+ return callback(irReturnData, null);
128191
+ });
128192
+ } catch (ex) {
128193
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
128194
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128195
+ return callback(null, errorObj);
128196
+ }
128197
+ }
128198
+
128199
+ /**
128200
+ * @function requestEndpoint
128201
+ * @pronghornType method
128202
+ * @name requestEndpoint
128203
+ * @summary NFMP REST-API v3 &#39;request&#39; command
128204
+ *
128205
+ * @param {object} [body] - body param
128206
+ * @param {getCallback} callback - a callback function to return the result
128207
+ * @return {object} results - An object containing the response of the action
128208
+ *
128209
+ * @route {POST} /requestEndpoint
128210
+ * @roles admin
128211
+ * @task true
128212
+ */
128213
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
128214
+ requestEndpoint(body, callback) {
128215
+ const meth = 'adapter-requestEndpoint';
128216
+ const origin = `${this.id}-${meth}`;
128217
+ log.trace(origin);
128218
+
128219
+ if (this.suspended && this.suspendMode === 'error') {
128220
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
128221
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128222
+ return callback(null, errorObj);
128223
+ }
128224
+
128225
+ /* HERE IS WHERE YOU VALIDATE DATA */
128226
+
128227
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
128228
+ const queryParamsAvailable = {};
128229
+ const queryParams = {};
128230
+ const pathVars = [];
128231
+ const bodyVars = body;
128232
+
128233
+ // loop in template. long callback arg name to avoid identifier conflicts
128234
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
128235
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
128236
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
128237
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
128238
+ }
128239
+ });
128240
+
128241
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
128242
+ // see adapter code documentation for more information on the request object's fields
128243
+ const reqObj = {
128244
+ payload: bodyVars,
128245
+ uriPathVars: pathVars,
128246
+ uriQuery: queryParams
128247
+ };
128248
+
128249
+ try {
128250
+ // Make the call -
128251
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
128252
+ return this.requestHandlerInst.identifyRequest('APIV3', 'requestEndpoint', reqObj, true, (irReturnData, irReturnError) => {
128253
+ // if we received an error or their is no response on the results
128254
+ // return an error
128255
+ if (irReturnError) {
128256
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
128257
+ return callback(null, irReturnError);
128258
+ }
128259
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
128260
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['requestEndpoint'], null, null, null);
128261
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128262
+ return callback(null, errorObj);
128263
+ }
128264
+
128265
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
128266
+ // return the response
128267
+ return callback(irReturnData, null);
128268
+ });
128269
+ } catch (ex) {
128270
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
128271
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128272
+ return callback(null, errorObj);
128273
+ }
128274
+ }
128275
+
128276
+ /**
128277
+ * @function findEndpoint
128278
+ * @pronghornType method
128279
+ * @name findEndpoint
128280
+ * @summary NFMP REST-API v3 find; command
128281
+ *
128282
+ * @param {object} [body] - body param
128283
+ * @param {getCallback} callback - a callback function to return the result
128284
+ * @return {object} results - An object containing the response of the action
128285
+ *
128286
+ * @route {POST} /find
128287
+ * @roles admin
128288
+ * @task true
128289
+ */
128290
+ /* YOU CAN CHANGE THE PARAMETERS YOU TAKE IN HERE AND IN THE pronghorn.json FILE */
128291
+ findEndpoint(body, callback) {
128292
+ const meth = 'adapter-findEndpoint';
128293
+ const origin = `${this.id}-${meth}`;
128294
+ log.trace(origin);
128295
+
128296
+ if (this.suspended && this.suspendMode === 'error') {
128297
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'AD.600', [], null, null, null);
128298
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128299
+ return callback(null, errorObj);
128300
+ }
128301
+
128302
+ /* HERE IS WHERE YOU VALIDATE DATA */
128303
+
128304
+ /* HERE IS WHERE YOU SET THE DATA TO PASS INTO REQUEST */
128305
+ const queryParamsAvailable = {};
128306
+ const queryParams = {};
128307
+ const pathVars = [];
128308
+ const bodyVars = body;
128309
+
128310
+ // loop in template. long callback arg name to avoid identifier conflicts
128311
+ Object.keys(queryParamsAvailable).forEach((thisKeyInQueryParamsAvailable) => {
128312
+ if (queryParamsAvailable[thisKeyInQueryParamsAvailable] !== undefined && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== null
128313
+ && queryParamsAvailable[thisKeyInQueryParamsAvailable] !== '') {
128314
+ queryParams[thisKeyInQueryParamsAvailable] = queryParamsAvailable[thisKeyInQueryParamsAvailable];
128315
+ }
128316
+ });
128317
+
128318
+ // set up the request object - payload, uriPathVars, uriQuery, uriOptions, addlHeaders, authData, callProperties, filter, priority, event
128319
+ // see adapter code documentation for more information on the request object's fields
128320
+ const reqObj = {
128321
+ payload: bodyVars,
128322
+ uriPathVars: pathVars,
128323
+ uriQuery: queryParams
128324
+ };
128325
+
128326
+ try {
128327
+ // Make the call -
128328
+ // identifyRequest(entity, action, requestObj, returnDataFlag, callback)
128329
+ return this.requestHandlerInst.identifyRequest('APIV3', 'findEndpoint', reqObj, true, (irReturnData, irReturnError) => {
128330
+ // if we received an error or their is no response on the results
128331
+ // return an error
128332
+ if (irReturnError) {
128333
+ /* HERE IS WHERE YOU CAN ALTER THE ERROR MESSAGE */
128334
+ return callback(null, irReturnError);
128335
+ }
128336
+ if (!Object.hasOwnProperty.call(irReturnData, 'response')) {
128337
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Invalid Response', ['findEndpoint'], null, null, null);
128338
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128339
+ return callback(null, errorObj);
128340
+ }
128341
+
128342
+ /* HERE IS WHERE YOU CAN ALTER THE RETURN DATA */
128343
+ // return the response
128344
+ return callback(irReturnData, null);
128345
+ });
128346
+ } catch (ex) {
128347
+ const errorObj = this.requestHandlerInst.formatErrorObject(this.id, meth, 'Caught Exception', null, null, null, ex);
128348
+ log.error(`${origin}: ${errorObj.IAPerror.displayString}`);
128349
+ return callback(null, errorObj);
128350
+ }
128351
+ }
128044
128352
  }
128045
128353
 
128046
128354
  module.exports = NokiaNSPNFMP;
@@ -0,0 +1,84 @@
1
+ {
2
+ "actions": [
3
+ {
4
+ "name": "xmltojsonEndpoint",
5
+ "protocol": "REST",
6
+ "method": "POST",
7
+ "entitypath": "{base_path}/{version}/v3/xml-to-json?{query}",
8
+ "requestSchema": "schema.json",
9
+ "responseSchema": "schema.json",
10
+ "timeout": 0,
11
+ "sendEmpty": false,
12
+ "requestDatatype": "XML",
13
+ "responseDatatype": "JSON",
14
+ "headers": {},
15
+ "responseObjects": [
16
+ {
17
+ "type": "default",
18
+ "key": "",
19
+ "mockFile": ""
20
+ }
21
+ ]
22
+ },
23
+ {
24
+ "name": "xmlEndpoint",
25
+ "protocol": "REST",
26
+ "method": "POST",
27
+ "entitypath": "{base_path}/{version}/v3/xml?{query}",
28
+ "requestSchema": "schema.json",
29
+ "responseSchema": "schema.json",
30
+ "timeout": 0,
31
+ "sendEmpty": false,
32
+ "requestDatatype": "XML",
33
+ "responseDatatype": "XML2JSON",
34
+ "headers": {},
35
+ "responseObjects": [
36
+ {
37
+ "type": "default",
38
+ "key": "",
39
+ "mockFile": ""
40
+ }
41
+ ]
42
+ },
43
+ {
44
+ "name": "requestEndpoint",
45
+ "protocol": "REST",
46
+ "method": "POST",
47
+ "entitypath": "{base_path}/{version}/v3/request?{query}",
48
+ "requestSchema": "schema.json",
49
+ "responseSchema": "schema.json",
50
+ "timeout": 0,
51
+ "sendEmpty": false,
52
+ "requestDatatype": "JSON",
53
+ "responseDatatype": "JSON",
54
+ "headers": {},
55
+ "responseObjects": [
56
+ {
57
+ "type": "default",
58
+ "key": "",
59
+ "mockFile": ""
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ "name": "findEndpoint",
65
+ "protocol": "REST",
66
+ "method": "POST",
67
+ "entitypath": "{base_path}/{version}/v3/find?{query}",
68
+ "requestSchema": "schema.json",
69
+ "responseSchema": "schema.json",
70
+ "timeout": 0,
71
+ "sendEmpty": false,
72
+ "requestDatatype": "JSON",
73
+ "responseDatatype": "JSON",
74
+ "headers": {},
75
+ "responseObjects": [
76
+ {
77
+ "type": "default",
78
+ "key": "",
79
+ "mockFile": ""
80
+ }
81
+ ]
82
+ }
83
+ ]
84
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$id": "schema.json",
3
+ "type": "object",
4
+ "schema": "http://json-schema.org/draft-07/schema#",
5
+ "translate": false,
6
+ "dynamicfields": true,
7
+ "properties": {
8
+ "ph_request_type": {
9
+ "type": "string",
10
+ "description": "type of request (internal to adapter)",
11
+ "default": "xmltojsonEndpoint",
12
+ "enum": [
13
+ "xmltojsonEndpoint",
14
+ "xmlEndpoint",
15
+ "requestEndpoint",
16
+ "findEndpoint"
17
+ ],
18
+ "external_name": "ph_request_type"
19
+ }
20
+ },
21
+ "definitions": {}
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itentialopensource/adapter-nokia_nsp_nfm_p",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "This adapter integrates with system described as: nfm-p(SAMO).",
5
5
  "main": "adapter.js",
6
6
  "wizardVersion": "2.44.7",