@itentialopensource/adapter-calix_cloud_devportal 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.
Files changed (109) hide show
  1. package/.eslintignore +6 -0
  2. package/.eslintrc.js +18 -0
  3. package/.gitlab/.gitkeep +0 -0
  4. package/.gitlab/issue_templates/.gitkeep +0 -0
  5. package/.gitlab/issue_templates/Default.md +17 -0
  6. package/.gitlab/issue_templates/bugReportTemplate.md +76 -0
  7. package/.gitlab/issue_templates/featureRequestTemplate.md +14 -0
  8. package/.jshintrc +0 -0
  9. package/AUTH.md +39 -0
  10. package/BROKER.md +199 -0
  11. package/CALLS.md +639 -0
  12. package/CHANGELOG.md +9 -0
  13. package/CODE_OF_CONDUCT.md +43 -0
  14. package/CONTRIBUTING.md +172 -0
  15. package/ENHANCE.md +69 -0
  16. package/LICENSE +201 -0
  17. package/PROPERTIES.md +641 -0
  18. package/README.md +337 -0
  19. package/SUMMARY.md +9 -0
  20. package/SYSTEMINFO.md +11 -0
  21. package/TROUBLESHOOT.md +47 -0
  22. package/adapter.js +6609 -0
  23. package/adapterBase.js +1787 -0
  24. package/entities/.generic/action.json +214 -0
  25. package/entities/.generic/schema.json +28 -0
  26. package/entities/.system/action.json +50 -0
  27. package/entities/.system/mockdatafiles/getToken-default.json +6 -0
  28. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  29. package/entities/.system/schema.json +19 -0
  30. package/entities/.system/schemaTokenReq.json +75 -0
  31. package/entities/.system/schemaTokenResp.json +53 -0
  32. package/entities/AccessLogs/action.json +25 -0
  33. package/entities/AccessLogs/mockdatafiles/getCaleaAccessLogs-default.json +22 -0
  34. package/entities/AccessLogs/schema.json +19 -0
  35. package/entities/CallOutcome/action.json +25 -0
  36. package/entities/CallOutcome/mockdatafiles/getCalloutcomeSubscriberCallOutcome-default.json +20 -0
  37. package/entities/CallOutcome/schema.json +19 -0
  38. package/entities/E2EServiceDefinitionTemplate/action.json +25 -0
  39. package/entities/E2EServiceDefinitionTemplate/mockdatafiles/searchServiceDefinitions-default.json +35 -0
  40. package/entities/E2EServiceDefinitionTemplate/schema.json +19 -0
  41. package/entities/ManagedServiceArlo/action.json +85 -0
  42. package/entities/ManagedServiceArlo/schema.json +22 -0
  43. package/entities/ManagedServiceServify/action.json +85 -0
  44. package/entities/ManagedServiceServify/schema.json +22 -0
  45. package/entities/NetPerfTest/action.json +188 -0
  46. package/entities/NetPerfTest/mockdatafiles/getNetPerfTestCafIITest-default.json +44 -0
  47. package/entities/NetPerfTest/mockdatafiles/getNetPerfTestOoklaServer-default.json +23 -0
  48. package/entities/NetPerfTest/schema.json +27 -0
  49. package/entities/Reports/action.json +46 -0
  50. package/entities/Reports/mockdatafiles/getTrafficUsage-default.json +56 -0
  51. package/entities/Reports/mockdatafiles/getTrafficUsageForAllSubs-default.json +56 -0
  52. package/entities/Reports/schema.json +20 -0
  53. package/entities/SSID/action.json +147 -0
  54. package/entities/SSID/mockdatafiles/getBillingSupportOperatorSecondarynetwork-default.json +38 -0
  55. package/entities/SSID/mockdatafiles/getBillingSupportOperatorSsid-default.json +29 -0
  56. package/entities/SSID/mockdatafiles/putBillingSupportOperatorSsid-default.json +14 -0
  57. package/entities/SSID/schema.json +25 -0
  58. package/entities/ServiceDefinitions/action.json +126 -0
  59. package/entities/ServiceDefinitions/schema.json +24 -0
  60. package/entities/Subscriber/action.json +106 -0
  61. package/entities/Subscriber/schema.json +23 -0
  62. package/entities/SubscriberAppServices/action.json +66 -0
  63. package/entities/SubscriberAppServices/schema.json +21 -0
  64. package/entities/SubscriberArloServiceDeprecated/action.json +85 -0
  65. package/entities/SubscriberArloServiceDeprecated/schema.json +22 -0
  66. package/entities/SubscriberDevices/action.json +105 -0
  67. package/entities/SubscriberDevices/schema.json +23 -0
  68. package/entities/SubscriberFCCIdentifier/action.json +85 -0
  69. package/entities/SubscriberFCCIdentifier/schema.json +22 -0
  70. package/entities/SubscriberServices/action.json +147 -0
  71. package/entities/SubscriberServices/schema.json +25 -0
  72. package/entities/SubscriberServifyContractDeprecated/action.json +65 -0
  73. package/entities/SubscriberServifyContractDeprecated/schema.json +21 -0
  74. package/entities/SubscriberSmartTownWiFi/action.json +45 -0
  75. package/entities/SubscriberSmartTownWiFi/schema.json +20 -0
  76. package/error.json +190 -0
  77. package/package.json +88 -0
  78. package/pronghorn.json +6245 -0
  79. package/propertiesDecorators.json +14 -0
  80. package/propertiesSchema.json +1248 -0
  81. package/refs?service=git-upload-pack +0 -0
  82. package/report/adapterInfo.json +10 -0
  83. package/report/creationReport.json +755 -0
  84. package/report/merged-calix.json +9420 -0
  85. package/sampleProperties.json +196 -0
  86. package/test/integration/adapterTestBasicGet.js +83 -0
  87. package/test/integration/adapterTestConnectivity.js +93 -0
  88. package/test/integration/adapterTestIntegration.js +2507 -0
  89. package/test/unit/adapterBaseTestUnit.js +949 -0
  90. package/test/unit/adapterTestUnit.js +3622 -0
  91. package/utils/adapterInfo.js +206 -0
  92. package/utils/addAuth.js +94 -0
  93. package/utils/artifactize.js +146 -0
  94. package/utils/basicGet.js +50 -0
  95. package/utils/checkMigrate.js +63 -0
  96. package/utils/entitiesToDB.js +178 -0
  97. package/utils/findPath.js +74 -0
  98. package/utils/methodDocumentor.js +225 -0
  99. package/utils/modify.js +154 -0
  100. package/utils/packModificationScript.js +35 -0
  101. package/utils/patches2bundledDeps.js +90 -0
  102. package/utils/pre-commit.sh +32 -0
  103. package/utils/removeHooks.js +20 -0
  104. package/utils/setup.js +33 -0
  105. package/utils/tbScript.js +246 -0
  106. package/utils/tbUtils.js +490 -0
  107. package/utils/testRunner.js +298 -0
  108. package/utils/troubleshootingAdapter.js +195 -0
  109. package/workflows/README.md +3 -0
@@ -0,0 +1,196 @@
1
+ {
2
+ "id": "Adapter-calix_cloud_devportal",
3
+ "type": "CalixCloudDevportal",
4
+ "properties": {
5
+ "host": "localhost",
6
+ "port": 443,
7
+ "base_path": "",
8
+ "version": "v1",
9
+ "cache_location": "none",
10
+ "encode_pathvars": true,
11
+ "encode_queryvars": true,
12
+ "save_metric": false,
13
+ "stub": true,
14
+ "protocol": "https",
15
+ "authentication": {
16
+ "auth_method": "request_token",
17
+ "username": "username",
18
+ "password": "password",
19
+ "token": "token",
20
+ "token_timeout": 1800000,
21
+ "token_cache": "local",
22
+ "invalid_token_error": 401,
23
+ "auth_field": "header.headers.X-Calix-AccessToken",
24
+ "auth_field_format": "{token}",
25
+ "auth_logging": false,
26
+ "client_secret": "TEST_SECRET",
27
+ "grant_type": "password"
28
+ },
29
+ "healthcheck": {
30
+ "type": "startup",
31
+ "frequency": 60000,
32
+ "query_object": {}
33
+ },
34
+ "throttle": {
35
+ "throttle_enabled": false,
36
+ "number_pronghorns": 1,
37
+ "sync_async": "sync",
38
+ "max_in_queue": 1000,
39
+ "concurrent_max": 1,
40
+ "expire_timeout": 0,
41
+ "avg_runtime": 200,
42
+ "priorities": [
43
+ {
44
+ "value": 0,
45
+ "percent": 100
46
+ }
47
+ ]
48
+ },
49
+ "request": {
50
+ "number_redirects": 0,
51
+ "number_retries": 3,
52
+ "limit_retry_error": [
53
+ 0
54
+ ],
55
+ "failover_codes": [],
56
+ "attempt_timeout": 5000,
57
+ "global_request": {
58
+ "payload": {},
59
+ "uriOptions": {},
60
+ "addlHeaders": {
61
+ "X-Calix-ClientID": "test-id"
62
+ },
63
+ "authData": {}
64
+ },
65
+ "healthcheck_on_timeout": true,
66
+ "return_raw": false,
67
+ "archiving": false,
68
+ "return_request": false
69
+ },
70
+ "proxy": {
71
+ "enabled": false,
72
+ "host": "",
73
+ "port": 1,
74
+ "protocol": "http",
75
+ "username": "",
76
+ "password": ""
77
+ },
78
+ "ssl": {
79
+ "ecdhCurve": "",
80
+ "enabled": false,
81
+ "accept_invalid_cert": false,
82
+ "ca_file": "",
83
+ "key_file": "",
84
+ "cert_file": "",
85
+ "secure_protocol": "",
86
+ "ciphers": ""
87
+ },
88
+ "mongo": {
89
+ "host": "",
90
+ "port": 0,
91
+ "database": "",
92
+ "username": "",
93
+ "password": "",
94
+ "replSet": "",
95
+ "db_ssl": {
96
+ "enabled": false,
97
+ "accept_invalid_cert": false,
98
+ "ca_file": "",
99
+ "key_file": "",
100
+ "cert_file": ""
101
+ }
102
+ },
103
+ "devicebroker": {
104
+ "getDevice": [
105
+ {
106
+ "path": "/get/devices/{id}",
107
+ "method": "GET",
108
+ "query": {},
109
+ "body": {},
110
+ "headers": {},
111
+ "handleFailure": "ignore",
112
+ "requestFields": {
113
+ "id": "name"
114
+ },
115
+ "responseDatakey": "",
116
+ "responseFields": {
117
+ "name": "host",
118
+ "ostype": "os",
119
+ "ostypePrefix": "system-",
120
+ "ipaddress": "attributes.ipaddr",
121
+ "port": "443"
122
+ }
123
+ }
124
+ ],
125
+ "getDevicesFiltered": [
126
+ {
127
+ "path": "/get/devices",
128
+ "method": "GET",
129
+ "query": {},
130
+ "body": {},
131
+ "headers": {},
132
+ "handleFailure": "ignore",
133
+ "requestFields": {},
134
+ "responseDatakey": "",
135
+ "responseFields": {
136
+ "name": "host",
137
+ "ostype": "os",
138
+ "ostypePrefix": "system-",
139
+ "ipaddress": "attributes.ipaddr",
140
+ "port": "443"
141
+ }
142
+ }
143
+ ],
144
+ "isAlive": [
145
+ {
146
+ "path": "/get/devices/{id}/status",
147
+ "method": "GET",
148
+ "query": {},
149
+ "body": {},
150
+ "headers": {},
151
+ "handleFailure": "ignore",
152
+ "requestFields": {
153
+ "id": "name"
154
+ },
155
+ "responseDatakey": "",
156
+ "responseFields": {
157
+ "status": "status",
158
+ "statusValue": "online"
159
+ }
160
+ }
161
+ ],
162
+ "getConfig": [
163
+ {
164
+ "path": "/get/devices/{id}/configPart1",
165
+ "method": "GET",
166
+ "query": {},
167
+ "body": {},
168
+ "headers": {},
169
+ "handleFailure": "ignore",
170
+ "requestFields": {
171
+ "id": "name"
172
+ },
173
+ "responseDatakey": "",
174
+ "responseFields": {}
175
+ }
176
+ ],
177
+ "getCount": [
178
+ {
179
+ "path": "/get/devices",
180
+ "method": "GET",
181
+ "query": {},
182
+ "body": {},
183
+ "headers": {},
184
+ "handleFailure": "ignore",
185
+ "requestFields": {},
186
+ "responseDatakey": "",
187
+ "responseFields": {}
188
+ }
189
+ ]
190
+ }
191
+ },
192
+ "groups": [],
193
+ "brokers": [],
194
+ "logLevel": "none",
195
+ "timeout": 120000
196
+ }
@@ -0,0 +1,83 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe context before after */
4
+ /* eslint global-require: warn */
5
+ /* eslint no-unused-vars: warn */
6
+ /* eslint import/no-extraneous-dependencies: warn */
7
+ /* eslint import/no-dynamic-require: warn */
8
+ /* eslint import/no-unresolved: warn */
9
+
10
+ const mocha = require('mocha');
11
+ const path = require('path');
12
+ const assert = require('assert');
13
+ const itParam = require('mocha-param');
14
+
15
+ const utils = require('../../utils/tbUtils');
16
+ const basicGet = require('../../utils/basicGet');
17
+ const { name } = require('../../package.json');
18
+ const { methods } = require('../../pronghorn.json');
19
+
20
+ const getPronghornProps = (iapDir) => {
21
+ console.log('Retrieving properties.json file...');
22
+ const rawProps = require(path.join(iapDir, 'properties.json'));
23
+ console.log('Decrypting properties...');
24
+ const pronghornProps = utils.decryptProperties(rawProps, iapDir);
25
+ console.log('Found properties.\n');
26
+ return pronghornProps;
27
+ };
28
+
29
+ let a;
30
+
31
+ describe('[integration] Adapter BasicGET Test', () => {
32
+ context('Testing GET calls without query parameters', () => {
33
+ before(async () => {
34
+ const iapDir = path.join(__dirname, '../../../../../');
35
+ if (!utils.areWeUnderIAPinstallationDirectory()) {
36
+ const sampleProperties = require('../../sampleProperties.json');
37
+ const adapter = { properties: sampleProperties };
38
+ a = basicGet.getAdapterInstance(adapter);
39
+ } else {
40
+ const pronghornProps = getPronghornProps(iapDir);
41
+ console.log('Connecting to Database...');
42
+ const database = await basicGet.connect(pronghornProps);
43
+ console.log('Connection established.');
44
+ const adapter = await database.collection(utils.SERVICE_CONFIGS_COLLECTION).findOne(
45
+ { model: name }
46
+ );
47
+ a = basicGet.getAdapterInstance(adapter);
48
+ }
49
+ });
50
+
51
+ after((done) => {
52
+ done();
53
+ });
54
+
55
+ const basicGets = methods.filter((method) => (method.route.verb === 'GET' && method.input.length === 0));
56
+ if (basicGets.length === 0) {
57
+ console.log('No non-parameter GET calls found.');
58
+ process.exit(0);
59
+ }
60
+ const functionNames = basicGets.map((g) => g.name);
61
+ const request = function request(f, ad) {
62
+ return new Promise((resolve, reject) => {
63
+ const getRespCode = (resp) => {
64
+ if (resp) {
65
+ if (resp.metrics.code !== 200) {
66
+ console.log('\x1b[31m', `Testing ${f} \nResponseCode: ${resp.metrics.code}`);
67
+ }
68
+ resolve(resp.metrics.code);
69
+ } else {
70
+ console.log('\x1b[31m', `call ${f} results in failure`);
71
+ reject(new Error(`${f} failed`));
72
+ }
73
+ };
74
+ ad[f](getRespCode, console.log);
75
+ });
76
+ };
77
+
78
+ itParam('GET call should return 200', functionNames, (fname) => {
79
+ console.log(`\t ${fname}`);
80
+ return request(fname, a).then((result) => assert.equal(result, 200));
81
+ });
82
+ });
83
+ });
@@ -0,0 +1,93 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe it context before after */
4
+ /* eslint no-unused-vars: warn */
5
+
6
+ const mocha = require('mocha');
7
+ const assert = require('assert');
8
+ const diagnostics = require('network-diagnostics');
9
+
10
+ let host;
11
+ process.argv.forEach((val) => {
12
+ if (val.indexOf('--HOST') === 0) {
13
+ [, host] = val.split('=');
14
+ }
15
+ });
16
+
17
+ describe('[integration] Adapter Test', () => {
18
+ context(`Testing network connection on ${host}`, () => {
19
+ before(() => {
20
+ diagnostics.setTestURL(host);
21
+ });
22
+
23
+ after((done) => {
24
+ done();
25
+ });
26
+
27
+ it('DNS resolve', (done) => {
28
+ diagnostics.haveDNS((result) => {
29
+ try {
30
+ assert.equal(result, true);
31
+ done();
32
+ } catch (error) {
33
+ done(error);
34
+ }
35
+ });
36
+ });
37
+
38
+ it('Responds to ping', (done) => {
39
+ diagnostics.havePing((result) => {
40
+ try {
41
+ assert.equal(result, true);
42
+ done();
43
+ } catch (error) {
44
+ done(error);
45
+ }
46
+ });
47
+ });
48
+
49
+ it('Support HTTP on port 80', (done) => {
50
+ diagnostics.haveHTTP((result) => {
51
+ try {
52
+ assert.equal(result, true);
53
+ done();
54
+ } catch (error) {
55
+ done(error);
56
+ }
57
+ });
58
+ });
59
+
60
+ it('Support HTTPS on port 443', (done) => {
61
+ diagnostics.haveHTTPS((result) => {
62
+ try {
63
+ assert.equal(result, true);
64
+ done();
65
+ } catch (error) {
66
+ done(error);
67
+ }
68
+ });
69
+ });
70
+
71
+ it('Support IPv4', (done) => {
72
+ diagnostics.haveIPv4Async((result) => {
73
+ try {
74
+ assert.equal(result, true);
75
+ done();
76
+ } catch (error) {
77
+ done(error);
78
+ }
79
+ });
80
+ });
81
+
82
+ it('Support IPv6', (done) => {
83
+ diagnostics.haveIPv6Async((result) => {
84
+ try {
85
+ assert.equal(result, true);
86
+ done();
87
+ } catch (error) {
88
+ done(error);
89
+ }
90
+ });
91
+ });
92
+ });
93
+ });