@itentialopensource/adapter-nokia_nsp_nfm_p 0.3.0 → 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "0.2.3",
3
- "configLines": 96991,
2
+ "version": "0.3.0",
3
+ "configLines": 96020,
4
4
  "scriptLines": 1783,
5
- "codeLines": 129500,
6
- "testLines": 82566,
7
- "testCases": 4211,
8
- "totalCodeLines": 213849,
9
- "wfTasks": 1615
5
+ "codeLines": 129808,
6
+ "testLines": 82718,
7
+ "testCases": 4219,
8
+ "totalCodeLines": 214309,
9
+ "wfTasks": 1619
10
10
  }
@@ -0,0 +1,208 @@
1
+ {
2
+ "swagger": "2.0",
3
+ "info": {
4
+ "description": "The SAM-O Restful API endpoints allows to :\n<BR> 1) Convert an XML document to JSON. The conversion is a straightforward conversion of the original XML document. \n<BR> 2) Send a JSON formatted request to the NFMP server. This JSON corresponds to what was converted by this REST service.\n<BR><p><b><u>Access Information:</u></b></p>Prior to accessing the API services below the API client must authenticate the NSP user via the NSP REST Gateway's authentication API service.\n<BR>One authentication method is supported:\n<ul><li>\"Bearer\" token authentication.</li></ul><p><b><u>Note: </u></b></p> XML request bodies which contain CDATA formatted text are not supported.<p><b><u>Deprecation notice: </u></b></p> NFM-P SAM-O (Including SOAP XML, SAM-O REST v1, v2, v3, and JMS Interfaces) are now deprecated. Starting in NSP Release 23, all new greenfield northbound integrations with NSP must be done using the new NSP REST/RESTCONF APIs and Kafka interfaces. <BR>Brownfield upgrades with northbound integrations towards NFM-P SAM-O (SOAP/XML, SAM-O v1,v2,v3 and JMS Interfaces) can continue to use those legacy APIs until end of 2025. NFM-P SAM-O (SOAP/XML, SAM-O v1, v2, v3 and JMS Interfaces) will no longer be available for brownfield upgrades of northbound integrations starting in NSP Release 26. <BR>Customers are encouraged to use the NSP REST/RESTCONF v3 APIs.<BR> <BR>",
5
+ "title": "SAM-O Restful Api Endpoints",
6
+ "version": "v3"
7
+ },
8
+ "basePath": "/nfmpv3service/api",
9
+ "tags": [
10
+ {
11
+ "name": "API v3"
12
+ }
13
+ ],
14
+ "schemes": [
15
+ "https",
16
+ "http"
17
+ ],
18
+ "paths": {
19
+ "/v3/xml-to-json": {
20
+ "post": {
21
+ "tags": [
22
+ "API v3"
23
+ ],
24
+ "summary": "NFMP REST-API v3 convert XML to JSON command",
25
+ "description": "Use this endpoint to convert any XML or SOAP XML message, and it will return the proper JSON body that you can use for the v3 api.For example, the client makes the following HTTP request:\n \n\n POST /v3/xml-to-json HTTP/1.1\n Host: server.example.com\n Authorization: Bearer 1eW2zZEKjY3r9WS6Ek7QAiUatKlplVaNWiTM7ElAQ0M%3D\n Content-Type: application/xml\n\n <find xmlns=\"xmlapi_1.0\"><fullClassName>aclfilter.IpFilter</fullClassName></find>\n \n\n\n Which returns: \n\n {\"find\": {\"fullClassName\": \"aclfilter.IpFilter\"}}",
26
+ "operationId": "xmltojsonEndpoint",
27
+ "consumes": [
28
+ "application/xml"
29
+ ],
30
+ "produces": [
31
+ "application/json"
32
+ ],
33
+ "parameters": [
34
+ {
35
+ "in": "body",
36
+ "name": "body",
37
+ "required": false,
38
+ "schema": {
39
+ "type": "string"
40
+ }
41
+ }
42
+ ],
43
+ "responses": {
44
+ "200": {
45
+ "description": "Returns a successful object"
46
+ },
47
+ "401": {
48
+ "description": "Unauthorized"
49
+ },
50
+ "404": {
51
+ "description": "Not found"
52
+ },
53
+ "500": {
54
+ "description": "Internal server problems"
55
+ }
56
+ }
57
+ }
58
+ },
59
+ "/v3/xml": {
60
+ "post": {
61
+ "tags": [
62
+ "API v3"
63
+ ],
64
+ "summary": "NFMP REST-API v3 'xml' command",
65
+ "description": "This is the XML REST_API endpoint. Use this endpoint to send XML directly instead of JSON. For example, the client makes the following HTTP request:\n \n\n POST /v3/xml HTTP/1.1\n Host: server.example.com\n Authorization: Bearer 1eW2zZEKjY3r9WS6Ek7QAiUatKlplVaNWiTM7ElAQ0M%3D\n Content-Type: application/xml\n\n <find><fullClassName>aclfilter.IpFilter</fullClassName></find>",
66
+ "operationId": "xmlEndpoint",
67
+ "consumes": [
68
+ "application/xml"
69
+ ],
70
+ "produces": [
71
+ "application/xml"
72
+ ],
73
+ "parameters": [
74
+ {
75
+ "in": "body",
76
+ "name": "body",
77
+ "required": false,
78
+ "schema": {
79
+ "type": "string"
80
+ }
81
+ }
82
+ ],
83
+ "security": [
84
+ {
85
+ "api_key": []
86
+ }
87
+ ],
88
+ "responses": {
89
+ "200": {
90
+ "description": "Returns a successful object"
91
+ },
92
+ "401": {
93
+ "description": "Unauthorized"
94
+ },
95
+ "404": {
96
+ "description": "Not found"
97
+ },
98
+ "500": {
99
+ "description": "Internal server problems"
100
+ }
101
+ }
102
+ }
103
+ },
104
+ "/v3/request": {
105
+ "post": {
106
+ "tags": [
107
+ "API v3"
108
+ ],
109
+ "summary": "NFMP REST-API v3 'request' command",
110
+ "description": "This is the NFMP REST_API endpoint. Use this endpoint to send your converted JSON and obtain a JSON response. For example, the client makes the following HTTP request:\n \n\n POST /v3/request HTTP/1.1\n Host: server.example.com\n Authorization: Bearer 1eW2zZEKjY3r9WS6Ek7QAiUatKlplVaNWiTM7ElAQ0M%3D\n Content-Type: application/json\n\n Example that returns JSON response:\n {\"fullClassName\":[\"netw.NetworkElement\"], \"fileName\": \"myFile.xml\", \"resultFilter\": { \"attributes\": [\"objectFullName\",\"siteId\"] } }\n\n\n<b>Important Note</b>: The /v3/request 'find' response will be in SOAP XML format only. \n It is recommended to use the /v3/find request for REST-API v3 'find' requests and it is mandatory for any v3 request that would result in a large response message greater than 12 MB. \n The return error code will be 500 if a response message size is too large. \n\n<b>Deprecation Notice</b>: The /v3/request 'find' request will be removed in NSP 23.03 release because of the above limitation.\n",
111
+ "operationId": "requestEndpoint",
112
+ "consumes": [
113
+ "application/json"
114
+ ],
115
+ "produces": [
116
+ "application/json"
117
+ ],
118
+ "parameters": [
119
+ {
120
+ "in": "body",
121
+ "name": "body",
122
+ "required": false,
123
+ "schema": {
124
+ "type": "object",
125
+ "additionalProperties": {
126
+ "type": "object"
127
+ }
128
+ }
129
+ }
130
+ ],
131
+ "security": [
132
+ {
133
+ "api_key": []
134
+ }
135
+ ],
136
+ "responses": {
137
+ "200": {
138
+ "description": "Returns a successful object"
139
+ },
140
+ "401": {
141
+ "description": "Unauthorized"
142
+ },
143
+ "404": {
144
+ "description": "Not found"
145
+ },
146
+ "500": {
147
+ "description": "Internal server problems"
148
+ }
149
+ }
150
+ }
151
+ },
152
+ "/v3/find": {
153
+ "post": {
154
+ "tags": [
155
+ "API v3"
156
+ ],
157
+ "summary": "NFMP REST-API v3 'find' command",
158
+ "description": "This is the recommended endpoint for performing a REST- API v3 \"find\" requests and it is mandatory for any finds with a large result set. The response is only in XML format. For example, the client makes the following HTTP request:\n \n \n POST /v3/find HTTP/1.1\n Host: server.example.com\n Authorization: Bearer 1eW2zZEKjY3r9WS6Ek7QAiUatKlplVaNWiTM7ElAQ0M%3D\n Content-Type: application/json\n\n {\"find\": {\n \"fullClassName\": \"security.User\",\n \"resultFilter\": {\n \"children\": \"\",\n \"attribute\": [\n \"objectFullName\",\n \"userName\",\n \"userGroup\"\n ]\n }\n }}\n \n XML response:\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <result>\n <security.User>\n <userName>admin</userName>\n <userGroup>securityManager:userGroup-admin</userGroup>\n <objectFullName>securityManager:user-admin</objectFullName>\n </security.User>\n <security.User>\n <userName>SAMqa</userName>\n <userGroup>securityManager:userGroup-GSAMqa</userGroup>\n <objectFullName>securityManager:user-SAMqa</objectFullName>\n </security.User>\n </result>\n",
159
+ "operationId": "findEndpoint",
160
+ "consumes": [
161
+ "application/json"
162
+ ],
163
+ "produces": [
164
+ "application/octet-stream"
165
+ ],
166
+ "parameters": [
167
+ {
168
+ "in": "body",
169
+ "name": "body",
170
+ "required": false,
171
+ "schema": {
172
+ "type": "object",
173
+ "additionalProperties": {
174
+ "type": "object"
175
+ }
176
+ }
177
+ }
178
+ ],
179
+ "security": [
180
+ {
181
+ "api_key": []
182
+ }
183
+ ],
184
+ "responses": {
185
+ "200": {
186
+ "description": "Returns a successful object"
187
+ },
188
+ "401": {
189
+ "description": "Unauthorized"
190
+ },
191
+ "404": {
192
+ "description": "Not found"
193
+ },
194
+ "500": {
195
+ "description": "Internal server problems"
196
+ }
197
+ }
198
+ }
199
+ }
200
+ },
201
+ "securityDefinitions": {
202
+ "api_key": {
203
+ "type": "apiKey",
204
+ "name": "Authorization",
205
+ "in": "header"
206
+ }
207
+ }
208
+ }
@@ -45694,5 +45694,109 @@ describe('[integration] Nokia_nsp_nfm_p Adapter Test', () => {
45694
45694
  }
45695
45695
  }).timeout(attemptTimeout);
45696
45696
  });
45697
+
45698
+ const aPIV3XmltojsonEndpointBodyParam = {};
45699
+ describe('#xmltojsonEndpoint - errors', () => {
45700
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
45701
+ try {
45702
+ a.xmltojsonEndpoint(aPIV3XmltojsonEndpointBodyParam, (data, error) => {
45703
+ try {
45704
+ if (stub) {
45705
+ const displayE = 'Error 400 received on request';
45706
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_nfm_p-connectorRest-handleEndResponse', displayE);
45707
+ } else {
45708
+ runCommonAsserts(data, error);
45709
+ }
45710
+ saveMockData('APIV3', 'xmltojsonEndpoint', 'default', data);
45711
+ done();
45712
+ } catch (err) {
45713
+ log.error(`Test Failure: ${err}`);
45714
+ done(err);
45715
+ }
45716
+ });
45717
+ } catch (error) {
45718
+ log.error(`Adapter Exception: ${error}`);
45719
+ done(error);
45720
+ }
45721
+ }).timeout(attemptTimeout);
45722
+ });
45723
+
45724
+ const aPIV3XmlEndpointBodyParam = {};
45725
+ describe('#xmlEndpoint - errors', () => {
45726
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
45727
+ try {
45728
+ a.xmlEndpoint(aPIV3XmlEndpointBodyParam, (data, error) => {
45729
+ try {
45730
+ if (stub) {
45731
+ const displayE = 'Error 400 received on request';
45732
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_nfm_p-connectorRest-handleEndResponse', displayE);
45733
+ } else {
45734
+ runCommonAsserts(data, error);
45735
+ }
45736
+ saveMockData('APIV3', 'xmlEndpoint', 'default', data);
45737
+ done();
45738
+ } catch (err) {
45739
+ log.error(`Test Failure: ${err}`);
45740
+ done(err);
45741
+ }
45742
+ });
45743
+ } catch (error) {
45744
+ log.error(`Adapter Exception: ${error}`);
45745
+ done(error);
45746
+ }
45747
+ }).timeout(attemptTimeout);
45748
+ });
45749
+
45750
+ const aPIV3requestEndpointBodyParam = {};
45751
+ describe('#requestEndpoint - errors', () => {
45752
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
45753
+ try {
45754
+ a.requestEndpoint(aPIV3requestEndpointBodyParam, (data, error) => {
45755
+ try {
45756
+ if (stub) {
45757
+ const displayE = 'Error 400 received on request';
45758
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_nfm_p-connectorRest-handleEndResponse', displayE);
45759
+ } else {
45760
+ runCommonAsserts(data, error);
45761
+ }
45762
+ saveMockData('APIV3', 'requestEndpoint', 'default', data);
45763
+ done();
45764
+ } catch (err) {
45765
+ log.error(`Test Failure: ${err}`);
45766
+ done(err);
45767
+ }
45768
+ });
45769
+ } catch (error) {
45770
+ log.error(`Adapter Exception: ${error}`);
45771
+ done(error);
45772
+ }
45773
+ }).timeout(attemptTimeout);
45774
+ });
45775
+
45776
+ const aPIV3FindBodyParam = {};
45777
+ describe('#findEndpoint - errors', () => {
45778
+ it('should work if integrated but since no mockdata should error when run standalone', (done) => {
45779
+ try {
45780
+ a.findEndpoint(aPIV3FindBodyParam, (data, error) => {
45781
+ try {
45782
+ if (stub) {
45783
+ const displayE = 'Error 400 received on request';
45784
+ runErrorAsserts(data, error, 'AD.500', 'Test-nokia_nsp_nfm_p-connectorRest-handleEndResponse', displayE);
45785
+ } else {
45786
+ runCommonAsserts(data, error);
45787
+ }
45788
+ saveMockData('APIV3', 'findEndpoint', 'default', data);
45789
+ done();
45790
+ } catch (err) {
45791
+ log.error(`Test Failure: ${err}`);
45792
+ done(err);
45793
+ }
45794
+ });
45795
+ } catch (error) {
45796
+ log.error(`Adapter Exception: ${error}`);
45797
+ done(error);
45798
+ }
45799
+ }).timeout(attemptTimeout);
45800
+ });
45697
45801
  });
45698
45802
  });
@@ -314,16 +314,16 @@ describe('[unit] Nokia_nsp_nfm_p Adapter Test', () => {
314
314
  assert.notEqual(undefined, packageDotJson.dependencies);
315
315
  assert.notEqual(null, packageDotJson.dependencies);
316
316
  assert.notEqual('', packageDotJson.dependencies);
317
- assert.equal('^8.12.0', packageDotJson.dependencies.ajv);
318
- assert.equal('^1.6.8', packageDotJson.dependencies.axios);
317
+ assert.equal('^8.17.1', packageDotJson.dependencies.ajv);
318
+ assert.equal('^1.7.2', packageDotJson.dependencies.axios);
319
319
  assert.equal('^11.0.0', packageDotJson.dependencies.commander);
320
- assert.equal('^11.1.1', packageDotJson.dependencies['fs-extra']);
321
- assert.equal('^10.3.0', packageDotJson.dependencies.mocha);
320
+ assert.equal('^11.2.0', packageDotJson.dependencies['fs-extra']);
321
+ assert.equal('^10.7.0', packageDotJson.dependencies.mocha);
322
322
  assert.equal('^2.0.1', packageDotJson.dependencies['mocha-param']);
323
323
  assert.equal('^0.4.4', packageDotJson.dependencies.ping);
324
324
  assert.equal('^1.4.10', packageDotJson.dependencies['readline-sync']);
325
- assert.equal('^7.5.3', packageDotJson.dependencies.semver);
326
- assert.equal('^3.9.0', packageDotJson.dependencies.winston);
325
+ assert.equal('^7.6.3', packageDotJson.dependencies.semver);
326
+ assert.equal('^3.13.1', packageDotJson.dependencies.winston);
327
327
  done();
328
328
  } catch (error) {
329
329
  log.error(`Test Failure: ${error}`);
@@ -561,7 +561,7 @@ describe('[unit] Nokia_nsp_nfm_p Adapter Test', () => {
561
561
  log.error(`Adapter Exception: ${error}`);
562
562
  done(error);
563
563
  }
564
- });
564
+ }).timeout(attemptTimeout);
565
565
  });
566
566
 
567
567
  describe('propertiesSchema.json', () => {
@@ -35610,5 +35610,53 @@ describe('[unit] Nokia_nsp_nfm_p Adapter Test', () => {
35610
35610
  }
35611
35611
  }).timeout(attemptTimeout);
35612
35612
  });
35613
+
35614
+ describe('#xmltojsonEndpoint - errors', () => {
35615
+ it('should have a xmltojsonEndpoint function', (done) => {
35616
+ try {
35617
+ assert.equal(true, typeof a.xmltojsonEndpoint === 'function');
35618
+ done();
35619
+ } catch (error) {
35620
+ log.error(`Test Failure: ${error}`);
35621
+ done(error);
35622
+ }
35623
+ }).timeout(attemptTimeout);
35624
+ });
35625
+
35626
+ describe('#xmlEndpoint - errors', () => {
35627
+ it('should have a xmlEndpoint function', (done) => {
35628
+ try {
35629
+ assert.equal(true, typeof a.xmlEndpoint === 'function');
35630
+ done();
35631
+ } catch (error) {
35632
+ log.error(`Test Failure: ${error}`);
35633
+ done(error);
35634
+ }
35635
+ }).timeout(attemptTimeout);
35636
+ });
35637
+
35638
+ describe('#requestEndpoint - errors', () => {
35639
+ it('should have a requestEndpoint function', (done) => {
35640
+ try {
35641
+ assert.equal(true, typeof a.requestEndpoint === 'function');
35642
+ done();
35643
+ } catch (error) {
35644
+ log.error(`Test Failure: ${error}`);
35645
+ done(error);
35646
+ }
35647
+ }).timeout(attemptTimeout);
35648
+ });
35649
+
35650
+ describe('#findEndpoint - errors', () => {
35651
+ it('should have a findEndpoint function', (done) => {
35652
+ try {
35653
+ assert.equal(true, typeof a.findEndpoint === 'function');
35654
+ done();
35655
+ } catch (error) {
35656
+ log.error(`Test Failure: ${error}`);
35657
+ done(error);
35658
+ }
35659
+ }).timeout(attemptTimeout);
35660
+ });
35613
35661
  });
35614
35662
  });