diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..dd8efce7 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "outputCapture": "std", + "runtimeArgs": [ + "--trace-warnings" + ], + "skipFiles": [ + "/**" + ], + "program": "${workspaceFolder}\\server\\index.js", + "env": { + "DEBUG": "true", + } + } + ] +} \ No newline at end of file diff --git a/server/index.js b/server/index.js index 957eb5c4..35f1551c 100644 --- a/server/index.js +++ b/server/index.js @@ -13,12 +13,21 @@ const notificationManagement = require('./service/individualServices/Notificatio appCommons.openApiValidatorOptions.validateSecurity.handlers.apiKeyAuth = apiKeyAuth.validateOperationKey; const prepareElasticsearch = require('./service/individualServices/ElasticsearchPreparation'); -const { Console } = require('console'); - +const logger = require('./service/LoggingService.js').getLogger(); // uncomment if you do not want to validate security e.g. operation-key, basic auth, etc -//appCommons.openApiValidatorOptions.validateSecurity = false; -appCommons.openApiValidatorOptions.validateResponses = false; +// appCommons.openApiValidatorOptions.validateSecurity = false; +if (process.env.DEBUG && process.env.DEBUG.toLowerCase() === "true") { + logger.warn("Working in debug mode"); + logger.warn("Checking validation") + // appCommons.openApiValidatorOptions.validateSecurity = false; + appCommons.openApiValidatorOptions.validateResponses = false; + // appCommons.openApiValidatorOptions.validateRequests = false; + logger.warn("Validate Security: " + appCommons.openApiValidatorOptions.validateSecurity); + logger.warn("Validate Responses: " + appCommons.openApiValidatorOptions.validateResponses); + logger.warn("Validate Requests: " + appCommons.openApiValidatorOptions.validateRequests); +} + // swaggerRouter configuration var options = { routing: { @@ -48,12 +57,12 @@ global.databasePath = './database/load.json'; prepareElasticsearch(false).catch(err => { - console.error(`Error preparing Elasticsearch : ${err}`); + logger.error(`Error preparing Elasticsearch : ${err}`); }).finally(() => { // Initialize the Swagger middleware http.createServer(app).listen(serverPort, function () { - console.log('Your server is listening on port %d (http://localhost:%d)', serverPort, serverPort); - console.log('Swagger-ui is available on http://localhost:%d/docs', serverPort); + logger.info('Your server is listening on port %d (http://localhost:%d)', serverPort, serverPort); + logger.info('Swagger-ui is available on http://localhost:%d/docs', serverPort); }); appCommons.performApplicationRegistration(); diff --git a/server/package-lock.json b/server/package-lock.json index 3438ba42..34f1e2c9 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -17,6 +17,9 @@ "onf-core-model-ap": "2.1.2", "onf-core-model-ap-bs": "2.1.2", "openbackhaul-oas3-tools": "2.3.1-alpha.3", + "pino": "^9.4.0", + "pino-pretty": "^11.2.2", + "pino-roll": "^2.2.0", "qs": "^6.11.2", "request": "^2.88.2", "shuffle-array": "^1.0.1" @@ -2365,6 +2368,18 @@ "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", "dev": true }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "license": "MIT", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/accepts": { "version": "1.3.8", "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz", @@ -2484,6 +2499,15 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, + "node_modules/atomic-sleep": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz", + "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==", + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/aws-sign2": { "version": "0.7.0", "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", @@ -2671,6 +2695,26 @@ "resolved": "https://registry.npmjs.org/base-64/-/base-64-1.0.0.tgz", "integrity": "sha512-kwDPIFCGx0NZHog36dj+tHiwP4QMzsZ3AgMViUBKI0+V5n4U0ufTCUMhnQ04diaRI8EX/QcPfql7zlhZ7j4zgg==" }, + "node_modules/base64-js": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", + "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/basic-auth": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz", @@ -2758,6 +2802,30 @@ "node-int64": "^0.4.0" } }, + "node_modules/buffer": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", + "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "base64-js": "^1.3.1", + "ieee754": "^1.2.1" + } + }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -2914,6 +2982,12 @@ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, + "node_modules/colorette": { + "version": "2.0.20", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz", + "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==", + "license": "MIT" + }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -3129,6 +3203,16 @@ "node": ">=0.10" } }, + "node_modules/date-fns": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-4.1.0.tgz", + "integrity": "sha512-Ukq0owbQXxa/U3EGtsdVBkR1w7KOQ5gIBqdH2hkvknzZPYvBxb/aa6E8L7tmjFtkwZBu3UXBbjIgPo/Ez4xaNg==", + "license": "MIT", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/kossnocorp" + } + }, "node_modules/dateformat": { "version": "4.6.3", "resolved": "https://registry.npmjs.org/dateformat/-/dateformat-4.6.3.tgz", @@ -3265,6 +3349,15 @@ "node": ">= 0.8" } }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "license": "MIT", + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -3326,6 +3419,24 @@ "node": ">= 0.6" } }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "license": "MIT", + "engines": { + "node": ">=0.8.x" + } + }, "node_modules/eventsource": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-2.0.2.tgz", @@ -3612,6 +3723,12 @@ "node >=0.6.0" ] }, + "node_modules/fast-copy": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-3.0.2.tgz", + "integrity": "sha512-dl0O9Vhju8IrcLndv2eU4ldt1ftXMqqfgN4H1cpmGV7P6jeB9FwpN9a2c8DPGE1Ys88rNUJVYDHq73CGAGOPfQ==", + "license": "MIT" + }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -3622,6 +3739,21 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, + "node_modules/fast-redact": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.5.0.tgz", + "integrity": "sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==", + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-safe-stringify": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", + "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA==", + "license": "MIT" + }, "node_modules/fb-watchman": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", @@ -3928,6 +4060,12 @@ "node": ">= 0.4" } }, + "node_modules/help-me": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", + "integrity": "sha512-7xgomUX6ADmcYzFik0HzAxh/73YlKR9bmFzf51CZwR+b6YtzU2m0u49hQCqV6SvlqIqsaxovfwdvbnsw3b/zpg==", + "license": "MIT" + }, "node_modules/hpagent": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-0.1.2.tgz", @@ -4004,6 +4142,26 @@ "node": ">=0.10.0" } }, + "node_modules/ieee754": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "BSD-3-Clause" + }, "node_modules/import-local": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz", @@ -4800,6 +4958,15 @@ "url": "https://github.com/chalk/supports-color?sponsor=1" } }, + "node_modules/joycon": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/joycon/-/joycon-3.1.1.tgz", + "integrity": "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -5230,6 +5397,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/on-exit-leak-free": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", + "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==", + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/on-finished": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz", @@ -5253,7 +5429,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "dependencies": { "wrappy": "1" } @@ -5529,6 +5704,78 @@ "url": "https://github.com/sponsors/jonschlinkert" } }, + "node_modules/pino": { + "version": "9.7.0", + "resolved": "https://registry.npmjs.org/pino/-/pino-9.7.0.tgz", + "integrity": "sha512-vnMCM6xZTb1WDmLvtG2lE/2p+t9hDEIvTWJsu6FejkE62vB7gDhvzrpFR4Cw2to+9JNQxVnkAKVPA1KPB98vWg==", + "license": "MIT", + "dependencies": { + "atomic-sleep": "^1.0.0", + "fast-redact": "^3.1.1", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "^2.0.0", + "pino-std-serializers": "^7.0.0", + "process-warning": "^5.0.0", + "quick-format-unescaped": "^4.0.3", + "real-require": "^0.2.0", + "safe-stable-stringify": "^2.3.1", + "sonic-boom": "^4.0.1", + "thread-stream": "^3.0.0" + }, + "bin": { + "pino": "bin.js" + } + }, + "node_modules/pino-abstract-transport": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-2.0.0.tgz", + "integrity": "sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==", + "license": "MIT", + "dependencies": { + "split2": "^4.0.0" + } + }, + "node_modules/pino-pretty": { + "version": "11.3.0", + "resolved": "https://registry.npmjs.org/pino-pretty/-/pino-pretty-11.3.0.tgz", + "integrity": "sha512-oXwn7ICywaZPHmu3epHGU2oJX4nPmKvHvB/bwrJHlGcbEWaVcotkpyVHMKLKmiVryWYByNp0jpgAcXpFJDXJzA==", + "license": "MIT", + "dependencies": { + "colorette": "^2.0.7", + "dateformat": "^4.6.3", + "fast-copy": "^3.0.2", + "fast-safe-stringify": "^2.1.1", + "help-me": "^5.0.0", + "joycon": "^3.1.1", + "minimist": "^1.2.6", + "on-exit-leak-free": "^2.1.0", + "pino-abstract-transport": "^2.0.0", + "pump": "^3.0.0", + "readable-stream": "^4.0.0", + "secure-json-parse": "^2.4.0", + "sonic-boom": "^4.0.1", + "strip-json-comments": "^3.1.1" + }, + "bin": { + "pino-pretty": "bin.js" + } + }, + "node_modules/pino-roll": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/pino-roll/-/pino-roll-2.2.0.tgz", + "integrity": "sha512-PSigcOfIQHcPIRcQFuDFe5RVD37waq9T3No8lqPr4CdIaSa9pshUOPVCO1C1mmb3VQ1n5VXUGuKSNk6yDMUi6w==", + "license": "MIT", + "dependencies": { + "date-fns": "^4.1.0", + "sonic-boom": "^4.0.1" + } + }, + "node_modules/pino-std-serializers": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.0.0.tgz", + "integrity": "sha512-e906FRY0+tV27iq4juKzSYPbUj2do2X2JX4EzSca1631EB2QJQUqGbDuERal7LCtOpxl6x3+nvo9NPZcmjkiFA==", + "license": "MIT" + }, "node_modules/pirates": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", @@ -5576,11 +5823,36 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, + "node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "license": "MIT", + "engines": { + "node": ">= 0.6.0" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, + "node_modules/process-warning": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz", + "integrity": "sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "MIT" + }, "node_modules/prompts": { "version": "2.4.2", "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", @@ -5611,6 +5883,16 @@ "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "license": "MIT", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "node_modules/punycode": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", @@ -5649,6 +5931,12 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/quick-format-unescaped": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz", + "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==", + "license": "MIT" + }, "node_modules/randexp": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/randexp/-/randexp-0.5.3.tgz", @@ -5675,6 +5963,31 @@ "integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==", "dev": true }, + "node_modules/readable-stream": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.7.0.tgz", + "integrity": "sha512-oIGGmcpTLwPga8Bn6/Z75SVaH1z5dUut2ibSyAMVhmUggWpmDn2dapB0n7f8nwaSiRtepAsfJyfXIO5DCVAODg==", + "license": "MIT", + "dependencies": { + "abort-controller": "^3.0.0", + "buffer": "^6.0.3", + "events": "^3.3.0", + "process": "^0.11.10", + "string_decoder": "^1.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/real-require": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz", + "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==", + "license": "MIT", + "engines": { + "node": ">= 12.13.0" + } + }, "node_modules/regenerate": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", @@ -5877,6 +6190,15 @@ } ] }, + "node_modules/safe-stable-stringify": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz", + "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==", + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/safer-buffer": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", @@ -6030,6 +6352,15 @@ "node": ">=8" } }, + "node_modules/sonic-boom": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.0.tgz", + "integrity": "sha512-INb7TM37/mAcsGmc9hyyI6+QR3rR1zVRu36B0NeGXKnOOLiZOfER5SA+N7X7k3yUYRzLWafduTDvJAfDswwEww==", + "license": "MIT", + "dependencies": { + "atomic-sleep": "^1.0.0" + } + }, "node_modules/source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -6049,6 +6380,15 @@ "source-map": "^0.6.0" } }, + "node_modules/split2": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz", + "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==", + "license": "ISC", + "engines": { + "node": ">= 10.x" + } + }, "node_modules/sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -6098,6 +6438,15 @@ "node": ">= 0.6" } }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "license": "MIT", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/string-length": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", @@ -6159,7 +6508,6 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, "engines": { "node": ">=8" }, @@ -6204,6 +6552,15 @@ "node": ">=8" } }, + "node_modules/thread-stream": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.1.0.tgz", + "integrity": "sha512-OqyPZ9u96VohAyMfJykzmivOrY2wfMSf3C5TtFJVgN+Hm6aj+voFhlK+kZEIv2FBh1X6Xp3DlnCOfEQ3B2J86A==", + "license": "MIT", + "dependencies": { + "real-require": "^0.2.0" + } + }, "node_modules/tmpl": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", @@ -6496,8 +6853,7 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/write-file-atomic": { "version": "4.0.2", diff --git a/server/package.json b/server/package.json index 1949882b..976a0faf 100644 --- a/server/package.json +++ b/server/package.json @@ -33,7 +33,10 @@ "openbackhaul-oas3-tools": "2.3.1-alpha.3", "qs": "^6.11.2", "request": "^2.88.2", - "shuffle-array": "^1.0.1" + "shuffle-array": "^1.0.1", + "pino": "^9.4.0", + "pino-pretty": "^11.2.2", + "pino-roll": "^2.2.0" }, "devDependencies": { "@babel/core": "^7.27.1", diff --git a/server/service/ActionProfileService.js b/server/service/ActionProfileService.js index 4f12bf96..58147a72 100644 --- a/server/service/ActionProfileService.js +++ b/server/service/ActionProfileService.js @@ -10,8 +10,8 @@ var fileOperation = require('onf-core-model-ap/applicationPattern/databaseDriver exports.getActionProfileConsequentOperationReference = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "action-profile-1-0:consequent-operation-reference" : value }; @@ -35,8 +35,8 @@ exports.getActionProfileConsequentOperationReference = function(url) { exports.getActionProfileDisplayInNewBrowserWindow = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "action-profile-1-0:display-in-new-browser-window" : value }; @@ -60,8 +60,8 @@ exports.getActionProfileDisplayInNewBrowserWindow = function(url) { exports.getActionProfileInputValueListt = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "action-profile-1-0:input-value-list" : value }; @@ -85,8 +85,8 @@ exports.getActionProfileInputValueListt = function(url) { exports.getActionProfileLabel = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "action-profile-1-0:label" : value }; @@ -110,8 +110,8 @@ exports.getActionProfileLabel = function(url) { exports.getActionProfileOperationName = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "action-profile-1-0:operation-name" : value }; diff --git a/server/service/BasicServicesService.js b/server/service/BasicServicesService.js index f5439b04..31962469 100644 --- a/server/service/BasicServicesService.js +++ b/server/service/BasicServicesService.js @@ -49,15 +49,15 @@ exports.endSubscription = function(body,user,originator,xCorrelator,traceIndicat **/ exports.informAboutApplication = function(user,originator,xCorrelator,traceIndicator,customerJourney) { return new Promise(function(resolve, reject) { - var examples = {}; + let examples = {}; examples['application/json'] = { - "application-name" : "OwnApplicationName", - "release-number" : "1.0.0", - "application-purpose" : "Brief description of the purpose of the application.", - "data-update-period" : "real-time", - "owner-name" : "Thorsten Heinze", - "owner-email-address" : "Thorsten.Heinze@telefonica.com" -}; + "application-name" : "OwnApplicationName", + "release-number" : "1.0.0", + "application-purpose" : "Brief description of the purpose of the application.", + "data-update-period" : "real-time", + "owner-name" : "Thorsten Heinze", + "owner-email-address" : "Thorsten.Heinze@telefonica.com" + }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); } else { @@ -79,41 +79,41 @@ exports.informAboutApplication = function(user,originator,xCorrelator,traceIndic **/ exports.informAboutApplicationInGenericRepresentation = function(user,originator,xCorrelator,traceIndicator,customerJourney) { return new Promise(function(resolve, reject) { - var examples = {}; + let examples = {}; examples['application/json'] = { - "consequent-action-list" : [ { - "request" : "request", - "input-value-list" : [ { - "field-name" : "field-name", - "unit" : "unit" - }, { - "field-name" : "field-name", - "unit" : "unit" - } ], - "display-in-new-browser-window" : true, - "label" : "label" - }, { - "request" : "request", - "input-value-list" : [ { - "field-name" : "field-name", - "unit" : "unit" - }, { - "field-name" : "field-name", - "unit" : "unit" - } ], - "display-in-new-browser-window" : true, - "label" : "label" - } ], - "response-value-list" : [ { - "field-name" : "field-name", - "datatype" : "datatype", - "value" : "value" - }, { - "field-name" : "field-name", - "datatype" : "datatype", - "value" : "value" - } ] -}; + "consequent-action-list" : [ { + "request" : "request", + "input-value-list" : [ { + "field-name" : "field-name", + "unit" : "unit" + }, { + "field-name" : "field-name", + "unit" : "unit" + } ], + "display-in-new-browser-window" : true, + "label" : "label" + }, { + "request" : "request", + "input-value-list" : [ { + "field-name" : "field-name", + "unit" : "unit" + }, { + "field-name" : "field-name", + "unit" : "unit" + } ], + "display-in-new-browser-window" : true, + "label" : "label" + } ], + "response-value-list" : [ { + "field-name" : "field-name", + "datatype" : "datatype", + "value" : "value" + }, { + "field-name" : "field-name", + "datatype" : "datatype", + "value" : "value" + } ] + }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); } else { @@ -135,12 +135,12 @@ exports.informAboutApplicationInGenericRepresentation = function(user,originator **/ exports.informAboutReleaseHistory = function(user,originator,xCorrelator,traceIndicator,customerJourney) { return new Promise(function(resolve, reject) { - var examples = {}; + let examples = {}; examples['application/json'] = [ { - "release-number" : "1.0.0", - "release-date" : "20.11.2010", - "changes" : "Initial version." -} ]; + "release-number" : "1.0.0", + "release-date" : "20.11.2010", + "changes" : "Initial version." + } ]; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); } else { @@ -162,41 +162,41 @@ exports.informAboutReleaseHistory = function(user,originator,xCorrelator,traceIn **/ exports.informAboutReleaseHistoryInGenericRepresentation = function(user,originator,xCorrelator,traceIndicator,customerJourney) { return new Promise(function(resolve, reject) { - var examples = {}; + let examples = {}; examples['application/json'] = { - "consequent-action-list" : [ { - "request" : "request", - "input-value-list" : [ { - "field-name" : "field-name", - "unit" : "unit" - }, { - "field-name" : "field-name", - "unit" : "unit" - } ], - "display-in-new-browser-window" : true, - "label" : "label" - }, { - "request" : "request", - "input-value-list" : [ { - "field-name" : "field-name", - "unit" : "unit" - }, { - "field-name" : "field-name", - "unit" : "unit" - } ], - "display-in-new-browser-window" : true, - "label" : "label" - } ], - "response-value-list" : [ { - "field-name" : "field-name", - "datatype" : "datatype", - "value" : "value" - }, { - "field-name" : "field-name", - "datatype" : "datatype", - "value" : "value" - } ] -}; + "consequent-action-list" : [ { + "request" : "request", + "input-value-list" : [ { + "field-name" : "field-name", + "unit" : "unit" + }, { + "field-name" : "field-name", + "unit" : "unit" + } ], + "display-in-new-browser-window" : true, + "label" : "label" + }, { + "request" : "request", + "input-value-list" : [ { + "field-name" : "field-name", + "unit" : "unit" + }, { + "field-name" : "field-name", + "unit" : "unit" + } ], + "display-in-new-browser-window" : true, + "label" : "label" + } ], + "response-value-list" : [ { + "field-name" : "field-name", + "datatype" : "datatype", + "value" : "value" + }, { + "field-name" : "field-name", + "datatype" : "datatype", + "value" : "value" + } ] + }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); } else { @@ -234,88 +234,88 @@ exports.inquireOamRequestApprovals = function(body,user,originator,xCorrelator,t * customerJourney String Holds information supporting customer’s journey to which the execution applies * returns inline_response_200_66 **/ -exports.listLtpsAndFcs = function(user,originator,xCorrelator,traceIndicator,customerJourney) { +exports.listLtpsAndFcs = function(user, originator, xCorrelator, traceIndicator, customerJourney) { return new Promise(function(resolve, reject) { - var examples = {}; + let examples = {}; examples['application/json'] = { - "core-model-1-4:control-construct" : { - "forwarding-domain" : [ { - "uuid" : "ro-2-0-1-op-fd-000", - "forwarding-construct" : [ { - "uuid" : "ro-2-0-1-op-fc-bm-000", - "name" : [ { - "value-name" : "ForwardingKind", - "value" : "core-model-1-4:FORWARDING_KIND_TYPE_INVARIANT_PROCESS_SNIPPET" - }, { - "value-name" : "ForwardingName", - "value" : "PromptForRegisteringCausesRegistrationRequest" + "core-model-1-4:control-construct" : { + "forwarding-domain" : [ { + "uuid" : "ro-2-0-1-op-fd-000", + "forwarding-construct" : [ { + "uuid" : "ro-2-0-1-op-fc-bm-000", + "name" : [ { + "value-name" : "ForwardingKind", + "value" : "core-model-1-4:FORWARDING_KIND_TYPE_INVARIANT_PROCESS_SNIPPET" + }, { + "value-name" : "ForwardingName", + "value" : "PromptForRegisteringCausesRegistrationRequest" + } ], + "fc-port" : [ { + "local-id" : "000", + "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_MANAGEMENT", + "logical-termination-point" : "ro-2-0-1-op-s-bm-000" + }, { + "local-id" : "100", + "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_INPUT", + "logical-termination-point" : "ro-2-0-1-op-s-bm-000" + } ] + }, { + "uuid" : "ro-2-0-1-op-fc-bm-001", + "name" : [ { + "value-name" : "ForwardingKind", + "value" : "core-model-1-4:FORWARDING_KIND_TYPE_INVARIANT_PROCESS_SNIPPET" + }, { + "value-name" : "ForwardingName", + "value" : "PromptForEmbeddingCausesRequestForBequeathingData" + } ], + "fc-port" : [ { + "local-id" : "100", + "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_INPUT", + "logical-termination-point" : "ro-2-0-1-op-s-bm-001" + }, { + "local-id" : "200", + "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_OUTPUT", + "logical-termination-point" : "ro-2-0-1-op-c-bm-ro-2-0-1-000" + } ] + } ] } ], - "fc-port" : [ { - "local-id" : "000", - "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_MANAGEMENT", - "logical-termination-point" : "ro-2-0-1-op-s-bm-000" - }, { - "local-id" : "100", - "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_INPUT", - "logical-termination-point" : "ro-2-0-1-op-s-bm-000" - } ] - }, { - "uuid" : "ro-2-0-1-op-fc-bm-001", - "name" : [ { - "value-name" : "ForwardingKind", - "value" : "core-model-1-4:FORWARDING_KIND_TYPE_INVARIANT_PROCESS_SNIPPET" + "logical-termination-point" : [ { + "uuid" : "ro-2-0-1-op-s-bm-000", + "ltp-direction" : "core-model-1-4:TERMINATION_DIRECTION_SOURCE", + "client-ltp" : [ ], + "server-ltp" : [ "ro-2-0-1-http-s-000" ], + "layer-protocol" : [ { + "local-id" : "0", + "layer-protocol-name" : "operation-server-interface-1-0:LAYER_PROTOCOL_NAME_TYPE_OPERATION_LAYER", + "operation-server-interface-1-0:operation-server-interface-pac" : { + "operation-server-interface-capability" : { + "operation-name" : "/v1/register-yourself" + }, + "operation-server-interface-configuration" : { + "life-cycle-state" : "operation-server-interface-1-0:LIFE_CYCLE_STATE_TYPE_EXPERIMENTAL" + } + } + } ] }, { - "value-name" : "ForwardingName", - "value" : "PromptForEmbeddingCausesRequestForBequeathingData" + "uuid" : "ro-2-0-1-http-s-000", + "ltp-direction" : "core-model-1-4:TERMINATION_DIRECTION_SOURCE", + "client-ltp" : [ "ro-2-0-1-op-s-bm-000" ], + "server-ltp" : [ ], + "layer-protocol" : [ { + "local-id" : "0", + "layer-protocol-name" : "http-server-interface-1-0:LAYER_PROTOCOL_NAME_TYPE_HTTP_LAYER", + "http-server-interface-1-0:http-server-interface-pac" : { + "http-server-interface-capability" : { + "application-name" : "RegistryOffice", + "release-number" : "2.0.1", + "data-update-period" : "http-server-interface-1-0:DATA_UPDATE_PERIOD_TYPE_REAL_TIME" + } + } + } ] } ], - "fc-port" : [ { - "local-id" : "100", - "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_INPUT", - "logical-termination-point" : "ro-2-0-1-op-s-bm-001" - }, { - "local-id" : "200", - "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_OUTPUT", - "logical-termination-point" : "ro-2-0-1-op-c-bm-ro-2-0-1-000" - } ] - } ] - } ], - "logical-termination-point" : [ { - "uuid" : "ro-2-0-1-op-s-bm-000", - "ltp-direction" : "core-model-1-4:TERMINATION_DIRECTION_SOURCE", - "client-ltp" : [ ], - "server-ltp" : [ "ro-2-0-1-http-s-000" ], - "layer-protocol" : [ { - "local-id" : "0", - "layer-protocol-name" : "operation-server-interface-1-0:LAYER_PROTOCOL_NAME_TYPE_OPERATION_LAYER", - "operation-server-interface-1-0:operation-server-interface-pac" : { - "operation-server-interface-capability" : { - "operation-name" : "/v1/register-yourself" - }, - "operation-server-interface-configuration" : { - "life-cycle-state" : "operation-server-interface-1-0:LIFE_CYCLE_STATE_TYPE_EXPERIMENTAL" - } - } - } ] - }, { - "uuid" : "ro-2-0-1-http-s-000", - "ltp-direction" : "core-model-1-4:TERMINATION_DIRECTION_SOURCE", - "client-ltp" : [ "ro-2-0-1-op-s-bm-000" ], - "server-ltp" : [ ], - "layer-protocol" : [ { - "local-id" : "0", - "layer-protocol-name" : "http-server-interface-1-0:LAYER_PROTOCOL_NAME_TYPE_HTTP_LAYER", - "http-server-interface-1-0:http-server-interface-pac" : { - "http-server-interface-capability" : { - "application-name" : "RegistryOffice", - "release-number" : "2.0.1", - "data-update-period" : "http-server-interface-1-0:DATA_UPDATE_PERIOD_TYPE_REAL_TIME" - } - } - } ] - } ], - "uuid" : "uuid" - } -}; + "uuid" : "uuid" + } + }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); } else { @@ -374,86 +374,86 @@ exports.redirectServiceRequestInformation = function(body,user,originator,xCorre **/ exports.redirectTopologyChangeInformation = function(body,user,originator,xCorrelator,traceIndicator,customerJourney) { return new Promise(function(resolve, reject) { - var examples = {}; + let examples = {}; examples['application/json'] = { - "core-model-1-4:control-construct" : { - "forwarding-domain" : [ { - "uuid" : "ro-2-0-1-op-fd-000", - "forwarding-construct" : [ { - "uuid" : "ro-2-0-1-op-fc-bm-000", - "name" : [ { - "value-name" : "ForwardingKind", - "value" : "core-model-1-4:FORWARDING_KIND_TYPE_INVARIANT_PROCESS_SNIPPET" - }, { - "value-name" : "ForwardingName", - "value" : "PromptForRegisteringCausesRegistrationRequest" + "core-model-1-4:control-construct" : { + "forwarding-domain" : [ { + "uuid" : "ro-2-0-1-op-fd-000", + "forwarding-construct" : [ { + "uuid" : "ro-2-0-1-op-fc-bm-000", + "name" : [ { + "value-name" : "ForwardingKind", + "value" : "core-model-1-4:FORWARDING_KIND_TYPE_INVARIANT_PROCESS_SNIPPET" + }, { + "value-name" : "ForwardingName", + "value" : "PromptForRegisteringCausesRegistrationRequest" + } ], + "fc-port" : [ { + "local-id" : "000", + "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_MANAGEMENT", + "logical-termination-point" : "ro-2-0-1-op-s-bm-000" + }, { + "local-id" : "100", + "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_INPUT", + "logical-termination-point" : "ro-2-0-1-op-s-bm-000" + } ] + }, { + "uuid" : "ro-2-0-1-op-fc-bm-001", + "name" : [ { + "value-name" : "ForwardingKind", + "value" : "core-model-1-4:FORWARDING_KIND_TYPE_INVARIANT_PROCESS_SNIPPET" + }, { + "value-name" : "ForwardingName", + "value" : "PromptForEmbeddingCausesRequestForBequeathingData" + } ], + "fc-port" : [ { + "local-id" : "100", + "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_INPUT", + "logical-termination-point" : "ro-2-0-1-op-s-bm-001" + }, { + "local-id" : "200", + "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_OUTPUT", + "logical-termination-point" : "ro-2-0-1-op-c-bm-ro-2-0-1-000" + } ] + } ] } ], - "fc-port" : [ { - "local-id" : "000", - "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_MANAGEMENT", - "logical-termination-point" : "ro-2-0-1-op-s-bm-000" + "logical-termination-point" : [ { + "uuid" : "ro-2-0-1-op-s-bm-000", + "ltp-direction" : "core-model-1-4:TERMINATION_DIRECTION_SOURCE", + "client-ltp" : [ ], + "server-ltp" : [ "ro-2-0-1-http-s-000" ], + "layer-protocol" : [ { + "local-id" : "0", + "layer-protocol-name" : "operation-server-interface-1-0:LAYER_PROTOCOL_NAME_TYPE_OPERATION_LAYER", + "operation-server-interface-1-0:operation-server-interface-pac" : { + "operation-server-interface-capability" : { + "operation-name" : "/v1/register-yourself" + }, + "operation-server-interface-configuration" : { + "life-cycle-state" : "operation-server-interface-1-0:LIFE_CYCLE_STATE_TYPE_EXPERIMENTAL" + } + } + } ] }, { - "local-id" : "100", - "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_INPUT", - "logical-termination-point" : "ro-2-0-1-op-s-bm-000" - } ] - }, { - "uuid" : "ro-2-0-1-op-fc-bm-001", - "name" : [ { - "value-name" : "ForwardingKind", - "value" : "core-model-1-4:FORWARDING_KIND_TYPE_INVARIANT_PROCESS_SNIPPET" - }, { - "value-name" : "ForwardingName", - "value" : "PromptForEmbeddingCausesRequestForBequeathingData" + "uuid" : "ro-2-0-1-http-s-000", + "ltp-direction" : "core-model-1-4:TERMINATION_DIRECTION_SOURCE", + "client-ltp" : [ "ro-2-0-1-op-s-bm-000" ], + "server-ltp" : [ ], + "layer-protocol" : [ { + "local-id" : "0", + "layer-protocol-name" : "http-server-interface-1-0:LAYER_PROTOCOL_NAME_TYPE_HTTP_LAYER", + "http-server-interface-1-0:http-server-interface-pac" : { + "http-server-interface-capability" : { + "application-name" : "RegistryOffice", + "release-number" : "2.0.1", + "data-update-period" : "http-server-interface-1-0:DATA_UPDATE_PERIOD_TYPE_REAL_TIME" + } + } + } ] } ], - "fc-port" : [ { - "local-id" : "100", - "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_INPUT", - "logical-termination-point" : "ro-2-0-1-op-s-bm-001" - }, { - "local-id" : "200", - "port-direction" : "core-model-1-4:PORT_DIRECTION_TYPE_OUTPUT", - "logical-termination-point" : "ro-2-0-1-op-c-bm-ro-2-0-1-000" - } ] - } ] - } ], - "logical-termination-point" : [ { - "uuid" : "ro-2-0-1-op-s-bm-000", - "ltp-direction" : "core-model-1-4:TERMINATION_DIRECTION_SOURCE", - "client-ltp" : [ ], - "server-ltp" : [ "ro-2-0-1-http-s-000" ], - "layer-protocol" : [ { - "local-id" : "0", - "layer-protocol-name" : "operation-server-interface-1-0:LAYER_PROTOCOL_NAME_TYPE_OPERATION_LAYER", - "operation-server-interface-1-0:operation-server-interface-pac" : { - "operation-server-interface-capability" : { - "operation-name" : "/v1/register-yourself" - }, - "operation-server-interface-configuration" : { - "life-cycle-state" : "operation-server-interface-1-0:LIFE_CYCLE_STATE_TYPE_EXPERIMENTAL" - } - } - } ] - }, { - "uuid" : "ro-2-0-1-http-s-000", - "ltp-direction" : "core-model-1-4:TERMINATION_DIRECTION_SOURCE", - "client-ltp" : [ "ro-2-0-1-op-s-bm-000" ], - "server-ltp" : [ ], - "layer-protocol" : [ { - "local-id" : "0", - "layer-protocol-name" : "http-server-interface-1-0:LAYER_PROTOCOL_NAME_TYPE_HTTP_LAYER", - "http-server-interface-1-0:http-server-interface-pac" : { - "http-server-interface-capability" : { - "application-name" : "RegistryOffice", - "release-number" : "2.0.1", - "data-update-period" : "http-server-interface-1-0:DATA_UPDATE_PERIOD_TYPE_REAL_TIME" - } - } - } ] - } ], - "uuid" : "uuid" - } -}; + "uuid" : "uuid" + } + }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); } else { @@ -494,41 +494,41 @@ exports.registerYourself = function(body,user,originator,xCorrelator,traceIndica **/ exports.startApplicationInGenericRepresentation = function(user,originator,xCorrelator,traceIndicator,customerJourney) { return new Promise(function(resolve, reject) { - var examples = {}; + let examples = {}; examples['application/json'] = { - "consequent-action-list" : [ { - "request" : "request", - "input-value-list" : [ { - "field-name" : "field-name", - "unit" : "unit" - }, { - "field-name" : "field-name", - "unit" : "unit" - } ], - "display-in-new-browser-window" : true, - "label" : "label" - }, { - "request" : "request", - "input-value-list" : [ { - "field-name" : "field-name", - "unit" : "unit" - }, { - "field-name" : "field-name", - "unit" : "unit" - } ], - "display-in-new-browser-window" : true, - "label" : "label" - } ], - "response-value-list" : [ { - "field-name" : "field-name", - "datatype" : "datatype", - "value" : "value" - }, { - "field-name" : "field-name", - "datatype" : "datatype", - "value" : "value" - } ] -}; + "consequent-action-list" : [ { + "request" : "request", + "input-value-list" : [ { + "field-name" : "field-name", + "unit" : "unit" + }, { + "field-name" : "field-name", + "unit" : "unit" + } ], + "display-in-new-browser-window" : true, + "label" : "label" + }, { + "request" : "request", + "input-value-list" : [ { + "field-name" : "field-name", + "unit" : "unit" + }, { + "field-name" : "field-name", + "unit" : "unit" + } ], + "display-in-new-browser-window" : true, + "label" : "label" + } ], + "response-value-list" : [ { + "field-name" : "field-name", + "datatype" : "datatype", + "value" : "value" + }, { + "field-name" : "field-name", + "datatype" : "datatype", + "value" : "value" + } ] + }; if (Object.keys(examples).length > 0) { resolve(examples[Object.keys(examples)[0]]); } else { diff --git a/server/service/CoreService.js b/server/service/CoreService.js index e0581833..70e479d8 100644 --- a/server/service/CoreService.js +++ b/server/service/CoreService.js @@ -10,8 +10,8 @@ const { elasticsearchService } = require('onf-core-model-ap/applicationPattern/s exports.getControlConstruct = function () { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync("core-model-1-4:control-construct"); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync("core-model-1-4:control-construct"); + let response = {}; response['application/json'] = { "core-model-1-4:control-construct": await elasticsearchService.updateControlConstructWithServicePolicy(value) }; @@ -35,8 +35,8 @@ exports.getControlConstruct = function () { exports.getProfileInstance = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "core-model-1-4:profile" : value }; diff --git a/server/service/ElasticsearchClientService.js b/server/service/ElasticsearchClientService.js index a8693bcd..577af691 100644 --- a/server/service/ElasticsearchClientService.js +++ b/server/service/ElasticsearchClientService.js @@ -10,8 +10,8 @@ const prepareElasticsearch = require('./individualServices/ElasticsearchPreparat * returns inline_response_200_50 **/ exports.getElasticsearchClientApiKey = async function(url) { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = { + let value = await fileOperation.readFromDatabaseAsync(url); + let response = { "elasticsearch-client-interface-1-0:api-key" : value }; return response; @@ -24,8 +24,8 @@ exports.getElasticsearchClientApiKey = async function(url) { * returns inline_response_200_51 **/ exports.getElasticsearchClientIndexAlias = async function(url) { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = { + let value = await fileOperation.readFromDatabaseAsync(url); + let response = { "elasticsearch-client-interface-1-0:index-alias" : value }; return response; @@ -38,8 +38,8 @@ exports.getElasticsearchClientIndexAlias = async function(url) { * returns inline_response_200_54 **/ exports.getElasticsearchClientLifeCycleState = async function(url) { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = { + let value = await fileOperation.readFromDatabaseAsync(url); + let response = { "elasticsearch-client-interface-1-0:life-cycle-state" : value }; return response; @@ -54,7 +54,7 @@ exports.getElasticsearchClientLifeCycleState = async function(url) { **/ exports.getElasticsearchClientOperationalState = async function(uuid) { let value = await elasticsearchService.getElasticsearchClientOperationalStateAsync(uuid); - var response = { + let response = { "elasticsearch-client-interface-1-0:operational-state" : value }; return response; @@ -67,8 +67,8 @@ exports.getElasticsearchClientOperationalState = async function(uuid) { * returns inline_response_200_52 **/ exports.getElasticsearchClientServiceRecordsPolicy = async function(uuid) { - var value = await elasticsearchService.getElasticsearchClientServiceRecordsPolicyAsync(uuid); - var response = { + let value = await elasticsearchService.getElasticsearchClientServiceRecordsPolicyAsync(uuid); + let response = { "elasticsearch-client-interface-1-0:service-records-policy" : value }; return response; diff --git a/server/service/GenericResponseProfileService.js b/server/service/GenericResponseProfileService.js index e7c7fd62..41ef5243 100644 --- a/server/service/GenericResponseProfileService.js +++ b/server/service/GenericResponseProfileService.js @@ -10,8 +10,8 @@ var fileOperation = require('onf-core-model-ap/applicationPattern/databaseDriver exports.getGenericResponseProfileDatatype = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "response-profile-1-0:datatype" : value }; @@ -36,8 +36,8 @@ exports.getGenericResponseProfileDatatype = function(url) { exports.getGenericResponseProfileDescription = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "response-profile-1-0:description" : value }; @@ -62,8 +62,8 @@ exports.getGenericResponseProfileDescription = function(url) { exports.getGenericResponseProfileFieldName = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "response-profile-1-0:field-name" : value }; @@ -88,8 +88,8 @@ exports.getGenericResponseProfileFieldName = function(url) { exports.getGenericResponseProfileOperationName = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "response-profile-1-0:operation-name" : value }; @@ -114,8 +114,8 @@ exports.getGenericResponseProfileOperationName = function(url) { exports.getGenericResponseProfileValue = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "response-profile-1-0:value" : value }; diff --git a/server/service/HttpClientService.js b/server/service/HttpClientService.js index 2c969a92..1950fcf7 100644 --- a/server/service/HttpClientService.js +++ b/server/service/HttpClientService.js @@ -13,8 +13,8 @@ const httpClientInterface = require('onf-core-model-ap/applicationPattern/onfMod exports.getHttpClientApplicationName = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "http-client-interface-1-0:application-name": value }; @@ -38,8 +38,8 @@ exports.getHttpClientApplicationName = function (url) { exports.getHttpClientReleaseNumber = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "http-client-interface-1-0:release-number": value }; diff --git a/server/service/HttpServerService.js b/server/service/HttpServerService.js index d4a8dfdd..b5156c31 100644 --- a/server/service/HttpServerService.js +++ b/server/service/HttpServerService.js @@ -10,8 +10,8 @@ var fileOperation = require('onf-core-model-ap/applicationPattern/databaseDriver exports.getHttpServerApplicationName = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "http-server-interface-1-0:application-name": value }; @@ -36,8 +36,8 @@ exports.getHttpServerApplicationName = function (url) { exports.getHttpServerApplicationPurpose = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "http-server-interface-1-0:application-purpose": value }; @@ -62,8 +62,8 @@ exports.getHttpServerApplicationPurpose = function (url) { exports.getHttpServerDataUpdatePeriode = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "http-server-interface-1-0:data-update-period": value }; @@ -88,8 +88,8 @@ exports.getHttpServerDataUpdatePeriode = function (url) { exports.getHttpServerOwnerEmailAddress = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "http-server-interface-1-0:owner-email-address": value }; @@ -114,8 +114,8 @@ exports.getHttpServerOwnerEmailAddress = function (url) { exports.getHttpServerOwnerName = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "http-server-interface-1-0:owner-name": value }; @@ -140,8 +140,8 @@ exports.getHttpServerOwnerName = function (url) { exports.getHttpServerReleaseList = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "http-server-interface-1-0:release-list": value }; @@ -166,8 +166,8 @@ exports.getHttpServerReleaseList = function (url) { exports.getHttpServerReleaseNumber = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "http-server-interface-1-0:release-number": value }; diff --git a/server/service/IndividualServicesService.js b/server/service/IndividualServicesService.js index 3ea8e62f..e18a82c0 100644 --- a/server/service/IndividualServicesService.js +++ b/server/service/IndividualServicesService.js @@ -1,4 +1,6 @@ 'use strict'; + +// ONF Libs const tcpServerInterface = require('onf-core-model-ap/applicationPattern/onfModel/models/layerProtocols/TcpServerInterface'); const onfAttributeFormatter = require('onf-core-model-ap/applicationPattern/onfModel/utility/OnfAttributeFormatter'); const onfAttributes = require('onf-core-model-ap/applicationPattern/onfModel/constants/OnfAttributes'); @@ -8,30 +10,52 @@ const ForwardingDomain = require('onf-core-model-ap/applicationPattern/onfModel/ const FcPort = require('onf-core-model-ap/applicationPattern/onfModel/models/FcPort'); const LogicalTerminationPoint = require('onf-core-model-ap/applicationPattern/onfModel/models/LogicalTerminationPoint'); const OperationClientInterface = require('onf-core-model-ap/applicationPattern/onfModel/models/layerProtocols/OperationClientInterface'); +const profileCollection = require('onf-core-model-ap/applicationPattern/onfModel/models/ProfileCollection'); +const fileProfileOperation = require('onf-core-model-ap/applicationPattern/onfModel/models/profile/FileProfile') +const HttpServerInterface = require('onf-core-model-ap/applicationPattern/onfModel/models/layerProtocols/HttpServerInterface'); +const RequestBuilder = require('onf-core-model-ap/applicationPattern/rest/client/RequestBuilder'); +const executionAndTraceService = require('onf-core-model-ap/applicationPattern/services/ExecutionAndTraceService'); +const responseCodeEnum = require('onf-core-model-ap/applicationPattern/rest/server/ResponseCode'); +const RequestHeader = require('onf-core-model-ap/applicationPattern/rest/client/RequestHeader'); +const { getIndexAliasAsync, createResultArray, elasticsearchService } = require('onf-core-model-ap/applicationPattern/services/ElasticsearchService'); + +// Extra Libs +const urlf = require('url'); +const fs = require('fs'); +const crypto = require("crypto"); +const axios = require('axios'); const createHttpError = require('http-errors'); const metaDataUtility = require('./individualServices/CyclicProcessService/metaDataUtility') const RestClient = require('./individualServices/rest/client/dispacher'); const cacheResponse = require('./individualServices/cacheResponseBuilder'); const cacheUpdate = require('./individualServices/cacheUpdateBuilder'); const fieldsManager = require('./individualServices/fieldsManagement'); -const { getIndexAliasAsync, createResultArray, elasticsearchService } = require('onf-core-model-ap/applicationPattern/services/ElasticsearchService'); -const RequestHeader = require('onf-core-model-ap/applicationPattern/rest/client/RequestHeader'); -const axios = require('axios'); -const HttpServerInterface = require('onf-core-model-ap/applicationPattern/onfModel/models/layerProtocols/HttpServerInterface'); -const RequestBuilder = require('onf-core-model-ap/applicationPattern/rest/client/RequestBuilder'); const subscriberManagement = require('./individualServices/SubscriberManagement'); const inputValidation = require('./individualServices/InputValidation'); const notificationManagement = require('./individualServices/NotificationManagement'); -const executionAndTraceService = require('onf-core-model-ap/applicationPattern/services/ExecutionAndTraceService'); -const responseCodeEnum = require('onf-core-model-ap/applicationPattern/rest/server/ResponseCode'); const bequeathHandler = require('./individualServices/BequeathYourDataAndDieHandler'); const alarmHandler = require('./individualServices/alarmUpdater') - -const crypto = require("crypto"); const { updateDeviceListFromNotification } = require('./individualServices/CyclicProcessService/cyclicProcess'); const { getDeviceListInMemory } = require('./individualServices/CyclicProcessService/cyclicProcess'); + +const logger = require('./LoggingService.js').getLogger(); +// --------------------------------------------------------- + let lastSentMessages = []; +// ------ Constants definition +// -- Application +const OPENDAYLIGHT_STR = "OpenDayLight"; +const ELASTICSEARCH_STR = "ElasticSearch"; + +// -- Control-construct +const NODE_ID = "node-id"; +const CTR_CONST = "control-construct"; +const CORE_MODEL = "core-model-1-4:link"; +const END_POINT_LIST = "end-point-list"; + + + /** * Initiates process of embedding a new release * @@ -65,7 +89,7 @@ exports.bequeathYourDataAndDie = function (url, body, user, originator, xCorrela await bequeathHandler.handleRequest(body, url); resolve(); } catch (error) { - console.log(error); + logger.error(error); } }); } @@ -89,11 +113,14 @@ exports.deleteCachedLink = function (url, user, originator, xCorrelator, traceIn let correctLink = null; let link = decodeLinkUuid(url, true); if (typeof link === 'object') { + logger.error("deleteCachedLink - Link: " + link); throw new createHttpError(link[0].code, link[0].message); return; } else { correctLink = link; } + + logger.info("deleteCachedLink - Read from ELK: " + correctLink); let result = await ReadRecords(correctLink); if (result != undefined) { let ret = await deleteRequest(correctLink); @@ -143,7 +170,7 @@ exports.deleteCachedLinkPort = function (url, user, originator, xCorrelator, tra let correctLink = null; let link = uuid;//decodeLinkUuid(url, true); let id = localId; - var format = /[ `!@#$%^&*()_+=\[\]{};':"\\|,.<>\/?~]/; + const format = /[ `!@#$%^&*()_+=\[\]{};':"\\|,.<>\/?~]/; const matchLink = format.test(link); const matchId = format.test(id); if (typeof link === 'object') { @@ -210,6 +237,8 @@ exports.getCachedActualEquipment = function (url, user, originator, xCorrelator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedActualEquipment - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -218,6 +247,7 @@ exports.getCachedActualEquipment = function (url, user, originator, xCorrelator, const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Actual Equipment - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -248,6 +278,7 @@ exports.getCachedActualEquipment = function (url, user, originator, xCorrelator, } resolve(returnObject); } catch (error) { + logger.error(error); console.error(error); reject(error); } @@ -287,6 +318,8 @@ exports.getCachedAirInterfaceCapability = function (url, user, originator, xCorr // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedAirInterfaceCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -295,6 +328,7 @@ exports.getCachedAirInterfaceCapability = function (url, user, originator, xCorr const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Air Interface Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -325,6 +359,7 @@ exports.getCachedAirInterfaceCapability = function (url, user, originator, xCorr } resolve(returnObject); } catch (error) { + logger.error(error); console.error(error); reject(error); } @@ -364,6 +399,8 @@ exports.getCachedAirInterfaceConfiguration = function (url, user, originator, xC // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedAirInterfaceConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -372,6 +409,7 @@ exports.getCachedAirInterfaceConfiguration = function (url, user, originator, xC const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Air Interface Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -402,6 +440,7 @@ exports.getCachedAirInterfaceConfiguration = function (url, user, originator, xC } resolve(returnObject); } catch (error) { + logger.error(error); console.error(error); reject(error); } @@ -441,6 +480,8 @@ exports.getCachedAirInterfaceHistoricalPerformances = function (url, user, origi // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedAirInterfaceHistoricalPerformances - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -449,6 +490,7 @@ exports.getCachedAirInterfaceHistoricalPerformances = function (url, user, origi const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Air Interface Historical Performance - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -479,6 +521,7 @@ exports.getCachedAirInterfaceHistoricalPerformances = function (url, user, origi } resolve(returnObject); } catch (error) { + logger.error(error); console.error(error); reject(error); } @@ -518,6 +561,8 @@ exports.getCachedAirInterfaceStatus = function (url, user, originator, xCorrelat // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedAirInterfaceStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -526,6 +571,7 @@ exports.getCachedAirInterfaceStatus = function (url, user, originator, xCorrelat const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Air Interface Status - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -557,6 +603,7 @@ exports.getCachedAirInterfaceStatus = function (url, user, originator, xCorrelat resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -593,6 +640,8 @@ exports.getCachedAlarmCapability = function (url, user, originator, xCorrelator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedAlarmCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -601,6 +650,7 @@ exports.getCachedAlarmCapability = function (url, user, originator, xCorrelator, const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Alarm Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result) @@ -632,6 +682,7 @@ exports.getCachedAlarmCapability = function (url, user, originator, xCorrelator, resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -668,6 +719,8 @@ exports.getCachedAlarmConfiguration = function (url, user, originator, xCorrelat // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedAlarmConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -676,6 +729,7 @@ exports.getCachedAlarmConfiguration = function (url, user, originator, xCorrelat const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Alarm Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result) @@ -708,6 +762,7 @@ exports.getCachedAlarmConfiguration = function (url, user, originator, xCorrelat resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -744,6 +799,8 @@ exports.getCachedAlarmEventRecords = function (url, user, originator, xCorrelato // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedAlarmEventRecords - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -752,6 +809,7 @@ exports.getCachedAlarmEventRecords = function (url, user, originator, xCorrelato const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Alarm Event Records - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -783,6 +841,7 @@ exports.getCachedAlarmEventRecords = function (url, user, originator, xCorrelato resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -820,6 +879,8 @@ exports.getCachedCoChannelProfileCapability = function (url, user, originator, x // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedCoChannelProfileCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -828,6 +889,7 @@ exports.getCachedCoChannelProfileCapability = function (url, user, originator, x const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Co Channel Profile Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -864,6 +926,7 @@ exports.getCachedCoChannelProfileCapability = function (url, user, originator, x resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -901,6 +964,8 @@ exports.getCachedCoChannelProfileConfiguration = function (url, user, originator // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedCoChannelProfileConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -909,6 +974,7 @@ exports.getCachedCoChannelProfileConfiguration = function (url, user, originator const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Co Channel Profile Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -939,6 +1005,7 @@ exports.getCachedCoChannelProfileConfiguration = function (url, user, originator resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -977,6 +1044,8 @@ exports.getCachedConnector = function (url, user, originator, xCorrelator, trace // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedConnector - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -985,6 +1054,7 @@ exports.getCachedConnector = function (url, user, originator, xCorrelator, trace const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Connector - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1016,6 +1086,7 @@ exports.getCachedConnector = function (url, user, originator, xCorrelator, trace resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1054,6 +1125,8 @@ exports.getCachedContainedHolder = function (url, user, originator, xCorrelator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedContainedHolder - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1062,6 +1135,7 @@ exports.getCachedContainedHolder = function (url, user, originator, xCorrelator, const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Container Holder - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1093,6 +1167,7 @@ exports.getCachedContainedHolder = function (url, user, originator, xCorrelator, resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1114,9 +1189,11 @@ exports.getCachedContainedHolder = function (url, user, originator, xCorrelator, exports.getCachedControlConstruct = function (url, user, originator, xCorrelator, traceIndicator, customerJourney, mountName, fields) { return new Promise(async function (resolve, reject) { try { + logger.info(`CachedControlConstruct - get from url ${url}`); let myFields = fields; if (myFields != undefined) { if (!isFilterValid(myFields)) { + logger.warn("CachedControlConstruct - Filters are not valid, throwing BadRequest"); throw new createHttpError.BadRequest; } } @@ -1129,6 +1206,8 @@ exports.getCachedControlConstruct = function (url, user, originator, xCorrelator // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, true); if (typeof mountname === 'object') { + logger.error("CachedControlConstruct - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1137,13 +1216,17 @@ exports.getCachedControlConstruct = function (url, user, originator, xCorrelator const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("CachedControlConstruct - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); + logger.info("CachedControlConstruct - Read from ELK done"); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { throw new createHttpError(470, `Resource not existing. Device informs about addressed resource unknown`); }); + logger.info("CachedControlConstruct - get cacheResponseBuilder"); if (finalJson != undefined) { modifyReturnJson(finalJson); + logger.info("CachedControlConstruct - modify JSON done"); let objectKey = Object.keys(finalJson)[0]; finalJson = finalJson[objectKey]; if (myFields != undefined) { @@ -1165,9 +1248,10 @@ exports.getCachedControlConstruct = function (url, user, originator, xCorrelator } else { throw new createHttpError(460, `Requested device is currently not in connected state at the controller`); } + logger.info("CachedControlConstruct - Return data"); resolve(returnObject); } catch (error) { - console.error(error); + logger.error(error); reject(error); } }); @@ -1204,6 +1288,8 @@ exports.getCachedCurrentAlarms = function (url, user, originator, xCorrelator, t // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedCurrentAlarms - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1212,6 +1298,7 @@ exports.getCachedCurrentAlarms = function (url, user, originator, xCorrelator, t const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Current Alarms - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result) @@ -1244,6 +1331,7 @@ exports.getCachedCurrentAlarms = function (url, user, originator, xCorrelator, t resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1281,6 +1369,8 @@ exports.getCachedEquipment = function (url, user, originator, xCorrelator, trace // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedEquipment - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1289,6 +1379,7 @@ exports.getCachedEquipment = function (url, user, originator, xCorrelator, trace const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Equipment - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1320,6 +1411,7 @@ exports.getCachedEquipment = function (url, user, originator, xCorrelator, trace resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1358,6 +1450,8 @@ exports.getCachedEthernetContainerCapability = function (url, user, originator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedEthernetContainerCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1366,6 +1460,7 @@ exports.getCachedEthernetContainerCapability = function (url, user, originator, const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Ethernet Container Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1397,6 +1492,7 @@ exports.getCachedEthernetContainerCapability = function (url, user, originator, resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1435,6 +1531,8 @@ exports.getCachedEthernetContainerConfiguration = function (url, user, originato // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedEthernetContainerConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1443,6 +1541,7 @@ exports.getCachedEthernetContainerConfiguration = function (url, user, originato const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Ethernet Container Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1474,6 +1573,7 @@ exports.getCachedEthernetContainerConfiguration = function (url, user, originato resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1512,6 +1612,8 @@ exports.getCachedEthernetContainerHistoricalPerformances = function (url, user, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedEthernetContainerHistoricalPerformances - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1520,6 +1622,7 @@ exports.getCachedEthernetContainerHistoricalPerformances = function (url, user, const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Ethernet Container Historical Perfomances - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1551,6 +1654,7 @@ exports.getCachedEthernetContainerHistoricalPerformances = function (url, user, resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1589,6 +1693,8 @@ exports.getCachedEthernetContainerStatus = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedEthernetContainerStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1597,6 +1703,7 @@ exports.getCachedEthernetContainerStatus = function (url, user, originator, xCor const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Ethernet Container Status - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1628,6 +1735,7 @@ exports.getCachedEthernetContainerStatus = function (url, user, originator, xCor resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1666,6 +1774,8 @@ exports.getCachedExpectedEquipment = function (url, user, originator, xCorrelato // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedExpectedEquipment - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1674,6 +1784,7 @@ exports.getCachedExpectedEquipment = function (url, user, originator, xCorrelato const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Expected Equipment - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1705,6 +1816,7 @@ exports.getCachedExpectedEquipment = function (url, user, originator, xCorrelato resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1741,6 +1853,8 @@ exports.getCachedFirmwareCollection = function (url, user, originator, xCorrelat // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedFirmwareCollection - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1749,6 +1863,7 @@ exports.getCachedFirmwareCollection = function (url, user, originator, xCorrelat const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Firmware Collection - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1780,6 +1895,7 @@ exports.getCachedFirmwareCollection = function (url, user, originator, xCorrelat resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1817,6 +1933,8 @@ exports.getCachedFirmwareComponentCapability = function (url, user, originator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedFirmwareComponentCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1825,6 +1943,7 @@ exports.getCachedFirmwareComponentCapability = function (url, user, originator, const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Firmware Component Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1856,6 +1975,7 @@ exports.getCachedFirmwareComponentCapability = function (url, user, originator, resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1893,6 +2013,8 @@ exports.getCachedFirmwareComponentList = function (url, user, originator, xCorre // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedFirmwareComponentList - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1901,6 +2023,7 @@ exports.getCachedFirmwareComponentList = function (url, user, originator, xCorre const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Firmware Component List - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -1931,6 +2054,7 @@ exports.getCachedFirmwareComponentList = function (url, user, originator, xCorre resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -1968,6 +2092,8 @@ exports.getCachedFirmwareComponentStatus = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedFirmwareComponentStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -1976,6 +2102,7 @@ exports.getCachedFirmwareComponentStatus = function (url, user, originator, xCor const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Firmware Componenet Status - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -2007,6 +2134,7 @@ exports.getCachedFirmwareComponentStatus = function (url, user, originator, xCor resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2044,6 +2172,8 @@ exports.getCachedForwardingConstruct = function (url, user, originator, xCorrela // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedForwardingConstruct - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2052,6 +2182,7 @@ exports.getCachedForwardingConstruct = function (url, user, originator, xCorrela const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Forwarding Construct - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -2083,6 +2214,7 @@ exports.getCachedForwardingConstruct = function (url, user, originator, xCorrela resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2122,6 +2254,8 @@ exports.getCachedForwardingConstructPort = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedForwardingConstructPort - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2130,6 +2264,7 @@ exports.getCachedForwardingConstructPort = function (url, user, originator, xCor const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Forwarding Construct Port - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -2161,6 +2296,7 @@ exports.getCachedForwardingConstructPort = function (url, user, originator, xCor resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2198,6 +2334,8 @@ exports.getCachedForwardingDomain = function (url, user, originator, xCorrelator // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedForwardingDomain - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2206,6 +2344,7 @@ exports.getCachedForwardingDomain = function (url, user, originator, xCorrelator const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Forwarding Domain - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -2237,6 +2376,7 @@ exports.getCachedForwardingDomain = function (url, user, originator, xCorrelator resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2275,6 +2415,8 @@ exports.getCachedHybridMwStructureCapability = function (url, user, originator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedHybridMwStructureCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2283,6 +2425,7 @@ exports.getCachedHybridMwStructureCapability = function (url, user, originator, const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Hybrid MW Structure Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -2314,6 +2457,7 @@ exports.getCachedHybridMwStructureCapability = function (url, user, originator, resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2352,6 +2496,8 @@ exports.getCachedHybridMwStructureConfiguration = function (url, user, originato // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedHybridMwStructureConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2360,6 +2506,7 @@ exports.getCachedHybridMwStructureConfiguration = function (url, user, originato const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Hybrid MW Structure Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -2391,6 +2538,7 @@ exports.getCachedHybridMwStructureConfiguration = function (url, user, originato resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2429,6 +2577,8 @@ exports.getCachedHybridMwStructureHistoricalPerformances = function (url, user, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedHybridMwStructureHistoricalPerformances - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2437,6 +2587,7 @@ exports.getCachedHybridMwStructureHistoricalPerformances = function (url, user, const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Hybrid MW Structure Historical Performances - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -2468,6 +2619,7 @@ exports.getCachedHybridMwStructureHistoricalPerformances = function (url, user, resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2506,6 +2658,8 @@ exports.getCachedHybridMwStructureStatus = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedHybridMwStructureStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2514,6 +2668,7 @@ exports.getCachedHybridMwStructureStatus = function (url, user, originator, xCor const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Hybrid MW Structure Status - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -2545,6 +2700,7 @@ exports.getCachedHybridMwStructureStatus = function (url, user, originator, xCor resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2569,11 +2725,14 @@ exports.getCachedLink = function (url, user, originator, xCorrelator, traceIndic let correctLink = null; let link = decodeLinkUuid(url, true); if (typeof link === 'object') { + logger.error("getCachedLink - Link: " + link); throw new createHttpError(link[0].code, link[0].message); return; } else { correctLink = link; } + + logger.info("getCachedLink - Read from ELK: " + correctLink); let result = await ReadRecords(correctLink); if (result != undefined) { let objectKey = Object.keys(result)[0]; @@ -2612,17 +2771,21 @@ exports.getCachedLinkPort = function (url, user, originator, xCorrelator, traceI let correctLink = null; let link = uuid;//decodeLinkUuid(url, true); let id = localId; - var format = /[ `!@#$%^&*()+\=\[\]{};':"\\|,.<>\/?~]/; + const format = /[ `!@#$%^&*()+\=\[\]{};':"\\|,.<>\/?~]/; const matchLink = format.test(link); const matchId = format.test(id); if (matchLink || matchId) { + logger.error("getCachedLinkPort - UUID: " + link + " - localID: " + id); throw new createHttpError("400", "Fields must not contain special chars"); } if (typeof link === 'object') { + logger.error("getCachedLinkPort - UUID: " + link); throw new createHttpError(link[0].code, link[0].message); } else { correctLink = link; } + + logger.info("getCachedLinkPort - Read from ELK: " + correctLink); let result = await ReadRecords(correctLink); if (result != undefined) { let objectKey = Object.keys(result)[0]; @@ -2673,6 +2836,7 @@ exports.getCachedLinkPort = function (url, user, originator, xCorrelator, traceI exports.getCachedLogicalTerminationPoint = function (url, user, originator, xCorrelator, traceIndicator, customerJourney, mountName, uuid, fields) { return new Promise(async function (resolve, reject) { try { + logger.info(`Cached LTP - get from url ${url}`); let myFields = fields; if (myFields != undefined) { if (!isFilterValid(myFields)) { @@ -2688,6 +2852,8 @@ exports.getCachedLogicalTerminationPoint = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("Cached LTP - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2695,14 +2861,17 @@ exports.getCachedLogicalTerminationPoint = function (url, user, originator, xCor let returnObject = {}; const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); - + logger.info("Cached LTP - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); + logger.info("Cached LTP - Read from ELK done"); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { throw new createHttpError(470, `Resource not existing. Device informs about addressed resource unknown`); }); + logger.info("Cached LTP - get cacheResponseBuilder"); if (finalJson != undefined) { modifyReturnJson(finalJson); + logger.info("Cached LTP - modify JSON done"); let objectKey = Object.keys(finalJson)[0]; finalJson = finalJson[objectKey]; if (myFields != undefined) { @@ -2722,11 +2891,12 @@ exports.getCachedLogicalTerminationPoint = function (url, user, originator, xCor } } else { throw new createHttpError(460, `Requested device is currently not in connected state at the controller`); - } + logger.info("Cached LTP - Return data"); resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2749,9 +2919,11 @@ exports.getCachedLogicalTerminationPoint = function (url, user, originator, xCor exports.getCachedLtpAugment = function (url, user, originator, xCorrelator, traceIndicator, customerJourney, mountName, uuid, fields) { return new Promise(async function (resolve, reject) { try { + logger.info(`Cached LTP Augmented - get from url ${url}`); let myFields = fields; if (myFields != undefined) { if (!isFilterValid(myFields)) { + logger.error("Cached LTP Augmented - Wrong decoding mountname, is an object:"); throw new createHttpError.BadRequest; } } @@ -2764,6 +2936,8 @@ exports.getCachedLtpAugment = function (url, user, originator, xCorrelator, trac // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getcacheLtpAugment - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2771,14 +2945,17 @@ exports.getCachedLtpAugment = function (url, user, originator, xCorrelator, trac let returnObject = {}; const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); - + logger.info("Cached LTP Augmented - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); + logger.info("Cached LTP - Read from ELK done"); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { throw new createHttpError(470, `Resource not existing. Device informs about addressed resource unknown`); }); + logger.info("Cached LTP Augmented - get cacheResponseBuilder"); if (finalJson != undefined) { modifyReturnJson(finalJson); + logger.info("Cached LTP Augmented - modify JSON done"); let objectKey = Object.keys(finalJson)[0]; finalJson = finalJson[objectKey]; if (myFields != undefined) { @@ -2798,11 +2975,12 @@ exports.getCachedLtpAugment = function (url, user, originator, xCorrelator, trac } } else { throw new createHttpError(460, `Requested device is currently not in connected state at the controller`); - } + logger.info("Cached LTP Augmented - Return data"); resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2842,6 +3020,8 @@ exports.getCachedMacInterfaceCapability = function (url, user, originator, xCorr // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedMacInterfaceCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2850,6 +3030,7 @@ exports.getCachedMacInterfaceCapability = function (url, user, originator, xCorr const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("MAC Interface Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -2881,6 +3062,7 @@ exports.getCachedMacInterfaceCapability = function (url, user, originator, xCorr resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2919,6 +3101,8 @@ exports.getCachedMacInterfaceConfiguration = function (url, user, originator, xC // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedMacInterfaceConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -2927,6 +3111,7 @@ exports.getCachedMacInterfaceConfiguration = function (url, user, originator, xC const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("MAC Interface Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -2958,6 +3143,7 @@ exports.getCachedMacInterfaceConfiguration = function (url, user, originator, xC resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -2996,6 +3182,8 @@ exports.getCachedMacInterfaceStatus = function (url, user, originator, xCorrelat // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedMacInterfaceStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3004,6 +3192,7 @@ exports.getCachedMacInterfaceStatus = function (url, user, originator, xCorrelat const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("MAC Interface Status - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3035,6 +3224,7 @@ exports.getCachedMacInterfaceStatus = function (url, user, originator, xCorrelat resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3072,6 +3262,8 @@ exports.getCachedPolicingProfileCapability = function (url, user, originator, xC // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedPolicingProfileCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3080,6 +3272,7 @@ exports.getCachedPolicingProfileCapability = function (url, user, originator, xC const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Policing Profile Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3111,6 +3304,7 @@ exports.getCachedPolicingProfileCapability = function (url, user, originator, xC resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3148,6 +3342,8 @@ exports.getCachedPolicingProfileConfiguration = function (url, user, originator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedPolicingProfileConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3156,6 +3352,7 @@ exports.getCachedPolicingProfileConfiguration = function (url, user, originator, const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Policing Profile Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3187,6 +3384,7 @@ exports.getCachedPolicingProfileConfiguration = function (url, user, originator, resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3224,6 +3422,8 @@ exports.getCachedProfile = function (url, user, originator, xCorrelator, traceIn // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedProfile - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3232,6 +3432,7 @@ exports.getCachedProfile = function (url, user, originator, xCorrelator, traceIn const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Profile - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3263,6 +3464,7 @@ exports.getCachedProfile = function (url, user, originator, xCorrelator, traceIn resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3299,6 +3501,8 @@ exports.getCachedProfileCollection = function (url, user, originator, xCorrelato // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedProfileCollection - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3307,6 +3511,7 @@ exports.getCachedProfileCollection = function (url, user, originator, xCorrelato const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Profile Collection - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3338,6 +3543,7 @@ exports.getCachedProfileCollection = function (url, user, originator, xCorrelato resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3375,6 +3581,8 @@ exports.getCachedPureEthernetStructureCapability = function (url, user, originat // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedPureEthernetStructureCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3383,6 +3591,7 @@ exports.getCachedPureEthernetStructureCapability = function (url, user, originat const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Pure Ethernet Structure Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3414,6 +3623,7 @@ exports.getCachedPureEthernetStructureCapability = function (url, user, originat resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3452,6 +3662,8 @@ exports.getCachedPureEthernetStructureConfiguration = function (url, user, origi // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedPureEthernetStructureConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3460,6 +3672,7 @@ exports.getCachedPureEthernetStructureConfiguration = function (url, user, origi const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Pure Ethernet Structure Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3491,6 +3704,7 @@ exports.getCachedPureEthernetStructureConfiguration = function (url, user, origi resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3529,6 +3743,8 @@ exports.getCachedPureEthernetStructureHistoricalPerformances = function (url, us // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedPureEthernetStructureHistoricalPerformances - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3537,6 +3753,7 @@ exports.getCachedPureEthernetStructureHistoricalPerformances = function (url, us const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Pure Ethernet Structure Historical Performances - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3568,6 +3785,7 @@ exports.getCachedPureEthernetStructureHistoricalPerformances = function (url, us resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3606,6 +3824,8 @@ exports.getCachedPureEthernetStructureStatus = function (url, user, originator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedPureEthernetStructureStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3614,6 +3834,7 @@ exports.getCachedPureEthernetStructureStatus = function (url, user, originator, const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Pure Ethernet Structure Status - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3645,6 +3866,7 @@ exports.getCachedPureEthernetStructureStatus = function (url, user, originator, resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3682,6 +3904,8 @@ exports.getCachedQosProfileCapability = function (url, user, originator, xCorrel // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedQosProfileCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3690,6 +3914,7 @@ exports.getCachedQosProfileCapability = function (url, user, originator, xCorrel const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("QoS Profile Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3721,6 +3946,7 @@ exports.getCachedQosProfileCapability = function (url, user, originator, xCorrel resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3758,6 +3984,8 @@ exports.getCachedQosProfileConfiguration = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedQosProfileConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3766,6 +3994,7 @@ exports.getCachedQosProfileConfiguration = function (url, user, originator, xCor const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("QoS Profile Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3797,6 +4026,7 @@ exports.getCachedQosProfileConfiguration = function (url, user, originator, xCor resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3834,6 +4064,8 @@ exports.getCachedSchedulerProfileCapability = function (url, user, originator, x // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedSchedulerProfileCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3842,6 +4074,7 @@ exports.getCachedSchedulerProfileCapability = function (url, user, originator, x const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("QoS Profile Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3873,6 +4106,7 @@ exports.getCachedSchedulerProfileCapability = function (url, user, originator, x resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3910,6 +4144,8 @@ exports.getCachedSchedulerProfileConfiguration = function (url, user, originator // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedSchedulerProfileConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3918,6 +4154,7 @@ exports.getCachedSchedulerProfileConfiguration = function (url, user, originator const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("QoS Profile Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -3949,6 +4186,7 @@ exports.getCachedSchedulerProfileConfiguration = function (url, user, originator resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -3987,6 +4225,8 @@ exports.getCachedVlanInterfaceCapability = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedVlanInterfaceCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -3995,6 +4235,7 @@ exports.getCachedVlanInterfaceCapability = function (url, user, originator, xCor const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("VLAN Interface Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -4026,6 +4267,7 @@ exports.getCachedVlanInterfaceCapability = function (url, user, originator, xCor resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4064,6 +4306,8 @@ exports.getCachedVlanInterfaceConfiguration = function (url, user, originator, x // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedVlanInterfaceConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -4072,6 +4316,7 @@ exports.getCachedVlanInterfaceConfiguration = function (url, user, originator, x const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("VLAN Interface Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -4103,6 +4348,7 @@ exports.getCachedVlanInterfaceConfiguration = function (url, user, originator, x resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4141,6 +4387,8 @@ exports.getCachedWireInterfaceCapability = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedWireInterfaceCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -4149,6 +4397,7 @@ exports.getCachedWireInterfaceCapability = function (url, user, originator, xCor const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Wire Interface Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -4180,6 +4429,7 @@ exports.getCachedWireInterfaceCapability = function (url, user, originator, xCor resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4218,6 +4468,8 @@ exports.getCachedWireInterfaceConfiguration = function (url, user, originator, x // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedWireInterfaceConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -4226,6 +4478,7 @@ exports.getCachedWireInterfaceConfiguration = function (url, user, originator, x const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Wire Interface Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -4257,6 +4510,7 @@ exports.getCachedWireInterfaceConfiguration = function (url, user, originator, x resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4295,6 +4549,8 @@ exports.getCachedWireInterfaceHistoricalPerformances = function (url, user, orig // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedWireInterfaceHistoricalPerformances - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -4303,6 +4559,7 @@ exports.getCachedWireInterfaceHistoricalPerformances = function (url, user, orig const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Wire Interface Historical Performances - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -4334,6 +4591,7 @@ exports.getCachedWireInterfaceHistoricalPerformances = function (url, user, orig resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4372,6 +4630,8 @@ exports.getCachedWireInterfaceStatus = function (url, user, originator, xCorrela // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedWireInterfaceStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -4380,6 +4640,7 @@ exports.getCachedWireInterfaceStatus = function (url, user, originator, xCorrela const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Wire Interface Status - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -4411,6 +4672,7 @@ exports.getCachedWireInterfaceStatus = function (url, user, originator, xCorrela resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4448,6 +4710,8 @@ exports.getCachedWredProfileCapability = function (url, user, originator, xCorre // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedWredProfileCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -4456,6 +4720,7 @@ exports.getCachedWredProfileCapability = function (url, user, originator, xCorre const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Wired Profile Capability - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -4487,6 +4752,7 @@ exports.getCachedWredProfileCapability = function (url, user, originator, xCorre resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4524,6 +4790,8 @@ exports.getCachedWredProfileConfiguration = function (url, user, originator, xCo // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getCachedWredProfileConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctMountname = mountname; @@ -4532,6 +4800,7 @@ exports.getCachedWredProfileConfiguration = function (url, user, originator, xCo const finalUrl = await retrieveCorrectUrl(url, common[1].tcpConn, common[1].applicationName); const correctUrl = modifyUrlConcatenateMountNamePlusUuid(finalUrl, correctMountname); + logger.info("Wired Profile Configuration - Read from ELK mountname: " + correctMountname); let result = await ReadRecords(correctMountname); if (result != undefined) { let finalJson = await cacheResponse.cacheResponseBuilder(correctUrl, result).catch((error) => { @@ -4563,6 +4832,7 @@ exports.getCachedWredProfileConfiguration = function (url, user, originator, xCo resolve(returnObject); } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4659,11 +4929,13 @@ exports.getLiveActualEquipment = function (url, user, originator, xCorrelator, t // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveActualEquipment - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -4681,7 +4953,7 @@ exports.getLiveActualEquipment = function (url, user, originator, xCorrelator, t } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -4707,6 +4979,7 @@ exports.getLiveActualEquipment = function (url, user, originator, xCorrelator, t } } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4744,11 +5017,13 @@ exports.getLiveAirInterfaceCapability = function (url, user, originator, xCorrel // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveAirInterfaceCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -4766,7 +5041,7 @@ exports.getLiveAirInterfaceCapability = function (url, user, originator, xCorrel } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -4792,6 +5067,7 @@ exports.getLiveAirInterfaceCapability = function (url, user, originator, xCorrel } } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4829,11 +5105,13 @@ exports.getLiveAirInterfaceConfiguration = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveAirInterfaceConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -4851,7 +5129,7 @@ exports.getLiveAirInterfaceConfiguration = function (url, user, originator, xCor } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -4877,6 +5155,7 @@ exports.getLiveAirInterfaceConfiguration = function (url, user, originator, xCor } } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -4913,11 +5192,13 @@ exports.getLiveAirInterfaceCurrentPerformance = function (url, user, originator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveAirInterfaceCurrentPerformance - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -4934,7 +5215,7 @@ exports.getLiveAirInterfaceCurrentPerformance = function (url, user, originator, throw new createHttpError(530, "Data invalid. Response data not available, incomplete or corrupted"); } else { let jsonObj = res.data; - // modificaUUID(jsonObj, correctCc); + // modifyUUID(jsonObj, correctCc); resolve(jsonObj); } } @@ -4978,11 +5259,13 @@ exports.getLiveAirInterfaceHistoricalPerformances = function (url, user, origina // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveAirInterfaceHistoricalPerformances - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5000,7 +5283,7 @@ exports.getLiveAirInterfaceHistoricalPerformances = function (url, user, origina } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -5063,11 +5346,13 @@ exports.getLiveAirInterfaceStatus = function (url, user, originator, xCorrelator // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveAirInterfaceStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5085,7 +5370,7 @@ exports.getLiveAirInterfaceStatus = function (url, user, originator, xCorrelator } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -5146,11 +5431,13 @@ exports.getLiveAlarmCapability = function (url, user, originator, xCorrelator, t // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveAlarmCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5169,7 +5456,7 @@ exports.getLiveAlarmCapability = function (url, user, originator, xCorrelator, t } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -5230,11 +5517,13 @@ exports.getLiveAlarmConfiguration = function (url, user, originator, xCorrelator // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveAlarmConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5253,7 +5542,7 @@ exports.getLiveAlarmConfiguration = function (url, user, originator, xCorrelator } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -5314,11 +5603,13 @@ exports.getLiveAlarmEventRecords = function (url, user, originator, xCorrelator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveAlarmEventRecords - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5336,7 +5627,7 @@ exports.getLiveAlarmEventRecords = function (url, user, originator, xCorrelator, } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -5398,11 +5689,13 @@ exports.getLiveCoChannelProfileCapability = function (url, user, originator, xCo // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveCoChannelProfileCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5420,7 +5713,7 @@ exports.getLiveCoChannelProfileCapability = function (url, user, originator, xCo } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -5482,11 +5775,13 @@ exports.getLiveCoChannelProfileConfiguration = function (url, user, originator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveCoChannelProfileConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5504,7 +5799,7 @@ exports.getLiveCoChannelProfileConfiguration = function (url, user, originator, } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -5567,11 +5862,13 @@ exports.getLiveConnector = function (url, user, originator, xCorrelator, traceIn // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveConnector - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5589,7 +5886,7 @@ exports.getLiveConnector = function (url, user, originator, xCorrelator, traceIn } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -5652,11 +5949,13 @@ exports.getLiveContainedHolder = function (url, user, originator, xCorrelator, t // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveContainedHolder - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5674,7 +5973,7 @@ exports.getLiveContainedHolder = function (url, user, originator, xCorrelator, t } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -5730,6 +6029,8 @@ exports.getLiveControlConstruct = function (url, user, originator, xCorrelator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, true); if (typeof mountname === 'object') { + logger.error("getLiveControlConstruct - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); return; } else { @@ -5739,12 +6040,13 @@ exports.getLiveControlConstruct = function (url, user, originator, xCorrelator, const finalUrl1 = formatUrlForOdl(decodeURIComponent(Url)); const finalUrl = formatUrlForOdl(Url); const Authorization = common[0].key; - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const result = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (result == false) { //resolve(NotFound()); throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); } else if (result.status != 200) { + logger.error(result, "Get CC from live network fails, result.status!=200"); if (result.statusText == undefined) { throw new createHttpError(502, "Bad Gateway"); } else if (result.statusText == 401 || result.statusText == 403) { @@ -5758,7 +6060,7 @@ exports.getLiveControlConstruct = function (url, user, originator, xCorrelator, throw new createHttpError(530, "Data invalid. Response data not available, incomplete or corrupted"); } else { let jsonObj = result.data; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); if (myFields === undefined) { try { let elapsedTime = await recordRequest(jsonObj, correctCc); @@ -5831,11 +6133,13 @@ exports.getLiveCurrentAlarms = function (url, user, originator, xCorrelator, tra // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveCurrentAlarms - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5854,7 +6158,7 @@ exports.getLiveCurrentAlarms = function (url, user, originator, xCorrelator, tra } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -5916,11 +6220,13 @@ exports.getLiveEquipment = function (url, user, originator, xCorrelator, traceIn // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveEquipment - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -5938,7 +6244,7 @@ exports.getLiveEquipment = function (url, user, originator, xCorrelator, traceIn } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6001,11 +6307,13 @@ exports.getLiveEthernetContainerCapability = function (url, user, originator, xC // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveEthernetContainerCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6023,7 +6331,7 @@ exports.getLiveEthernetContainerCapability = function (url, user, originator, xC } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6086,11 +6394,13 @@ exports.getLiveEthernetContainerConfiguration = function (url, user, originator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveEthernetContainerConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6108,7 +6418,7 @@ exports.getLiveEthernetContainerConfiguration = function (url, user, originator, } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6170,11 +6480,13 @@ exports.getLiveEthernetContainerCurrentPerformance = function (url, user, origin // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveEthernetContainerCurrentPerformance - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6191,7 +6503,7 @@ exports.getLiveEthernetContainerCurrentPerformance = function (url, user, origin throw new createHttpError(530, "Data invalid. Response data not available, incomplete or corrupted"); } else { let jsonObj = res.data; - // modificaUUID(jsonObj, correctCc); + // modifyUUID(jsonObj, correctCc); resolve(jsonObj); } } @@ -6235,11 +6547,13 @@ exports.getLiveEthernetContainerHistoricalPerformances = function (url, user, or // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveEthernetContainerHistoricalPerformances - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6257,7 +6571,7 @@ exports.getLiveEthernetContainerHistoricalPerformances = function (url, user, or } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6320,11 +6634,13 @@ exports.getLiveEthernetContainerStatus = function (url, user, originator, xCorre // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveEthernetContainerStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6342,7 +6658,7 @@ exports.getLiveEthernetContainerStatus = function (url, user, originator, xCorre } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6405,11 +6721,13 @@ exports.getLiveExpectedEquipment = function (url, user, originator, xCorrelator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveExpectedEquipment - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6427,7 +6745,7 @@ exports.getLiveExpectedEquipment = function (url, user, originator, xCorrelator, } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6488,11 +6806,13 @@ exports.getLiveFirmwareCollection = function (url, user, originator, xCorrelator // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveFirmwareCollection - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6510,7 +6830,7 @@ exports.getLiveFirmwareCollection = function (url, user, originator, xCorrelator } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6572,11 +6892,13 @@ exports.getLiveFirmwareComponentCapability = function (url, user, originator, xC // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveFirmwareComponentCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6594,7 +6916,7 @@ exports.getLiveFirmwareComponentCapability = function (url, user, originator, xC } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6656,11 +6978,13 @@ exports.getLiveFirmwareComponentList = function (url, user, originator, xCorrela // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveFirmwareComponentList - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6678,7 +7002,7 @@ exports.getLiveFirmwareComponentList = function (url, user, originator, xCorrela } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6740,11 +7064,13 @@ exports.getLiveFirmwareComponentStatus = function (url, user, originator, xCorre // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveFirmwareComponentStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6762,7 +7088,7 @@ exports.getLiveFirmwareComponentStatus = function (url, user, originator, xCorre } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6824,11 +7150,13 @@ exports.getLiveForwardingConstruct = function (url, user, originator, xCorrelato // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveForwardingConstruct - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6846,7 +7174,7 @@ exports.getLiveForwardingConstruct = function (url, user, originator, xCorrelato } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6910,11 +7238,13 @@ exports.getLiveForwardingConstructPort = function (url, user, originator, xCorre // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveForwardingConstructPort - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -6932,7 +7262,7 @@ exports.getLiveForwardingConstructPort = function (url, user, originator, xCorre } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -6994,11 +7324,13 @@ exports.getLiveForwardingDomain = function (url, user, originator, xCorrelator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveForwardingDomain - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -7016,7 +7348,7 @@ exports.getLiveForwardingDomain = function (url, user, originator, xCorrelator, } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7078,11 +7410,13 @@ exports.getLiveHybridMwStructureCapability = function (url, user, originator, xC // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveHybridMwStructureCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -7100,7 +7434,7 @@ exports.getLiveHybridMwStructureCapability = function (url, user, originator, xC } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7163,11 +7497,13 @@ exports.getLiveHybridMwStructureConfiguration = function (url, user, originator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveHybridMwStructureConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -7185,7 +7521,7 @@ exports.getLiveHybridMwStructureConfiguration = function (url, user, originator, } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7247,11 +7583,13 @@ exports.getLiveHybridMwStructureCurrentPerformance = function (url, user, origin // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveHybridMwStructureCurrentPerformance - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -7268,7 +7606,7 @@ exports.getLiveHybridMwStructureCurrentPerformance = function (url, user, origin throw new createHttpError(530, "Data invalid. Response data not available, incomplete or corrupted"); } else { let jsonObj = res.data; - // modificaUUID(jsonObj, correctCc); + // modifyUUID(jsonObj, correctCc); resolve(jsonObj); } } @@ -7312,11 +7650,13 @@ exports.getLiveHybridMwStructureHistoricalPerformances = function (url, user, or // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveHybridMwStructureHistoricalPerformances - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -7334,7 +7674,7 @@ exports.getLiveHybridMwStructureHistoricalPerformances = function (url, user, or } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7397,11 +7737,13 @@ exports.getLiveHybridMwStructureStatus = function (url, user, originator, xCorre // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveHybridMwStructureStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -7419,7 +7761,7 @@ exports.getLiveHybridMwStructureStatus = function (url, user, originator, xCorre } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7503,7 +7845,7 @@ exports.getLiveLogicalTerminationPoint = function (url, user, originator, xCorre } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7587,7 +7929,7 @@ exports.getLiveLtpAugment = function (url, user, originator, xCorrelator, traceI } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7650,11 +7992,13 @@ exports.getLiveMacInterfaceCapability = function (url, user, originator, xCorrel // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveMacInterfaceCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -7672,7 +8016,7 @@ exports.getLiveMacInterfaceCapability = function (url, user, originator, xCorrel } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7735,11 +8079,13 @@ exports.getLiveMacInterfaceConfiguration = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveMacInterfaceConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -7757,7 +8103,7 @@ exports.getLiveMacInterfaceConfiguration = function (url, user, originator, xCor } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7820,11 +8166,13 @@ exports.getLiveMacInterfaceStatus = function (url, user, originator, xCorrelator // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveMacInterfaceStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -7842,7 +8190,7 @@ exports.getLiveMacInterfaceStatus = function (url, user, originator, xCorrelator } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7904,11 +8252,13 @@ exports.getLivePolicingProfileCapability = function (url, user, originator, xCor // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLivePolicingProfileCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -7926,7 +8276,7 @@ exports.getLivePolicingProfileCapability = function (url, user, originator, xCor } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -7988,11 +8338,13 @@ exports.getLivePolicingProfileConfiguration = function (url, user, originator, x // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLivePolicingProfileConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8010,7 +8362,7 @@ exports.getLivePolicingProfileConfiguration = function (url, user, originator, x } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8072,11 +8424,13 @@ exports.getLiveProfile = function (url, user, originator, xCorrelator, traceIndi // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveProfile - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8094,7 +8448,7 @@ exports.getLiveProfile = function (url, user, originator, xCorrelator, traceIndi } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8155,11 +8509,13 @@ exports.getLiveProfileCollection = function (url, user, originator, xCorrelator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveProfileCollection - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8177,7 +8533,7 @@ exports.getLiveProfileCollection = function (url, user, originator, xCorrelator, } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8240,11 +8596,13 @@ exports.getLivePureEthernetStructureCapability = function (url, user, originator // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLivePureEthernetStructureCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8262,7 +8620,7 @@ exports.getLivePureEthernetStructureCapability = function (url, user, originator } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8325,11 +8683,13 @@ exports.getLivePureEthernetStructureConfiguration = function (url, user, origina // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLivePureEthernetStructureConfiguration- Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8347,7 +8707,7 @@ exports.getLivePureEthernetStructureConfiguration = function (url, user, origina } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8409,11 +8769,13 @@ exports.getLivePureEthernetStructureCurrentPerformance = function (url, user, or // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLivePureEthernetStructureCurrentPerformance - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8430,7 +8792,7 @@ exports.getLivePureEthernetStructureCurrentPerformance = function (url, user, or throw new createHttpError(530, "Data invalid. Response data not available, incomplete or corrupted"); } else { let jsonObj = res.data; - // modificaUUID(jsonObj, correctCc); + // modifyUUID(jsonObj, correctCc); resolve(jsonObj); } } @@ -8474,11 +8836,13 @@ exports.getLivePureEthernetStructureHistoricalPerformances = function (url, user // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLivePureEthernetStructureHistoricalPerformances - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8496,7 +8860,7 @@ exports.getLivePureEthernetStructureHistoricalPerformances = function (url, user } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8559,11 +8923,13 @@ exports.getLivePureEthernetStructureStatus = function (url, user, originator, xC // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLivePureEthernetStructureStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8581,7 +8947,7 @@ exports.getLivePureEthernetStructureStatus = function (url, user, originator, xC } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8643,11 +9009,13 @@ exports.getLiveQosProfileCapability = function (url, user, originator, xCorrelat // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveQosProfileCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8665,7 +9033,7 @@ exports.getLiveQosProfileCapability = function (url, user, originator, xCorrelat } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8727,11 +9095,13 @@ exports.getLiveQosProfileConfiguration = function (url, user, originator, xCorre // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveQosProfileConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8749,7 +9119,7 @@ exports.getLiveQosProfileConfiguration = function (url, user, originator, xCorre } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8811,11 +9181,13 @@ exports.getLiveSchedulerProfileCapability = function (url, user, originator, xCo // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveSchedulerProfileCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8833,7 +9205,7 @@ exports.getLiveSchedulerProfileCapability = function (url, user, originator, xCo } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8894,11 +9266,13 @@ exports.getLiveSchedulerProfileConfiguration = function (url, user, originator, // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveSchedulerProfileConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -8916,7 +9290,7 @@ exports.getLiveSchedulerProfileConfiguration = function (url, user, originator, } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -8979,11 +9353,13 @@ exports.getLiveVlanInterfaceCapability = function (url, user, originator, xCorre // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveVlanInterfaceCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -9001,7 +9377,7 @@ exports.getLiveVlanInterfaceCapability = function (url, user, originator, xCorre } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -9027,6 +9403,7 @@ exports.getLiveVlanInterfaceCapability = function (url, user, originator, xCorre } } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -9064,11 +9441,13 @@ exports.getLiveVlanInterfaceConfiguration = function (url, user, originator, xCo // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveVlanInterfaceConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -9086,7 +9465,7 @@ exports.getLiveVlanInterfaceConfiguration = function (url, user, originator, xCo } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -9112,6 +9491,7 @@ exports.getLiveVlanInterfaceConfiguration = function (url, user, originator, xCo } } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -9148,11 +9528,13 @@ exports.getLiveWireInterfaceCapability = function (url, user, originator, xCorre // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveWireInterfaceCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -9170,7 +9552,7 @@ exports.getLiveWireInterfaceCapability = function (url, user, originator, xCorre } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -9196,6 +9578,7 @@ exports.getLiveWireInterfaceCapability = function (url, user, originator, xCorre } } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -9233,11 +9616,13 @@ exports.getLiveWireInterfaceConfiguration = function (url, user, originator, xCo // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveWireInterfaceConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -9255,7 +9640,7 @@ exports.getLiveWireInterfaceConfiguration = function (url, user, originator, xCo } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -9281,6 +9666,7 @@ exports.getLiveWireInterfaceConfiguration = function (url, user, originator, xCo } } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -9317,11 +9703,13 @@ exports.getLiveWireInterfaceCurrentPerformance = function (url, user, originator // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveWireInterfaceCurrentPerformance - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -9338,13 +9726,14 @@ exports.getLiveWireInterfaceCurrentPerformance = function (url, user, originator throw new createHttpError(530, "Data invalid. Response data not available, incomplete or corrupted"); } else { let jsonObj = res.data; - // modificaUUID(jsonObj, correctCc); + // modifyUUID(jsonObj, correctCc); resolve(jsonObj); } } } } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -9382,11 +9771,13 @@ exports.getLiveWireInterfaceHistoricalPerformances = function (url, user, origin // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveWireInterfaceHistoricalPerformances - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -9404,7 +9795,7 @@ exports.getLiveWireInterfaceHistoricalPerformances = function (url, user, origin } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -9430,6 +9821,7 @@ exports.getLiveWireInterfaceHistoricalPerformances = function (url, user, origin } } catch (error) { console.error(error); + logger.error(error); reject(error); } }); @@ -9467,11 +9859,13 @@ exports.getLiveWireInterfaceStatus = function (url, user, originator, xCorrelato // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveWireInterfaceStatus - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -9489,7 +9883,7 @@ exports.getLiveWireInterfaceStatus = function (url, user, originator, xCorrelato } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -9514,7 +9908,7 @@ exports.getLiveWireInterfaceStatus = function (url, user, originator, xCorrelato } } } catch (error) { - console.error(error); + logger.error(error); reject(error); } }); @@ -9551,11 +9945,13 @@ exports.getLiveWredProfileCapability = function (url, user, originator, xCorrela // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveWredProfileCapability - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -9573,7 +9969,7 @@ exports.getLiveWredProfileCapability = function (url, user, originator, xCorrela } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -9598,7 +9994,7 @@ exports.getLiveWredProfileCapability = function (url, user, originator, xCorrela } } } catch (error) { - console.error(error); + logger.error(error); reject(error); } }); @@ -9635,11 +10031,13 @@ exports.getLiveWredProfileConfiguration = function (url, user, originator, xCorr // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, false); if (typeof mountname === 'object') { + logger.error("getLiveWredProfileConfiguration - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); } else { correctCc = mountname; } - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const res = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (res == false) { throw new createHttpError(532, "Bad Gateway. Upstream server not responding."); @@ -9657,7 +10055,7 @@ exports.getLiveWredProfileConfiguration = function (url, user, originator, xCorr } else { let jsonObj = res.data; retJson = jsonObj; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); let filters = false; if (myFields !== undefined) { filters = true; @@ -9682,7 +10080,7 @@ exports.getLiveWredProfileConfiguration = function (url, user, originator, xCorr } } } catch (error) { - console.error(error); + logger.error(error); reject(error); } }); @@ -10107,7 +10505,7 @@ exports.provideListOfConnectedDevices = function (url, user, originator, xCorrel let result = await ReadRecords(mountname); if (result != undefined) { const outputJson = { - "mount-name-list": result.deviceList.map(item => item["node-id"]) + "mount-name-list": result.deviceList.map(item => item[NODE_ID]) }; resolve(outputJson); } else { @@ -10302,19 +10700,19 @@ exports.provideListOfParallelLinks = function (url, body, user, originator, xCor if (linkToCompare == undefined) { throw new createHttpError(461, `Not available. The topology (parent) object is currently not found in the cache.`); } - if (!linkToCompare["core-model-1-4:link"][0]["end-point-list"]) { + if (!linkToCompare[CORE_MODEL][0][END_POINT_LIST]) { index = 1; } - const controlConstructList = linkToCompare["core-model-1-4:link"][index]["end-point-list"].map(endpoint => endpoint["control-construct"]); + const controlConstructList = linkToCompare[CORE_MODEL][index][END_POINT_LIST].map(endpoint => endpoint[CTR_CONST]); let result = await ReadRecords("linkList"); for (var link of result.LinkList) { if (link != linkId) { let resLink = await ReadRecords(link); try { - if (!resLink["core-model-1-4:link"][0]["end-point-list"]) { + if (!resLink[CORE_MODEL][0][END_POINT_LIST]) { index1 = 1; } - const ccList = resLink["core-model-1-4:link"][index1]["end-point-list"].map(endpoint => endpoint["control-construct"]); + const ccList = resLink[CORE_MODEL][index1][END_POINT_LIST].map(endpoint => endpoint[CTR_CONST]); if (arraysHaveSameElements(controlConstructList, ccList)) { parallelLink.push(link); } @@ -10358,9 +10756,10 @@ exports.putLinkPortToCache = function (url, body, fields, uuid, localId, user, o url = decodeURIComponent(url); let correctLink = null; let link = uuid; //decodeLinkUuid(url, true); - var format = /[ `!@#$%^&*()+\=\[\]{};':"\\|,.<>\/?~]/; + const format = /[ `!@#$%^&*()+\=\[\]{};':"\\|,.<>\/?~]/; const matchLink = format.test(link); if (typeof link === 'object') { + logger.error("putLinkPortToCache - link is an object" + link); throw new createHttpError(link[0].code, link[0].message); return; } else { @@ -10394,7 +10793,7 @@ exports.putLinkPortToCache = function (url, body, fields, uuid, localId, user, o } resolve(); } catch (error) { - console.error(error); + logger.error(error); reject(error); } }); @@ -10426,15 +10825,18 @@ exports.putLinkToCache = function (url, body, fields, uuid, user, originator, xC let correctLink = null; let link = decodeLinkUuid(url, true); if (typeof link === 'object') { + logger.error("putLinkToCache - link: " + link); throw new createHttpError(link[0].code, link[0].message); return; } else { correctLink = link; } let elapsedTime = await recordRequest(body, correctLink); + + logger.info("putLinkToCache - Read from ELK: " + correctLink); let result = await ReadRecords("linkList"); if (result == undefined) { - console.warn("link list in Elasticsearch not found"); + logger.warn("link list in Elasticsearch not found"); const myObject = { LinkList: [] }; myObject.LinkList.push(correctLink); let elapsedTime = await recordRequest(myObject, "linkList"); @@ -10448,7 +10850,7 @@ exports.putLinkToCache = function (url, body, fields, uuid, user, originator, xC } resolve(); } catch (error) { - console.error(error); + logger.error(error); reject(error); } @@ -10483,7 +10885,6 @@ exports.regardControllerAttributeValueChange = function (url, body, user, origin const logicalTerminationPoint = match ? match[1] : null; // Create an object req let urlString = '/core-model-1-4:network-control-domain=live/control-construct=' + logicalTerminationPoint; - const urlf = require('url'); const parsedUrl = urlf.parse(urlString); // const appNameAndUuidFromForwarding = await NotifiedDeviceAlarmCausesUpdatingTheEntryInCurrentAlarmListOfCache() @@ -10502,7 +10903,7 @@ exports.regardControllerAttributeValueChange = function (url, body, user, origin //let ret = getLiveControlConstruct(simulatedReq, res, null, null, null, user, originator, xCorrelator, traceIndicator, customerJourney); console.log("") } catch (error) { - console.error(`Error in REST call for ${logicalTerminationPoint}:`, error.message); + logger.error(`Error in REST call for ${logicalTerminationPoint}:`, error.message); reject(error); } */ } else if (attributeName == 'connection-status' && newValue !== 'connected') { @@ -10512,13 +10913,14 @@ exports.regardControllerAttributeValueChange = function (url, body, user, origin // const deleteRecordFromElasticsearch = module.exports.deleteRecordFromElasticsearch; let ret = await deleteRecordFromElasticsearch(indexAlias, '_doc', logicalTerminationPoint); - console.log('* ' + ret.result); + logger.info('* ' + ret.result); } //update meta-data for update of connection-status let timestamp = currentJSON['timestamp']; metaDataUtility.updateMDTableForDeviceStatusChange(logicalTerminationPoint, newValue, timestamp) resolve(); } catch (error) { + logger.error(error); reject(error); } }); @@ -10565,7 +10967,7 @@ exports.regardDeviceAlarm = function (url, body, user, originator, xCorrelator, alarmHandler.updateAlarmByTypeAndResource(result, alarmTypeId, resource, problemSeverity, updatedAttributes); // Write updated Json to ES - modificaUUID(result, mountname); + modifyUUID(result, mountname); let elapsedTime = await recordRequest(result, mountname); //update meta-data for update of alarm data into CC -- partial update @@ -10573,7 +10975,7 @@ exports.regardDeviceAlarm = function (url, body, user, originator, xCorrelator, resolve(); } catch (error) { - //console.error(error); + //logger.error(error); reject(error); } }); @@ -10644,7 +11046,7 @@ exports.regardDeviceAttributeValueChange = function (url, body, user, originator resolve(); } } catch (error) { - console.error(error); + logger.error(error); reject(error); } }); @@ -10674,7 +11076,7 @@ exports.regardDeviceObjectCreation = function (url, body, user, originator, xCor const nodeId = match ? match[1] : null; // find the index of the last "/" // const lastIndex = resource.lastIndexOf("/"); - // Truncate path at last "/" + // Truncate path at last "/" // const truncatedPath = resource.substring(0, lastIndex); url = decodeURIComponent(url); @@ -10718,7 +11120,7 @@ exports.regardDeviceObjectCreation = function (url, body, user, originator, xCor resolve(); } } catch (error) { - console.error(error); + logger.error(error); reject(error); } }); @@ -10746,7 +11148,7 @@ exports.regardDeviceObjectDeletion = function (url, body, user, originator, xCor /* let jsonObj = ""; - let correctPlaceHolder = resource.replace("live", "cache"); + let correctPlaceHolder = resource.replace("live", "cache"); const appNameAndUuidFromForwarding = await NotifiedDeviceObjectDeletionCausesDeletingTheObjectInCache(counter) const tempUrl = decodeURIComponent(appNameAndUuidFromForwarding[0].tcpConn); // Parse the URL @@ -10770,7 +11172,7 @@ exports.regardDeviceObjectDeletion = function (url, body, user, originator, xCor // Update json object let finalJson = cacheUpdate.cacheUpdateBuilder(DefUrl, result, null, null); // Write updated Json to ES - modificaUUID(result, controlConstruct); + modifyUUID(result, controlConstruct); let elapsedTime = await recordRequest(result, controlConstruct); let appInformation = proxy; const releaseNumber = appInformation["release-number"]; @@ -10791,7 +11193,7 @@ exports.regardDeviceObjectDeletion = function (url, body, user, originator, xCor resolve(); } catch (error) { - console.error(error); + logger.error(error); reject(error); } }); @@ -10903,7 +11305,7 @@ async function resolveApplicationNameAndHttpClientLtpUuidFromForwardingNameForDe let url = ""; let tcpConn = ""; if (opLtpUuid.includes("odl")) { - applicationName = "OpenDayLight"; + applicationName = OPENDAYLIGHT_STR; tcpConn = await OperationClientInterface.getTcpClientConnectionInfoAsync(opLtpUuid); url = tcpConn + urlForOdl; } @@ -10920,7 +11322,7 @@ async function resolveApplicationNameAndHttpClientLtpUuidFromForwardingNameForDe } return applicationNameList; } catch (error) { - console.error(error); + logger.error(error); } } @@ -10942,16 +11344,16 @@ async function notifyAllDeviceSubscribers(deviceNotificationType, notificationMe let activeSubscribers = await notificationManagement.getActiveSubscribers(deviceNotificationType); if (activeSubscribers.length > 0) { - console.log("starting notification of " + activeSubscribers.length + " subscribers for '" + deviceNotificationType + "'"); + logger.info("starting notification of " + activeSubscribers.length + " subscribers for '" + deviceNotificationType + "'"); for (let subscriber of activeSubscribers) { sendMessageToSubscriber(deviceNotificationType, subscriber.targetOperationURL, subscriber.operationKey, notificationMessage); } } else { - console.warn("no subscribers for " + deviceNotificationType + ", message discarded"); + logger.warn("no subscribers for " + deviceNotificationType + ", message discarded"); } } catch (error) { - console.error(error); + logger.error(error); } } @@ -10971,7 +11373,7 @@ async function sendMessageToSubscriber(notificationType, targetOperationURL, ope let isDuplicate = checkNotificationDuplicate(notificationType, targetOperationURL, notificationMessage); if (isDuplicate) { - console.warn("notification duplicate ignored"); + logger.warn("notification duplicate ignored"); } else { let sendingTimestampMs = Date.now(); @@ -10996,7 +11398,7 @@ async function sendMessageToSubscriber(notificationType, targetOperationURL, ope let uniqueSendingID = crypto.randomUUID(); //send notification - console.log("sending subscriber notification to: " + targetOperationURL + " with content: " + JSON.stringify(notificationMessage) + " - debugId: '" + uniqueSendingID + "'"); + logger.info("sending subscriber notification to: " + targetOperationURL + " with content: " + JSON.stringify(notificationMessage) + " - debugId: '" + uniqueSendingID + "'"); axios.post(targetOperationURL, notificationMessage, { // axios.post("http://localhost:1237", notificationMessage, { @@ -11010,7 +11412,7 @@ async function sendMessageToSubscriber(notificationType, targetOperationURL, ope } }) .then((response) => { - console.warn("subscriber-notification success, notificationType " + notificationType + ", target url: " + targetOperationURL + ", result status: " + response.status + " - debugId: '" + uniqueSendingID + "'"); + logger.info("subscriber-notification success, notificationType " + notificationType + ", target url: " + targetOperationURL + ", result status: " + response.status + " - debugId: '" + uniqueSendingID + "'"); executionAndTraceService.recordServiceRequestFromClient( appInformation["application-name"], @@ -11025,7 +11427,7 @@ async function sendMessageToSubscriber(notificationType, targetOperationURL, ope response.data); }) .catch(e => { - console.error(e, "error during subscriber-notification for " + notificationType + " - debugId: '" + uniqueSendingID + "'"); + logger.error(e, "error during subscriber-notification for " + notificationType + " - debugId: '" + uniqueSendingID + "'"); executionAndTraceService.recordServiceRequestFromClient( appInformation["application-name"], @@ -11061,7 +11463,7 @@ function cleanupOutboundNotificationCache() { //remove timed out elements lastSentMessages = lastSentMessages.filter((element) => toRemoveElements.includes(element) === false); } catch (error) { - console.error(error); + logger.error(error); } } @@ -11091,16 +11493,13 @@ function checkNotificationDuplicate(notificationType, targetOperationURL, notifi } return false; } catch (error) { - console.error(error); + logger.error(error); } } async function sentDataToRequestor(body, user, originator, xCorrelator, traceIndicator, customerJourney, requestorUrl, operationKey) { let httpRequestHeaderRequestor; - //TO FIX - //let operationKey = 'Operation key not yet provided.' - let httpRequestHeader = new RequestHeader( user, originator, @@ -11111,7 +11510,7 @@ async function sentDataToRequestor(body, user, originator, xCorrelator, traceInd ); httpRequestHeaderRequestor = onfAttributeFormatter.modifyJsonObjectKeysToKebabCase(httpRequestHeader); - console.log('Send data to Requestor:' + requestorUrl); + logger.info('Send data to Requestor:' + requestorUrl); try { let response = await axios(requestorUrl, { @@ -11184,13 +11583,13 @@ exports.PromptForEmbeddingCausesSubscribingForNotifications = async function (us let response = await RequestBuilder.BuildAndTriggerRestRequest(opLtpUuidOutput, "POST", httpRequestHeader, httpRequestBody); let responseCodeValue = response.status.toString(); if (responseCodeValue.startsWith("2")) { - console.error(`SubscribingForNotifications - subscribing request from MWDI with body ${JSON.stringify(httpRequestBody)} failed with response status: ${response.status}`); + logger.error(`SubscribingForNotifications - subscribing request from MWDI with body ${JSON.stringify(httpRequestBody)} failed with response status: ${response.status}`); } - console.error(`SubscribingForNotifications - subscribing request from MWDI with body ${JSON.stringify(httpRequestBody)} failed with response status: ${response.status}`); + logger.error(`SubscribingForNotifications - subscribing request from MWDI with body ${JSON.stringify(httpRequestBody)} failed with response status: ${response.status}`); } } catch (error) { - console.error(`SubscribingForNotifications - subscribing request from MWDI with body ${JSON.stringify(httpRequestBody)} failed with response status: ${error.message}`); + logger.error(`SubscribingForNotifications - subscribing request from MWDI, failed with response status: ${error.message}`); return false; } } @@ -11250,7 +11649,7 @@ exports.NotifiedDeviceAlarmCausesUpdatingTheEntryInCurrentAlarmListOfCache = asy } return applicationNameList; } catch (error) { - console.error(error); + logger.error(error); } } @@ -11309,7 +11708,7 @@ async function NotifiedDeviceAttributeValueChangeCausesUpdateOfCache(counter) { } return applicationNameList; } catch (error) { - console.error(error); + logger.error(error); } } @@ -11449,12 +11848,12 @@ exports.resolveApplicationNameAndHttpClientLtpUuidFromForwardingName = async fun let indexAlias = await getIndexAliasAsync(); if (opLtpUuid.includes("odl")) { - applicationName = "OpenDayLight"; + applicationName = OPENDAYLIGHT_STR; // "OpenDayLight"; tcpConn = await OperationClientInterface.getTcpClientConnectionInfoAsync(opLtpUuid); EsClient = await elasticsearchService.getClient(false); } else if (opLtpUuid.includes("es")) { tcpConn = await getTcpClientConnectionInfoAsync(opLtpUuid); - applicationName = "ElasticSearch"; + applicationName = ELASTICSEARCH_STR; //"ElasticSearch"; EsClient = await elasticsearchService.getClient(false); } const applicationNameData = applicationName === undefined ? { @@ -11472,7 +11871,7 @@ exports.resolveApplicationNameAndHttpClientLtpUuidFromForwardingName = async fun } return applicationNameList; } catch (error) { - console.error(error); + logger.error(error); } } @@ -11490,7 +11889,7 @@ async function getTcpClientConnectionInfoAsync(operationClientUuid) { let remoteProtocol = await tcpClientInterface.getRemoteProtocolAsync(tcpServerUuid); return remoteProtocol.toLowerCase() + "://" + remoteAddress + ":" + remotePort; } catch (error) { - console.error(error); + logger.error(error); } } @@ -11507,7 +11906,7 @@ function getConfiguredRemoteAddress(remoteAddress) { } return remoteAddress; } catch (error) { - console.error(error); + logger.error(error); } } @@ -11515,29 +11914,33 @@ async function retrieveCorrectUrl(originalUrl, path, applicationName) { try { const urlParts = originalUrl.split("?fields="); const myFields = urlParts[1]; - let ControlConstruct = urlParts[0].match(/control-construct=([^/]+)/)[1]; + let controlConstruct = urlParts[0].match(/control-construct=([^/]+)/)[1]; let placeHolder = ""; - if (applicationName === "OpenDayLight") { + if (applicationName === OPENDAYLIGHT_STR) { // "OpenDayLight" placeHolder = "/rests/data/network-topology:network-topology/topology=topology-netconf/node=tochange/yang-ext:mount/core-model-1-4:control-construct" - } else if (applicationName === "ElasticSearch") { + } else if (applicationName === ELASTICSEARCH_STR) { //"ElasticSearch" placeHolder = "/"; } - var sequenzaDaCercare = "control-construct=" + ControlConstruct; - var indiceSequenza = originalUrl.indexOf(sequenzaDaCercare); - if (indiceSequenza !== -1) { - var parte1 = urlParts[0].substring(0, indiceSequenza); - if (applicationName === "OpenDayLight") { - var parte2 = urlParts[0].substring(indiceSequenza + sequenzaDaCercare.length); - } else if (applicationName === "ElasticSearch") { - var parte2 = urlParts[0].substring(indiceSequenza); + let ctrlConstrToFind = CTR_CONST +"=" + controlConstruct; + let ctrlConstrIdx = originalUrl.indexOf(ctrlConstrToFind); + + let subStringCC = ""; + if (ctrlConstrIdx !== -1) { + // let subtringCCextra = urlParts[0].substring(0, ctrlConstrIdx); // is not needed + if (applicationName === OPENDAYLIGHT_STR) { //"OpenDayLight" + subStringCC = urlParts[0].substring(ctrlConstrIdx + ctrlConstrToFind.length); + } else if (applicationName === ELASTICSEARCH_STR) { //"ElasticSearch" + subStringCC = urlParts[0].substring(ctrlConstrIdx); } } - let correctPlaceHolder = placeHolder.replace("tochange", ControlConstruct); - let final = path + correctPlaceHolder + parte2; + let correctPlaceHolder = placeHolder.replace("tochange", controlConstruct); + let final = path + correctPlaceHolder + subStringCC; + + let correctUrl = ""; if (final.indexOf("+") != -1) { - var correctUrl = final.replace(/=.*?\+/g, "="); + correctUrl = final.replace(/=.*?\+/g, "="); } else { correctUrl = final; } @@ -11546,7 +11949,7 @@ async function retrieveCorrectUrl(originalUrl, path, applicationName) { } return final; } catch (error) { - console.error(error); + logger.error(error); } } @@ -11580,7 +11983,7 @@ async function RequestForListOfDeviceInterfacesCausesReadingFromCache(mountName) let url = ""; let tcpConn = ""; - applicationName = "ElasticSearch"; + applicationName = ELASTICSEARCH_STR; // "ElasticSearch"; tcpConn = await getTcpClientConnectionInfoAsync(opLtpUuid); url = tcpConn + correctUrl; @@ -11597,7 +12000,7 @@ async function RequestForListOfDeviceInterfacesCausesReadingFromCache(mountName) } return applicationNameList; } catch (error) { - console.error(error); + logger.error(error); } } @@ -11740,7 +12143,7 @@ async function RequestForListOfActualDeviceEquipmentCausesReadingFromCache(mount let url = ""; let tcpConn = ""; - applicationName = "ElasticSearch"; + applicationName = ELASTICSEARCH_STR; // "ElasticSearch"; tcpConn = await getTcpClientConnectionInfoAsync(opLtpUuid); url = tcpConn + correctUrl; @@ -11757,7 +12160,7 @@ async function RequestForListOfActualDeviceEquipmentCausesReadingFromCache(mount } return applicationNameList; } catch (error) { - console.error(error); + logger.error(error); } } @@ -11777,10 +12180,10 @@ async function recordRequest(body, cc) { } catch (error) { if (error.statusCode === 404) { // Pipeline does not exist - console.warn(`Pipeline mwdi not found. Indexing without the pipeline.`); + logger.warn(`Pipeline mwdi not found. Indexing without the pipeline.`); } else { // Other errors - console.error("An error occurred while checking the pipeline:", error); + logger.error(error, "An error occurred while checking the pipeline:"); throw error; // Re-throw the error if it's not a 404 } } @@ -11803,19 +12206,20 @@ async function recordRequest(body, cc) { let backendTime = process.hrtime(startTime); if (result == undefined || result.body == undefined) { - console.warn("result is undefined, ELK not updated") + logger.warn("result is undefined, ELK not updated") return { "took": -1 }; } if (result.body.result == 'created' || result.body.result == 'updated') { - console.info("Result is: ", result.body.result) + logger.debug(`ELK - Result is: ${result.body.result}`); return { "took": backendTime[0] * 1000 + backendTime[1] / 1000000 }; } else { - console.warn("result is ", result.body.result); + logger.warn(`ELK - result is: ${result.body.result}`); return { "took": -1 }; } } catch (error) { - console.error(error); + logger.error("ELK - Something goes wrong in recordRequest, check the DEBUG level"); + logger.trace(error); } } @@ -11839,7 +12243,7 @@ async function deleteRequest(cc) { return { "took": backendTime[0] * 1000 + backendTime[1] / 1000000 }; } } catch (error) { - console.error(error); + logger.error(error); } } @@ -11868,48 +12272,78 @@ async function ReadRecords(cc) { } }); const resultArray = createResultArray(result); - return (resultArray[0]) + return (resultArray[0]); } catch (error) { - console.error(error); + logger.error(error); } } // Function to modify UUID to mountName+UUID -function modificaUUID(obj, mountName) { +function modifyUUID(obj, mountName) { try { for (const key in obj) { if (typeof obj[key] === 'object') { // if the value is an object, recall the function recursively - modificaUUID(obj[key], mountName); + modifyUUID(obj[key], mountName); } else if (key === 'uuid' || key === 'local-id') { obj[key] = mountName + "+" + obj[key]; } } } catch (error) { - console.error(error); + logger.error(error); } } // function to convert the response from String1+String2 to String1 function modifyReturnJson(obj) { + try { + const stack = [obj]; + + while (stack.length > 0) { + const current = stack.pop(); + + if (Array.isArray(current)) { + for (let i = 0; i < current.length; i++) { + stack.push(current[i]); + } + } else if (current && typeof current === 'object') { + for (const key in current) { + const val = current[key]; + + if (val && typeof val === 'object') { + stack.push(val); + } else if ((key === 'uuid' || key === 'local-id') && typeof val === 'string') { + const plusIndex = val.indexOf('+'); + if (plusIndex !== -1 && plusIndex < val.length - 1) { + current[key] = val.slice(plusIndex + 1); + } + } + } + } + } + } catch (error) { + logger.error('Error in modifyReturnJson:', error); + } +} + +function modifyReturnJsonOrig(obj) { try { for (const key in obj) { if (Array.isArray(obj[key])) { obj[key].forEach(item => { - modifyReturnJson(item); + modifyReturnJsonOrig(item); }); } else if (typeof obj[key] === 'object' && obj[key] !== null) { - modifyReturnJson(obj[key]); + modifyReturnJsonOrig(obj[key]); } else { if (key === 'uuid' || key === 'local-id') { - const parts = obj[key].split('+'); - obj[key] = parts[1]; + obj[key] = obj[key].split('+')[1]; } } } } catch (error) { - console.error(error); + logger.error(error); } } @@ -11917,7 +12351,7 @@ function modifyUrlConcatenateMountNamePlusUuid(url, mountname) { try { const urlParts = url.split("?fields="); const myFields = urlParts[1]; - // Split the url using = as delimitator + // Split the url using = as delimitator const parts = urlParts[0].split('='); // Modify the values @@ -11934,7 +12368,7 @@ function modifyUrlConcatenateMountNamePlusUuid(url, mountname) { } return modifiedString; } catch (error) { - console.error(error); + logger.error(error); } } @@ -11956,7 +12390,7 @@ function formatUrlForOdl(url, fields) { for (const segment of segments) { const parts = segment.split("+"); if (parts.length > 1) { - if (parts[0].indexOf("control-construct") != -1) { + if (parts[0].indexOf(CTR_CONST) != -1) { newSegments.push(parts[0]); } else { newSegments.push(parts[0].split("=")[0] + "=" + parts[1]); @@ -11971,7 +12405,7 @@ function formatUrlForOdl(url, fields) { } return newUrl; } catch (error) { - console.error(error); + logger.error(error); } } @@ -11995,7 +12429,7 @@ function decodeMountName(url, cc) { if (cc) { extractedValue = match[1]; if (!match[2]) { - const startIndex = url.indexOf("control-construct=") + "control-construct=".length; + const startIndex = url.indexOf(CTR_CONST + "=") + "control-construct=".length; extractedValue = url.substring(startIndex); } } else { @@ -12034,7 +12468,7 @@ function decodeMountName(url, cc) { return response; } } catch (error) { - console.error(error); + logger.error(error); } } @@ -12097,25 +12531,22 @@ function decodeLinkUuid(url, uuid) { return response; } } catch (error) { - console.error(error); + logger.error(error); } } async function extractProfileConfiguration(uuid) { try { - const profileCollection = require('onf-core-model-ap/applicationPattern/onfModel/models/ProfileCollection'); let profile = await profileCollection.getProfileAsync(uuid); let objectKey = Object.keys(profile)[2]; profile = profile[objectKey]; let filepath = profile["file-profile-configuration"]["file-name"]; - const fs = require('fs'); - const fileProfileOperation = require('onf-core-model-ap/applicationPattern/onfModel/models/profile/FileProfile') let applicationDataFile = await fileProfileOperation.getApplicationDataFileContent(); const data = JSON.parse(fs.readFileSync(applicationDataFile, 'utf8')); return data["api-key"]; } catch (error) { - console.error(error); + logger.error(error); } } @@ -12143,12 +12574,12 @@ function arraysHaveSameElements(array1, array2) { return Object.keys(frequencyMap).length === 0; } catch (error) { - console.error(error); + logger.error(error); } } function isFilterValid(filter) { - // Decode filter + // Decode filter let decodedFilter; try { decodedFilter = decodeURIComponent(filter); @@ -12211,7 +12642,7 @@ function replaceFilterString(filter) { return replacedFilter; } catch (error) { - console.error(error); + logger.error(error); } } @@ -12250,6 +12681,8 @@ exports.getLiveControlConstructFromSW = function (url, user, originator, xCorrel // let mountname = decodeURIComponent(url).match(/control-construct=([^/]+)/)[1]; let mountname = decodeMountName(url, true); if (typeof mountname === 'object') { + logger.error("getLiveControlConstructFromSW - Wrong decoding mountname, is an object:"); + logger.error(mountname); throw new createHttpError(mountname[0].code, mountname[0].message); return; } else { @@ -12259,12 +12692,14 @@ exports.getLiveControlConstructFromSW = function (url, user, originator, xCorrel const finalUrl1 = formatUrlForOdl(decodeURIComponent(Url)); const finalUrl = formatUrlForOdl(Url); const Authorization = common[0].key; - if (common[0].applicationName.indexOf("OpenDayLight") != -1) { + if (common[0].applicationName.indexOf(OPENDAYLIGHT_STR) != -1) { //"OpenDayLight" const result = await RestClient.dispatchEvent(finalUrl, 'GET', '', Authorization) if (result == false) { + logger.error("Get Live CC from Sliding Window: network fails"); resolve(NotFound()); throw new createHttpError.NotFound; } else if (result.status != 200) { + logger.error(result, "Get Live CC from Sliding Window: result.status != 200"); if (result.statusText == undefined) { resolve(result.status, result.message); throw new createHttpError(result.status, result.message); @@ -12274,13 +12709,13 @@ exports.getLiveControlConstructFromSW = function (url, user, originator, xCorrel } } else if (await checkMountNameInDeviceList(correctCc)) { let jsonObj = result.data; - modificaUUID(jsonObj, correctCc); + modifyUUID(jsonObj, correctCc); if (myFields === undefined) { try { let elapsedTime = await recordRequest(jsonObj, correctCc); } catch (error) { - console.error(error); + logger.error(error); } modifyReturnJson(jsonObj); let res = await cacheResponse.cacheResponseBuilder(url, jsonObj); @@ -12299,7 +12734,7 @@ exports.getLiveControlConstructFromSW = function (url, user, originator, xCorrel let elapsedTime = await recordRequest(result1, correctCc); } catch (error) { - console.error(error); + logger.error(error); } modifyReturnJson(jsonObj) let splittedUrl = url.split('?'); @@ -12312,13 +12747,13 @@ exports.getLiveControlConstructFromSW = function (url, user, originator, xCorrel } } else { - console.log(new createHttpError.BadRequest); + logger.error("This request is not for ODL, so throwing BAD_REQUEST error"); resolve(new createHttpError.BadRequest); } } } catch (error) { - console.error(error); + logger.error(error); reject(error); } diff --git a/server/service/IndividualServicesService.test.js b/server/service/IndividualServicesService.test.js index eaf89f63..80904980 100644 --- a/server/service/IndividualServicesService.test.js +++ b/server/service/IndividualServicesService.test.js @@ -1908,7 +1908,7 @@ describe('regardDeviceObjectDeletion', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: jest.fn().mockReturnValue({ updated: true }), }); - IndividualService.__Rewire__('modificaUUID', jest.fn()); + IndividualService.__Rewire__('modifyUUID', jest.fn()); IndividualService.__Rewire__('recordRequest', jest.fn().mockResolvedValue(456)); IndividualService.__Rewire__('notifyAllDeviceSubscribers', jest.fn().mockResolvedValue()); IndividualService.__Rewire__('decodeMountName', jest.fn().mockReturnValue('mount-1')); @@ -1922,7 +1922,7 @@ describe('regardDeviceObjectDeletion', () => { IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('modifyReturnJson'); IndividualService.__ResetDependency__('cacheUpdate'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('notifyAllDeviceSubscribers'); IndividualService.__ResetDependency__('decodeMountName'); @@ -2241,7 +2241,7 @@ describe('regardDeviceAlarm', () => { readRecordsMock, modifyJsonMock, updateAlarmMock, - modificaUUIDMock, + modifyUUIDMock, recordRequestMock, metaUpdateMock; @@ -2252,7 +2252,7 @@ describe('regardDeviceAlarm', () => { readRecordsMock = jest.fn(); modifyJsonMock = jest.fn(); updateAlarmMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); recordRequestMock = jest.fn(() => 123); metaUpdateMock = { updateMDTableForPartialCCUpdate: jest.fn() @@ -2262,7 +2262,7 @@ describe('regardDeviceAlarm', () => { IndividualService.__Rewire__('ReadRecords', readRecordsMock); IndividualService.__Rewire__('modifyReturnJson', modifyJsonMock); IndividualService.__Rewire__('alarmHandler', { updateAlarmByTypeAndResource: updateAlarmMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('metaDataUtility', metaUpdateMock); }); @@ -13861,7 +13861,7 @@ describe('getLiveControlConstruct', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let recordRequestMock; let modifyReturnJsonMock; let cacheResponseBuilderMock; @@ -13881,7 +13881,7 @@ describe('getLiveControlConstruct', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); cacheResponseBuilderMock = jest.fn(); @@ -13893,7 +13893,7 @@ describe('getLiveControlConstruct', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); IndividualService.__Rewire__('cacheResponse', { cacheResponseBuilder: cacheResponseBuilderMock }); @@ -13927,7 +13927,7 @@ describe('getLiveControlConstruct', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); IndividualService.__ResetDependency__('cacheResponse'); @@ -14002,7 +14002,7 @@ describe('getLiveAlarmCapability', () => { let formatUrlForOdlMock; let dispatchEventMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; let ReadRecordsMock; let cacheUpdateBuilderMock; let recordRequestMock; @@ -14020,7 +14020,7 @@ describe('getLiveAlarmCapability', () => { formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); ReadRecordsMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); @@ -14044,7 +14044,7 @@ describe('getLiveAlarmCapability', () => { IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); @@ -14057,7 +14057,7 @@ describe('getLiveAlarmCapability', () => { IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); @@ -14179,7 +14179,7 @@ describe('getLiveAlarmConfiguration', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; let cacheUpdateBuilderMock; @@ -14201,7 +14201,7 @@ describe('getLiveAlarmConfiguration', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); @@ -14212,7 +14212,7 @@ describe('getLiveAlarmConfiguration', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); @@ -14238,7 +14238,7 @@ describe('getLiveAlarmConfiguration', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('cacheUpdate'); @@ -14263,7 +14263,7 @@ describe('getLiveAlarmConfiguration', () => { expect(retrieveCorrectUrlMock).toHaveBeenCalled(); expect(formatUrlForOdlMock).toHaveBeenCalled(); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalledWith({ alarm: 'active' }, dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith({ alarm: 'active' }, dummyMountName); expect(modifyUrlConcatenateMountNamePlusUuidMock).toHaveBeenCalled(); expect(ReadRecordsMock).toHaveBeenCalledWith(dummyMountName); expect(cacheUpdateBuilderMock).toHaveBeenCalled(); @@ -14832,7 +14832,7 @@ describe('getLiveEquipment', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -14851,7 +14851,7 @@ describe('getLiveEquipment', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -14862,7 +14862,7 @@ describe('getLiveEquipment', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -14873,7 +14873,7 @@ describe('getLiveEquipment', () => { cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); recordRequestMock.mockResolvedValue(); modifyReturnJsonMock.mockImplementation((json) => json); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); }); afterEach(() => { @@ -14886,7 +14886,7 @@ describe('getLiveEquipment', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid equipment object and validate schema', async () => { @@ -15030,7 +15030,7 @@ describe('getLiveConnector', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -15049,7 +15049,7 @@ describe('getLiveConnector', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -15061,7 +15061,7 @@ describe('getLiveConnector', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mock implementations decodeMountNameMock.mockReturnValue(dummyMountName); @@ -15073,7 +15073,7 @@ describe('getLiveConnector', () => { cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); recordRequestMock.mockResolvedValue(); modifyReturnJsonMock.mockImplementation((json) => json); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); }); afterEach(() => { @@ -15087,7 +15087,7 @@ describe('getLiveConnector', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid connector data object', async () => { @@ -15233,7 +15233,7 @@ describe('getLiveContainedHolder', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -15252,7 +15252,7 @@ describe('getLiveContainedHolder', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -15264,7 +15264,7 @@ describe('getLiveContainedHolder', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mock implementations decodeMountNameMock.mockReturnValue(dummyMountName); @@ -15276,7 +15276,7 @@ describe('getLiveContainedHolder', () => { cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); recordRequestMock.mockResolvedValue(); modifyReturnJsonMock.mockImplementation((json) => json); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); }); afterEach(() => { @@ -15290,7 +15290,7 @@ describe('getLiveContainedHolder', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid contained holder object', async () => { @@ -15412,7 +15412,7 @@ describe('getLiveExpectedEquipment', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -15431,7 +15431,7 @@ describe('getLiveExpectedEquipment', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -15443,7 +15443,7 @@ describe('getLiveExpectedEquipment', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mock implementations decodeMountNameMock.mockReturnValue(dummyMountName); @@ -15455,7 +15455,7 @@ describe('getLiveExpectedEquipment', () => { cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); recordRequestMock.mockResolvedValue(); modifyReturnJsonMock.mockImplementation((json) => json); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); }); afterEach(() => { @@ -15469,7 +15469,7 @@ describe('getLiveExpectedEquipment', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid expected equipment object', async () => { @@ -15613,7 +15613,7 @@ describe('getLiveActualEquipment', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -15632,7 +15632,7 @@ describe('getLiveActualEquipment', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -15644,7 +15644,7 @@ describe('getLiveActualEquipment', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mock implementations decodeMountNameMock.mockReturnValue(dummyMountName); @@ -15656,7 +15656,7 @@ describe('getLiveActualEquipment', () => { cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); recordRequestMock.mockResolvedValue(); modifyReturnJsonMock.mockImplementation((json) => json); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); }); afterEach(() => { @@ -15670,7 +15670,7 @@ describe('getLiveActualEquipment', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid equipment data object', async () => { @@ -15813,7 +15813,7 @@ describe('getLiveFirmwareCollection', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -15832,7 +15832,7 @@ describe('getLiveFirmwareCollection', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -15844,7 +15844,7 @@ describe('getLiveFirmwareCollection', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mock implementations decodeMountNameMock.mockReturnValue(dummyMountName); @@ -15856,7 +15856,7 @@ describe('getLiveFirmwareCollection', () => { cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); recordRequestMock.mockResolvedValue(); modifyReturnJsonMock.mockImplementation((json) => json); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); }); afterEach(() => { @@ -15870,7 +15870,7 @@ describe('getLiveFirmwareCollection', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid firmware collection object', async () => { @@ -16210,7 +16210,7 @@ describe('getLiveFirmwareComponentCapability', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -16229,7 +16229,7 @@ describe('getLiveFirmwareComponentCapability', () => { cacheUpdateBuilderMock = jest.fn().mockReturnValue({ status: { value: 'active' } }); recordRequestMock = jest.fn().mockResolvedValue(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire or mock dependencies in your IndividualService module IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -16241,7 +16241,7 @@ describe('getLiveFirmwareComponentCapability', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); }); afterEach(() => { @@ -16254,7 +16254,7 @@ describe('getLiveFirmwareComponentCapability', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should resolve with firmware component capability object', async () => { @@ -16265,7 +16265,7 @@ describe('getLiveFirmwareComponentCapability', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); // Schema validation example @@ -17143,7 +17143,7 @@ describe('getLiveCoChannelProfileConfiguration', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; let cacheUpdateBuilderMock; @@ -17162,7 +17162,7 @@ describe('getLiveCoChannelProfileConfiguration', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); @@ -17174,7 +17174,7 @@ describe('getLiveCoChannelProfileConfiguration', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); @@ -17185,7 +17185,7 @@ describe('getLiveCoChannelProfileConfiguration', () => { retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); formatUrlForOdlMock.mockReturnValue('http://formatted.url'); dispatchEventMock.mockResolvedValue({ status: 200, statusText: 'OK', data: { status: { value: 'active' } } }); - modificaUUIDMock.mockImplementation((json, cc) => { /* mock: no-op */ + modifyUUIDMock.mockImplementation((json, cc) => { /* mock: no-op */ }); @@ -17201,7 +17201,7 @@ describe('getLiveCoChannelProfileConfiguration', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('cacheUpdate'); @@ -17217,7 +17217,7 @@ describe('getLiveCoChannelProfileConfiguration', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); // AJV schema validation @@ -17739,7 +17739,7 @@ describe('getLivePolicingProfileConfiguration', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -17758,7 +17758,7 @@ describe('getLivePolicingProfileConfiguration', () => { cacheUpdateBuilderMock = jest.fn().mockReturnValue({ status: { value: 'active' } }); recordRequestMock = jest.fn().mockResolvedValue(); modifyReturnJsonMock = jest.fn((json) => json); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -17769,7 +17769,7 @@ describe('getLivePolicingProfileConfiguration', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); }); afterEach(() => { @@ -17782,7 +17782,7 @@ describe('getLivePolicingProfileConfiguration', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid policing profile configuration object', async () => { @@ -17794,7 +17794,7 @@ describe('getLivePolicingProfileConfiguration', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); expect(modifyReturnJsonMock).toHaveBeenCalled(); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); // Schema validation example const ajv = new Ajv(); @@ -18105,7 +18105,7 @@ describe('getLiveQosProfileConfiguration', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; let cacheUpdateBuilderMock; @@ -18124,7 +18124,7 @@ describe('getLiveQosProfileConfiguration', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); @@ -18136,7 +18136,7 @@ describe('getLiveQosProfileConfiguration', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); @@ -18148,7 +18148,7 @@ describe('getLiveQosProfileConfiguration', () => { retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); formatUrlForOdlMock.mockReturnValue('http://formatted.url'); dispatchEventMock.mockResolvedValue({ status: 200, statusText: 'OK', data: { status: { value: 'active' } } }); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); modifyUrlConcatenateMountNamePlusUuidMock.mockReturnValue('http://resolved.url/device-abc'); ReadRecordsMock.mockResolvedValue({ some: 'record' }); cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); @@ -18162,7 +18162,7 @@ describe('getLiveQosProfileConfiguration', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('cacheUpdate'); @@ -18178,7 +18178,7 @@ describe('getLiveQosProfileConfiguration', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); // Schema validation @@ -18316,7 +18316,7 @@ describe('getLiveSchedulerProfileCapability', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; let cacheUpdateBuilderMock; @@ -18335,7 +18335,7 @@ describe('getLiveSchedulerProfileCapability', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); @@ -18347,7 +18347,7 @@ describe('getLiveSchedulerProfileCapability', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); @@ -18358,7 +18358,7 @@ describe('getLiveSchedulerProfileCapability', () => { retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); formatUrlForOdlMock.mockReturnValue('http://formatted.url'); dispatchEventMock.mockResolvedValue({ status: 200, statusText: 'OK', data: { status: { value: 'active' } } }); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); modifyUrlConcatenateMountNamePlusUuidMock.mockReturnValue('http://resolved.url/device-abc'); ReadRecordsMock.mockResolvedValue({ some: 'record' }); cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); @@ -18371,7 +18371,7 @@ describe('getLiveSchedulerProfileCapability', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('cacheUpdate'); @@ -18387,7 +18387,7 @@ describe('getLiveSchedulerProfileCapability', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); }); @@ -18484,7 +18484,7 @@ describe('getLiveSchedulerProfileConfiguration', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; let cacheUpdateBuilderMock; @@ -18503,7 +18503,7 @@ describe('getLiveSchedulerProfileConfiguration', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); @@ -18515,7 +18515,7 @@ describe('getLiveSchedulerProfileConfiguration', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); @@ -18526,7 +18526,7 @@ describe('getLiveSchedulerProfileConfiguration', () => { retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); formatUrlForOdlMock.mockReturnValue('http://formatted.url'); dispatchEventMock.mockResolvedValue({ status: 200, statusText: 'OK', data: { status: { value: 'active' } } }); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); modifyUrlConcatenateMountNamePlusUuidMock.mockReturnValue('http://resolved.url/device-abc'); ReadRecordsMock.mockResolvedValue({ some: 'record' }); cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); @@ -18539,7 +18539,7 @@ describe('getLiveSchedulerProfileConfiguration', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('cacheUpdate'); @@ -18555,7 +18555,7 @@ describe('getLiveSchedulerProfileConfiguration', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); }); @@ -18650,7 +18650,7 @@ describe('getLiveWredProfileCapability', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; let cacheUpdateBuilderMock; @@ -18669,7 +18669,7 @@ describe('getLiveWredProfileCapability', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); @@ -18681,7 +18681,7 @@ describe('getLiveWredProfileCapability', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); @@ -18693,7 +18693,7 @@ describe('getLiveWredProfileCapability', () => { retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); formatUrlForOdlMock.mockReturnValue('http://formatted.url'); dispatchEventMock.mockResolvedValue({ status: 200, statusText: 'OK', data: { status: { value: 'active' } } }); - modificaUUIDMock.mockImplementation((json, cc) => {}); + modifyUUIDMock.mockImplementation((json, cc) => {}); modifyUrlConcatenateMountNamePlusUuidMock.mockReturnValue('http://resolved.url/device-abc'); ReadRecordsMock.mockResolvedValue({ status: { value: 'active' } }); cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); @@ -18706,7 +18706,7 @@ describe('getLiveWredProfileCapability', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('cacheUpdate'); @@ -18722,7 +18722,7 @@ describe('getLiveWredProfileCapability', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); // Schema validation example @@ -19077,7 +19077,7 @@ describe('getLiveLogicalTerminationPoint', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -19096,7 +19096,7 @@ describe('getLiveLogicalTerminationPoint', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -19108,7 +19108,7 @@ describe('getLiveLogicalTerminationPoint', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mock implementations decodeMountNameMock.mockReturnValue(dummyMountName); @@ -19132,7 +19132,7 @@ describe('getLiveLogicalTerminationPoint', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid logical termination point object', async () => { @@ -19150,7 +19150,7 @@ describe('getLiveLogicalTerminationPoint', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); }); @@ -19302,7 +19302,7 @@ describe('getLiveLtpAugment', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -19321,7 +19321,7 @@ describe('getLiveLtpAugment', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -19333,7 +19333,7 @@ describe('getLiveLtpAugment', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mock implementations decodeMountNameMock.mockReturnValue(dummyMountName); @@ -19357,7 +19357,7 @@ describe('getLiveLtpAugment', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid LTP augment object', async () => { @@ -19375,7 +19375,7 @@ describe('getLiveLtpAugment', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); }); @@ -19527,7 +19527,7 @@ describe('getLiveForwardingDomain', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -19546,7 +19546,7 @@ describe('getLiveForwardingDomain', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -19558,7 +19558,7 @@ describe('getLiveForwardingDomain', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mock implementations decodeMountNameMock.mockReturnValue(dummyMountName); @@ -19570,7 +19570,7 @@ describe('getLiveForwardingDomain', () => { cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); recordRequestMock.mockResolvedValue(); modifyReturnJsonMock.mockImplementation((json) => json); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); }); afterEach(() => { @@ -19584,7 +19584,7 @@ describe('getLiveForwardingDomain', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid forwarding domain object', async () => { @@ -19903,7 +19903,7 @@ describe('getLiveForwardingConstructPort', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -19922,7 +19922,7 @@ describe('getLiveForwardingConstructPort', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -19934,7 +19934,7 @@ describe('getLiveForwardingConstructPort', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mock implementations decodeMountNameMock.mockReturnValue(dummyMountName); @@ -19946,7 +19946,7 @@ describe('getLiveForwardingConstructPort', () => { cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); recordRequestMock.mockResolvedValue(); modifyReturnJsonMock.mockImplementation((json) => json); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); }); afterEach(() => { @@ -19960,7 +19960,7 @@ describe('getLiveForwardingConstructPort', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid forwarding construct port object', async () => { @@ -20434,7 +20434,7 @@ describe('getLiveAirInterfaceStatus', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -20453,7 +20453,7 @@ describe('getLiveAirInterfaceStatus', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -20465,7 +20465,7 @@ describe('getLiveAirInterfaceStatus', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mock implementations decodeMountNameMock.mockReturnValue(dummyMountName); @@ -20477,7 +20477,7 @@ describe('getLiveAirInterfaceStatus', () => { cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); recordRequestMock.mockResolvedValue(); modifyReturnJsonMock.mockImplementation((json) => json); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); }); afterEach(() => { @@ -20491,7 +20491,7 @@ describe('getLiveAirInterfaceStatus', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid air interface status object', async () => { @@ -20777,7 +20777,7 @@ describe('getLiveAirInterfaceHistoricalPerformances', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -20796,7 +20796,7 @@ describe('getLiveAirInterfaceHistoricalPerformances', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -20807,7 +20807,7 @@ describe('getLiveAirInterfaceHistoricalPerformances', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -20830,7 +20830,7 @@ describe('getLiveAirInterfaceHistoricalPerformances', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid historical performance object', async () => { @@ -20841,7 +20841,7 @@ describe('getLiveAirInterfaceHistoricalPerformances', () => { expect(result).toEqual({ status: { value: 'historical' } }); expect(dispatchEventMock).toHaveBeenCalled(); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); const ajv = new Ajv(); @@ -20960,7 +20960,7 @@ describe('getLiveEthernetContainerCapability', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -20979,7 +20979,7 @@ describe('getLiveEthernetContainerCapability', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -20991,7 +20991,7 @@ describe('getLiveEthernetContainerCapability', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); // Mocks return values decodeMountNameMock.mockReturnValue(dummyMountName); @@ -21016,7 +21016,7 @@ describe('getLiveEthernetContainerCapability', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid ethernet container capability object on success', async () => { @@ -21027,7 +21027,7 @@ describe('getLiveEthernetContainerCapability', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); // Schema validation example (optional) @@ -21159,7 +21159,7 @@ describe('getLiveEthernetContainerConfiguration', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -21178,7 +21178,7 @@ describe('getLiveEthernetContainerConfiguration', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -21189,7 +21189,7 @@ describe('getLiveEthernetContainerConfiguration', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -21212,7 +21212,7 @@ describe('getLiveEthernetContainerConfiguration', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid ethernet container configuration object', async () => { @@ -21223,7 +21223,7 @@ describe('getLiveEthernetContainerConfiguration', () => { expect(result).toEqual({ status: { value: 'ethernet' } }); expect(dispatchEventMock).toHaveBeenCalled(); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); const ajv = new Ajv(); @@ -21343,7 +21343,7 @@ describe('getLiveEthernetContainerStatus', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -21362,7 +21362,7 @@ describe('getLiveEthernetContainerStatus', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -21374,7 +21374,7 @@ describe('getLiveEthernetContainerStatus', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -21398,7 +21398,7 @@ describe('getLiveEthernetContainerStatus', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid ethernet container status object on success', async () => { @@ -21409,7 +21409,7 @@ describe('getLiveEthernetContainerStatus', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); // Validate result against schema @@ -21676,7 +21676,7 @@ describe('getLiveEthernetContainerHistoricalPerformances', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; let cacheUpdateBuilderMock; @@ -21695,7 +21695,7 @@ describe('getLiveEthernetContainerHistoricalPerformances', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); @@ -21706,7 +21706,7 @@ describe('getLiveEthernetContainerHistoricalPerformances', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); @@ -21727,7 +21727,7 @@ describe('getLiveEthernetContainerHistoricalPerformances', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('cacheUpdate'); @@ -21744,7 +21744,7 @@ describe('getLiveEthernetContainerHistoricalPerformances', () => { expect(decodeMountNameMock).toHaveBeenCalled(); expect(retrieveCorrectUrlMock).toHaveBeenCalled(); expect(dispatchEventMock).toHaveBeenCalled(); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(ReadRecordsMock).toHaveBeenCalled(); expect(cacheUpdateBuilderMock).toHaveBeenCalled(); expect(recordRequestMock).toHaveBeenCalled(); @@ -21860,7 +21860,7 @@ describe('getLiveHybridMwStructureCapability', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -21879,7 +21879,7 @@ describe('getLiveHybridMwStructureCapability', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); // Rewire dependencies IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); @@ -21891,7 +21891,7 @@ describe('getLiveHybridMwStructureCapability', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -21914,7 +21914,7 @@ describe('getLiveHybridMwStructureCapability', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid structure capability object on success', async () => { @@ -21925,7 +21925,7 @@ describe('getLiveHybridMwStructureCapability', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalledWith(result, dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith(result, dummyMountName); expect(modifyReturnJsonMock).toHaveBeenCalled(); // JSON schema validation @@ -22069,7 +22069,7 @@ describe('getLiveHybridMwStructureConfiguration', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; let cacheUpdateBuilderMock; @@ -22088,7 +22088,7 @@ describe('getLiveHybridMwStructureConfiguration', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); @@ -22100,7 +22100,7 @@ describe('getLiveHybridMwStructureConfiguration', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); @@ -22116,7 +22116,7 @@ describe('getLiveHybridMwStructureConfiguration', () => { statusText: 'OK', data: { status: { value: 'active' } } }); - modificaUUIDMock.mockImplementation((jsonObj) => { /* no-op */ }); + modifyUUIDMock.mockImplementation((jsonObj) => { /* no-op */ }); modifyUrlConcatenateMountNamePlusUuidMock.mockReturnValue('http://resolved.url/device-abc'); ReadRecordsMock.mockResolvedValue({ some: 'record' }); cacheUpdateBuilderMock.mockReturnValue({ updated: 'json' }); @@ -22130,7 +22130,7 @@ describe('getLiveHybridMwStructureConfiguration', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('cacheUpdate'); @@ -22147,7 +22147,7 @@ describe('getLiveHybridMwStructureConfiguration', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalledWith({ status: { value: 'active' } }, dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith({ status: { value: 'active' } }, dummyMountName); expect(modifyReturnJsonMock).toHaveBeenCalledWith({ status: { value: 'active' } }); // Schema validation @@ -22298,7 +22298,7 @@ describe('getLiveHybridMwStructureStatus', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -22317,7 +22317,7 @@ describe('getLiveHybridMwStructureStatus', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -22328,7 +22328,7 @@ describe('getLiveHybridMwStructureStatus', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -22351,7 +22351,7 @@ describe('getLiveHybridMwStructureStatus', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid hybrid MW structure status object on success', async () => { @@ -22362,7 +22362,7 @@ describe('getLiveHybridMwStructureStatus', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalledWith({ status: { value: 'active' } }, dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith({ status: { value: 'active' } }, dummyMountName); expect(modifyReturnJsonMock).toHaveBeenCalled(); // Schema validation @@ -22682,7 +22682,7 @@ describe('getLiveHybridMwStructureHistoricalPerformances', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -22701,7 +22701,7 @@ describe('getLiveHybridMwStructureHistoricalPerformances', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -22712,7 +22712,7 @@ describe('getLiveHybridMwStructureHistoricalPerformances', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -22735,7 +22735,7 @@ describe('getLiveHybridMwStructureHistoricalPerformances', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid historical performances data on success', async () => { @@ -22746,7 +22746,7 @@ describe('getLiveHybridMwStructureHistoricalPerformances', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalledWith({ status: { value: 'active' } }, dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith({ status: { value: 'active' } }, dummyMountName); expect(modifyReturnJsonMock).toHaveBeenCalled(); // Schema validation example (optional) @@ -22893,7 +22893,7 @@ describe('getLiveMacInterfaceCapability', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyReturnJsonMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; @@ -22912,7 +22912,7 @@ describe('getLiveMacInterfaceCapability', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyReturnJsonMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); @@ -22923,7 +22923,7 @@ describe('getLiveMacInterfaceCapability', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); @@ -22944,7 +22944,7 @@ describe('getLiveMacInterfaceCapability', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyReturnJson'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); @@ -22964,7 +22964,7 @@ describe('getLiveMacInterfaceCapability', () => { expect(retrieveCorrectUrlMock).toHaveBeenCalledTimes(2); expect(formatUrlForOdlMock).toHaveBeenCalledWith('http://resolved.url', 'status'); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalledWith(expect.any(Object), dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith(expect.any(Object), dummyMountName); expect(modifyUrlConcatenateMountNamePlusUuidMock).toHaveBeenCalled(); expect(ReadRecordsMock).toHaveBeenCalledWith(dummyMountName); expect(cacheUpdateBuilderMock).toHaveBeenCalled(); @@ -23080,7 +23080,7 @@ describe('getLiveMacInterfaceConfiguration', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -23099,7 +23099,7 @@ describe('getLiveMacInterfaceConfiguration', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -23110,7 +23110,7 @@ describe('getLiveMacInterfaceConfiguration', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -23133,7 +23133,7 @@ describe('getLiveMacInterfaceConfiguration', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should resolve with correct data on success', async () => { @@ -23144,7 +23144,7 @@ describe('getLiveMacInterfaceConfiguration', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalledWith({ status: { value: 'active' } }, dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith({ status: { value: 'active' } }, dummyMountName); expect(modifyReturnJsonMock).toHaveBeenCalled(); }); @@ -23261,7 +23261,7 @@ describe('getLiveMacInterfaceStatus', () => { let retrieveCorrectUrlMock; let formatUrlForOdlMock; let dispatchEventMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyReturnJsonMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; @@ -23280,7 +23280,7 @@ describe('getLiveMacInterfaceStatus', () => { retrieveCorrectUrlMock = jest.fn(); formatUrlForOdlMock = jest.fn(); dispatchEventMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyReturnJsonMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); @@ -23291,7 +23291,7 @@ describe('getLiveMacInterfaceStatus', () => { IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); IndividualService.__Rewire__('formatUrlForOdl', formatUrlForOdlMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); @@ -23312,7 +23312,7 @@ describe('getLiveMacInterfaceStatus', () => { IndividualService.__ResetDependency__('retrieveCorrectUrl'); IndividualService.__ResetDependency__('formatUrlForOdl'); IndividualService.__ResetDependency__('RestClient'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyReturnJson'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); @@ -23332,7 +23332,7 @@ describe('getLiveMacInterfaceStatus', () => { expect(retrieveCorrectUrlMock).toHaveBeenCalledTimes(2); expect(formatUrlForOdlMock).toHaveBeenCalledWith('http://resolved.url', 'status'); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalledWith(expect.any(Object), dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith(expect.any(Object), dummyMountName); expect(modifyUrlConcatenateMountNamePlusUuidMock).toHaveBeenCalled(); expect(ReadRecordsMock).toHaveBeenCalledWith(dummyMountName); expect(cacheUpdateBuilderMock).toHaveBeenCalled(); @@ -23437,7 +23437,7 @@ describe('getLivePureEthernetStructureCapability', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -23456,7 +23456,7 @@ describe('getLivePureEthernetStructureCapability', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -23467,7 +23467,7 @@ describe('getLivePureEthernetStructureCapability', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -23490,7 +23490,7 @@ describe('getLivePureEthernetStructureCapability', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should resolve with correct data on success', async () => { @@ -23501,7 +23501,7 @@ describe('getLivePureEthernetStructureCapability', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalledWith({ status: { value: 'active' } }, dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith({ status: { value: 'active' } }, dummyMountName); expect(modifyReturnJsonMock).toHaveBeenCalled(); }); @@ -23615,7 +23615,7 @@ describe('getLivePureEthernetStructureConfiguration', () => { let decodeMountNameMock, retrieveCorrectUrlMock, formatUrlForOdlMock, dispatchEventMock; let modifyUrlConcatenateMountNamePlusUuidMock, ReadRecordsMock, cacheUpdateBuilderMock; - let recordRequestMock, modifyReturnJsonMock, modificaUUIDMock; + let recordRequestMock, modifyReturnJsonMock, modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -23634,7 +23634,7 @@ describe('getLivePureEthernetStructureConfiguration', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -23645,7 +23645,7 @@ describe('getLivePureEthernetStructureConfiguration', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -23668,7 +23668,7 @@ describe('getLivePureEthernetStructureConfiguration', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid ethernet structure config object', async () => { @@ -23808,7 +23808,7 @@ describe('getLivePureEthernetStructureStatus', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -23826,7 +23826,7 @@ describe('getLivePureEthernetStructureStatus', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -23837,7 +23837,7 @@ describe('getLivePureEthernetStructureStatus', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -23848,7 +23848,7 @@ describe('getLivePureEthernetStructureStatus', () => { cacheUpdateBuilderMock.mockReturnValue({ status: { value: 'active' } }); recordRequestMock.mockResolvedValue(); modifyReturnJsonMock.mockImplementation((json) => json); - modificaUUIDMock.mockImplementation(() => {}); + modifyUUIDMock.mockImplementation(() => {}); }); afterEach(() => { @@ -23861,7 +23861,7 @@ describe('getLivePureEthernetStructureStatus', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid PureEthernetStructureStatus object', async () => { @@ -23873,7 +23873,7 @@ describe('getLivePureEthernetStructureStatus', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); expect(modifyReturnJsonMock).toHaveBeenCalled(); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); const ajv = new Ajv(); const schema = { @@ -24146,7 +24146,7 @@ describe('getLivePureEthernetStructureHistoricalPerformances', () => { let decodeMountNameMock, retrieveCorrectUrlMock, formatUrlForOdlMock, dispatchEventMock; let modifyUrlConcatenateMountNamePlusUuidMock, ReadRecordsMock; - let modificaUUIDMock, cacheUpdateBuilderMock, recordRequestMock, modifyReturnJsonMock; + let modifyUUIDMock, cacheUpdateBuilderMock, recordRequestMock, modifyReturnJsonMock; beforeEach(() => { jest.clearAllMocks(); @@ -24162,7 +24162,7 @@ describe('getLivePureEthernetStructureHistoricalPerformances', () => { dispatchEventMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); @@ -24173,7 +24173,7 @@ describe('getLivePureEthernetStructureHistoricalPerformances', () => { IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); @@ -24198,7 +24198,7 @@ describe('getLivePureEthernetStructureHistoricalPerformances', () => { IndividualService.__ResetDependency__('RestClient'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); @@ -24210,7 +24210,7 @@ describe('getLivePureEthernetStructureHistoricalPerformances', () => { ); expect(result).toEqual({ history: [{ timestamp: 't1', value: 123 }] }); - expect(modificaUUIDMock).toHaveBeenCalledWith(expect.any(Object), dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith(expect.any(Object), dummyMountName); expect(modifyReturnJsonMock).toHaveBeenCalledWith(expect.any(Object)); }); @@ -24307,7 +24307,7 @@ describe('getLiveVlanInterfaceCapability', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -24326,7 +24326,7 @@ describe('getLiveVlanInterfaceCapability', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -24337,7 +24337,7 @@ describe('getLiveVlanInterfaceCapability', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -24360,7 +24360,7 @@ describe('getLiveVlanInterfaceCapability', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid VLAN interface capability object', async () => { @@ -24372,7 +24372,7 @@ describe('getLiveVlanInterfaceCapability', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); expect(modifyReturnJsonMock).toHaveBeenCalled(); - expect(modificaUUIDMock).toHaveBeenCalledWith(expect.any(Object), dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith(expect.any(Object), dummyMountName); }); it('should reject if decodeMountName returns error object', async () => { @@ -24486,7 +24486,7 @@ describe('getLiveVlanInterfaceConfiguration', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -24505,7 +24505,7 @@ describe('getLiveVlanInterfaceConfiguration', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -24516,7 +24516,7 @@ describe('getLiveVlanInterfaceConfiguration', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -24539,7 +24539,7 @@ describe('getLiveVlanInterfaceConfiguration', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return valid vlan interface configuration object', async () => { @@ -24550,7 +24550,7 @@ describe('getLiveVlanInterfaceConfiguration', () => { expect(result).toEqual({ status: { value: 'active' } }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); const ajv = new Ajv(); @@ -24670,7 +24670,7 @@ describe('getLiveWireInterfaceCapability', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -24689,7 +24689,7 @@ describe('getLiveWireInterfaceCapability', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -24700,7 +24700,7 @@ describe('getLiveWireInterfaceCapability', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -24727,7 +24727,7 @@ describe('getLiveWireInterfaceCapability', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return a valid wire interface capability object', async () => { @@ -24739,7 +24739,7 @@ describe('getLiveWireInterfaceCapability', () => { expect(result).toEqual({ status: 'up' }); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalled(); + expect(modifyUUIDMock).toHaveBeenCalled(); expect(modifyReturnJsonMock).toHaveBeenCalled(); }); @@ -24850,7 +24850,7 @@ describe('getLiveWireInterfaceConfiguration', () => { let cacheUpdateBuilderMock; let recordRequestMock; let modifyReturnJsonMock; - let modificaUUIDMock; + let modifyUUIDMock; beforeEach(() => { jest.clearAllMocks(); @@ -24869,7 +24869,7 @@ describe('getLiveWireInterfaceConfiguration', () => { cacheUpdateBuilderMock = jest.fn(); recordRequestMock = jest.fn(); modifyReturnJsonMock = jest.fn(); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('retrieveCorrectUrl', retrieveCorrectUrlMock); @@ -24880,7 +24880,7 @@ describe('getLiveWireInterfaceConfiguration', () => { IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); IndividualService.__Rewire__('recordRequest', recordRequestMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); decodeMountNameMock.mockReturnValue(dummyMountName); retrieveCorrectUrlMock.mockResolvedValue('http://resolved.url'); @@ -24903,7 +24903,7 @@ describe('getLiveWireInterfaceConfiguration', () => { IndividualService.__ResetDependency__('cacheUpdate'); IndividualService.__ResetDependency__('recordRequest'); IndividualService.__ResetDependency__('modifyReturnJson'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); }); it('should return a valid wire interface configuration object', async () => { @@ -25029,7 +25029,7 @@ describe('getLiveWireInterfaceStatus', () => { let decodeMountNameMock; let RestClientDispatchEventMock; let createHttpErrorMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; let cacheUpdateBuilderMock; @@ -25047,7 +25047,7 @@ describe('getLiveWireInterfaceStatus', () => { error.statusCode = code; return error; }); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); cacheUpdateBuilderMock = jest.fn(); @@ -25059,7 +25059,7 @@ describe('getLiveWireInterfaceStatus', () => { IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: RestClientDispatchEventMock }); IndividualService.__Rewire__('createHttpError', createHttpErrorMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); IndividualService.__Rewire__('cacheUpdate', { cacheUpdateBuilder: cacheUpdateBuilderMock }); @@ -25092,7 +25092,7 @@ describe('getLiveWireInterfaceStatus', () => { IndividualService.__ResetDependency__('decodeMountName'); IndividualService.__ResetDependency__('RestClient'); IndividualService.__ResetDependency__('createHttpError'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); IndividualService.__ResetDependency__('cacheUpdate'); @@ -25123,7 +25123,7 @@ describe('getLiveWireInterfaceStatus', () => { '', 'auth-key-0' ); - expect(modificaUUIDMock).toHaveBeenCalledWith({ some: 'data' }, dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith({ some: 'data' }, dummyMountName); expect(ReadRecordsMock).toHaveBeenCalledWith(dummyMountName); expect(cacheUpdateBuilderMock).toHaveBeenCalled(); expect(recordRequestMock).toHaveBeenCalled(); @@ -25554,7 +25554,7 @@ describe('getLiveWireInterfaceHistoricalPerformances', () => { let decodeMountNameMock; let dispatchEventMock; let createHttpErrorMock; - let modificaUUIDMock; + let modifyUUIDMock; let modifyReturnJsonMock; let modifyUrlConcatenateMountNamePlusUuidMock; let ReadRecordsMock; @@ -25574,7 +25574,7 @@ describe('getLiveWireInterfaceHistoricalPerformances', () => { error.code = code; return error; }); - modificaUUIDMock = jest.fn(); + modifyUUIDMock = jest.fn(); modifyReturnJsonMock = jest.fn(); modifyUrlConcatenateMountNamePlusUuidMock = jest.fn(); ReadRecordsMock = jest.fn(); @@ -25587,7 +25587,7 @@ describe('getLiveWireInterfaceHistoricalPerformances', () => { IndividualService.__Rewire__('decodeMountName', decodeMountNameMock); IndividualService.__Rewire__('RestClient', { dispatchEvent: dispatchEventMock }); IndividualService.__Rewire__('createHttpError', createHttpErrorMock); - IndividualService.__Rewire__('modificaUUID', modificaUUIDMock); + IndividualService.__Rewire__('modifyUUID', modifyUUIDMock); IndividualService.__Rewire__('modifyReturnJson', modifyReturnJsonMock); IndividualService.__Rewire__('modifyUrlConcatenateMountNamePlusUuid', modifyUrlConcatenateMountNamePlusUuidMock); IndividualService.__Rewire__('ReadRecords', ReadRecordsMock); @@ -25618,7 +25618,7 @@ describe('getLiveWireInterfaceHistoricalPerformances', () => { IndividualService.__ResetDependency__('decodeMountName'); IndividualService.__ResetDependency__('RestClient'); IndividualService.__ResetDependency__('createHttpError'); - IndividualService.__ResetDependency__('modificaUUID'); + IndividualService.__ResetDependency__('modifyUUID'); IndividualService.__ResetDependency__('modifyReturnJson'); IndividualService.__ResetDependency__('modifyUrlConcatenateMountNamePlusUuid'); IndividualService.__ResetDependency__('ReadRecords'); @@ -25647,7 +25647,7 @@ describe('getLiveWireInterfaceHistoricalPerformances', () => { expect(formatUrlForOdlMock).toHaveBeenCalledWith('http://correct.url', 'somefield'); expect(decodeMountNameMock).toHaveBeenCalledWith(expect.any(String), false); expect(dispatchEventMock).toHaveBeenCalledWith('http://formatted.url', 'GET', '', 'auth-key'); - expect(modificaUUIDMock).toHaveBeenCalledWith({ some: 'data' }, dummyMountName); + expect(modifyUUIDMock).toHaveBeenCalledWith({ some: 'data' }, dummyMountName); expect(ReadRecordsMock).toHaveBeenCalledWith(dummyMountName); expect(cacheUpdateBuilderMock).toHaveBeenCalled(); expect(recordRequestMock).toHaveBeenCalled(); diff --git a/server/service/LoggingService.js b/server/service/LoggingService.js new file mode 100644 index 00000000..bb4e90ae --- /dev/null +++ b/server/service/LoggingService.js @@ -0,0 +1,26 @@ +const pino = require('pino'); +const path = require("path"); + +// configuration for pino with pretty console output and logfile output +const transports = pino.transport({ + targets: [ + { + level: 'info', + target: 'pino-pretty', + options: { colorize: true } + }, + // { + // level: 'warn', + // target: 'pino-roll', + // options: { file: path.join(__dirname, '../logs/MicroWaveDeviceInventory'), extension: '.log', mkdir: true, + // frequency: 'daily', dateFormat: 'yyyy-MM-dd', size: "1m", "limit": 50, "limit.count": 10 } + // } + ] +}); + +// create pino logger instance +const logger = pino({level: 'info'}, transports); + +exports.getLogger = function getLogger() { + return logger; +}; diff --git a/server/service/OperationClientService.js b/server/service/OperationClientService.js index 0dfac07e..a4a93283 100644 --- a/server/service/OperationClientService.js +++ b/server/service/OperationClientService.js @@ -12,8 +12,8 @@ const operationClientInterface = require('onf-core-model-ap/applicationPattern/o exports.getOperationClientDetailedLoggingIsOn = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "operation-client-interface-1-0:detailed-logging-is-on": value }; @@ -38,8 +38,8 @@ exports.getOperationClientDetailedLoggingIsOn = function (url) { exports.getOperationClientLifeCycleState = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "operation-client-interface-1-0:life-cycle-state": value }; @@ -64,8 +64,8 @@ exports.getOperationClientLifeCycleState = function (url) { exports.getOperationClientOperationKey = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "operation-client-interface-1-0:operation-key": value }; @@ -89,8 +89,8 @@ exports.getOperationClientOperationKey = function (url) { exports.getOperationClientOperationName = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "operation-client-interface-1-0:operation-name": value }; @@ -115,8 +115,8 @@ exports.getOperationClientOperationName = function (url) { exports.getOperationClientOperationalState = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "operation-client-interface-1-0:operational-state": value }; diff --git a/server/service/OperationServerService.js b/server/service/OperationServerService.js index 62602ae4..db9a5b50 100644 --- a/server/service/OperationServerService.js +++ b/server/service/OperationServerService.js @@ -13,8 +13,8 @@ const operationServerInterface = require('onf-core-model-ap/applicationPattern/o exports.getOperationServerLifeCycleState = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "operation-server-interface-1-0:life-cycle-state": value }; @@ -39,8 +39,8 @@ exports.getOperationServerLifeCycleState = function (url) { exports.getOperationServerOperationKey = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "operation-server-interface-1-0:operation-key": value }; @@ -66,8 +66,8 @@ exports.getOperationServerOperationKey = function (url) { exports.getOperationServerOperationName = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "operation-server-interface-1-0:operation-name": value }; diff --git a/server/service/TcpClientService.js b/server/service/TcpClientService.js index fd953b05..b31539a6 100644 --- a/server/service/TcpClientService.js +++ b/server/service/TcpClientService.js @@ -15,8 +15,8 @@ const { isTcpClientElasticsearch, elasticsearchService } = require('onf-core-mod exports.getTcpClientRemoteAddress = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "tcp-client-interface-1-0:remote-address": value }; @@ -40,8 +40,8 @@ exports.getTcpClientRemoteAddress = function (url) { exports.getTcpClientRemotePort = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "tcp-client-interface-1-0:remote-port": value }; @@ -65,8 +65,8 @@ exports.getTcpClientRemotePort = function (url) { exports.getTcpClientRemoteProtocol = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "tcp-client-interface-1-0:remote-protocol" : value }; diff --git a/server/service/TcpServerService.js b/server/service/TcpServerService.js index d9bedaf5..4123e25a 100644 --- a/server/service/TcpServerService.js +++ b/server/service/TcpServerService.js @@ -13,8 +13,8 @@ const tcpServerInterface = require('onf-core-model-ap/applicationPattern/onfMode exports.getTcpServerDescription = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "tcp-server-interface-1-0:description" : value }; @@ -38,8 +38,8 @@ exports.getTcpServerDescription = function(url) { exports.getTcpServerLocalAddress = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "tcp-server-interface-1-0:local-address": value }; @@ -63,8 +63,8 @@ exports.getTcpServerLocalAddress = function (url) { exports.getTcpServerLocalPort = function (url) { return new Promise(async function (resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "tcp-server-interface-1-0:local-port": value }; @@ -88,8 +88,8 @@ exports.getTcpServerLocalPort = function (url) { exports.getTcpServerLocalProtocol = function(url) { return new Promise(async function(resolve, reject) { try { - var value = await fileOperation.readFromDatabaseAsync(url); - var response = {}; + let value = await fileOperation.readFromDatabaseAsync(url); + let response = {}; response['application/json'] = { "tcp-server-interface-1-0:local-protocol" : value }; diff --git a/server/service/individualServices/BequeathYourDataAndDieHandler.js b/server/service/individualServices/BequeathYourDataAndDieHandler.js index 5979097d..884dab7c 100644 --- a/server/service/individualServices/BequeathYourDataAndDieHandler.js +++ b/server/service/individualServices/BequeathYourDataAndDieHandler.js @@ -11,7 +11,6 @@ const forwardingDomain = require('onf-core-model-ap/applicationPattern/onfModel/ async function addSubscribersToNewRelease(appAddress, appPort) { - try { let subscriberNotificationTypes = [ configConstants.OAM_PATH_ATTRIBUTE_VALUE_CHANGES, @@ -29,7 +28,7 @@ async function addSubscribersToNewRelease(appAddress, appPort) { "subscriber-operation": activeSubscriber.operationName, "subscriber-protocol": activeSubscriber.protocol, "subscriber-address": activeSubscriber.address, - "subscriber-port": activeSubscriber.port + "subscriber-port": activeSubscriber.port }; let targetNewReleaseURL = notificationManagement.buildControllerTargetPath("http", appAddress, appPort) + subscriberNotificationType; @@ -55,7 +54,7 @@ async function addSubscribersToNewRelease(appAddress, appPort) { }) .catch(e => { console.log("OLD -> NEW RELEASE tranferring error. (Type: " + subscriberNotificationType + " name: " + activeSubscriber.operationName + ")"); - }); + }); } } return true; @@ -117,9 +116,8 @@ exports.handleRequest = async function (body, requestUrl) { const {stopMetaDataCyclicProcess} = require('./CyclicProcessService/metaDataTableCyclicProcess.js'); stopMetaDataCyclicProcess(); - } - + return success; } diff --git a/server/service/individualServices/ConfigConstants.js b/server/service/individualServices/ConfigConstants.js index f04ac77a..79352ffa 100644 --- a/server/service/individualServices/ConfigConstants.js +++ b/server/service/individualServices/ConfigConstants.js @@ -8,6 +8,10 @@ const OAM_PATH_DEVICE_ATTR_VALUE_CHANGES = "/v1/notify-device-attribute-value-ch const OAM_PATH_DEVICE_OBJECT_CREATIONS = "/v1/notify-device-object-creations"; const OAM_PATH_DEVICE_OBJECT_DELETIONS = "/v1/notify-device-object-deletions"; +const OAM_PATH_CONTROLLER_ATTRIBUTE_VALUE_CHANGES = "/v1/regard-controller-attribute-value-change"; +const OAM_PATH_CONTROLLER_ATTRIBUTE_OBJECT_CREATIONS = "/v1/regard-controller-object-creations"; // API not yet declared into MWDI +const OAM_PATH_CONTROLLER_ATTRIBUTE_OBJECT_DELETIONS = "/v1/regard-controller-object-deletions"; // API not yet declared into MWDI + const OPERATION_SUB_NOTIF_CONTROLLER_CHANGED_ATTR = "SubscriptionCausesNotifyingOfChangedControllerAttributeValue"; const OPERATION_SUB_NOTIF_CONTROLLER_OBJ_CREATION = "SubscriptionCausesNotifyingOfControllerObjectCreation"; const OPERATION_SUB_NOTIF_CONTROLLER_OBJ_DELETION = "SubscriptionCausesNotifyingOfControllerObjectDeletion"; @@ -41,7 +45,7 @@ function getForwardingName(requestUrl) { case OAM_PATH_ATTRIBUTE_OBJECT_CREATIONS: return OPERATION_SUB_NOTIF_OBJ_CREATION; case OAM_PATH_ATTRIBUTE_OBJECT_DELETIONS: - return OPERATION_SUB_NOTIF_OBJ_DELETION; + return OPERATION_SUB_NOTIF_OBJ_DELETION; case OAM_PATH_DEVICE_ALARMS: return OPERATION_SUB_NOTIF_DEVICE_ALARMS; case OAM_PATH_DEVICE_ATTR_VALUE_CHANGES: @@ -56,7 +60,6 @@ function getForwardingName(requestUrl) { } module.exports = { - OAM_PATH_ATTRIBUTE_VALUE_CHANGES, OAM_PATH_ATTRIBUTE_OBJECT_CREATIONS, OAM_PATH_ATTRIBUTE_OBJECT_DELETIONS, @@ -65,6 +68,10 @@ module.exports = { OAM_PATH_DEVICE_OBJECT_CREATIONS, OAM_PATH_DEVICE_OBJECT_DELETIONS, + OAM_PATH_CONTROLLER_ATTRIBUTE_VALUE_CHANGES, + OAM_PATH_CONTROLLER_ATTRIBUTE_OBJECT_CREATIONS, + OAM_PATH_CONTROLLER_ATTRIBUTE_OBJECT_DELETIONS, + OPERATION_SUB_NOTIF_CONTROLLER_CHANGED_ATTR, OPERATION_SUB_NOTIF_CONTROLLER_OBJ_CREATION, OPERATION_SUB_NOTIF_CONTROLLER_OBJ_DELETION, diff --git a/server/service/individualServices/ControlConstructUtil.js b/server/service/individualServices/ControlConstructUtil.js index df6b654c..3745afb0 100644 --- a/server/service/individualServices/ControlConstructUtil.js +++ b/server/service/individualServices/ControlConstructUtil.js @@ -22,7 +22,7 @@ async function deleteAllFcPortsForApplication(httpClientUUID) { await forwardingConstruct.deleteFcPortAsync(fcPortsForAppElement.forwardingConstruct.uuid, fcPortsForAppElement.fcPort["local-id"]); } } catch (exception) { - console.log.error("cleaning of FcPorts failed for " + httpClientUUID); + console.error("cleaning of FcPorts failed for " + httpClientUUID); return false; } diff --git a/server/service/individualServices/ControllerManagement.js b/server/service/individualServices/ControllerManagement.js index 87770c38..8175245e 100644 --- a/server/service/individualServices/ControllerManagement.js +++ b/server/service/individualServices/ControllerManagement.js @@ -60,7 +60,7 @@ async function logActiveControllers() { for (const activeController of listOfActiveControllers) { activeControllerLog += activeController.name + "/" + activeController.release + ", "; } - console.log.info("active controllers: " + activeControllerLog); + console.info("active controllers: " + activeControllerLog); } /** @@ -158,7 +158,7 @@ exports.registerController = async function (inputControllerName, inputControlle let successFc = await forwardingConstruct.addFcPortAsync(forwardingConstructInstance.uuid, newFcPort); if (!successFc) { - console.log.error("addFcPortAsync failed for operationUUID=" + operationUUID); + console.error("addFcPortAsync failed for operationUUID=" + operationUUID); } } } @@ -172,7 +172,7 @@ exports.registerController = async function (inputControllerName, inputControlle return true; } catch (exception) { - console.log.error(exception); + console.error(exception); return false; } } @@ -210,7 +210,7 @@ exports.deregisterController = async function (inputControllerName, inputControl return true; } catch (exception) { - console.log.error(exception, "deregisterController failed with name " + inputControllerName); + console.error(exception, "deregisterController failed with name " + inputControllerName); return false; } } diff --git a/server/service/individualServices/CyclicProcessService/cyclicProcess.js b/server/service/individualServices/CyclicProcessService/cyclicProcess.js index 1ed2deae..53e0f76b 100644 --- a/server/service/individualServices/CyclicProcessService/cyclicProcess.js +++ b/server/service/individualServices/CyclicProcessService/cyclicProcess.js @@ -1,13 +1,17 @@ 'use strict'; +const fs = require('node:fs'); +const path = require('path'); const { strict } = require('assert'); const { setTimeout, clearInterval } = require('timers'); -const path = require("path"); +// const shuffleArray = require('shuffle-array'); // Not used +const notificationManagement = require('../../individualServices/NotificationManagement'); const individualServicesService = require("../../IndividualServicesService.js"); -const shuffleArray = require('shuffle-array'); + +const executionAndTraceService = require('onf-core-model-ap/applicationPattern/services/ExecutionAndTraceService'); const forwardingDomain = require('onf-core-model-ap/applicationPattern/onfModel/models/ForwardingDomain'); -const notificationManagement = require('../../individualServices/NotificationManagement'); -const { eviceIsDeletedduetoPeroidicUpdate} = require('./metaDataUtility.js'); +const profileCollection = require('onf-core-model-ap/applicationPattern/onfModel/models/ProfileCollection'); +const { eviceIsDeletedduetoPeroidicUpdate } = require('./metaDataUtility.js'); // SIMULATION const startModule = require('../../../temporarySupportFiles/StartModule.js'); @@ -15,6 +19,9 @@ const { inherits } = require('util'); let simulationProgress = false; // SIMULATION +// Constants +const NODE_ID = 'node-id'; + const DEVICE_NOT_PRESENT = -1; const TTL_CHECKING_TIMER = 1000; let deviceListSyncPeriod = 24; @@ -39,19 +46,28 @@ async function sendRequest(device) { let requestHeader = notificationManagement.createRequestHeader(); let fields = ""; let mountName = ""; - let user = requestHeader.user; - let originator = requestHeader.originator; - let xCorrelator = requestHeader.xCorrelator; - let traceIndicator = requestHeader.traceIndicator; - let customerJourney = requestHeader.customerJourney; + // let user = requestHeader.user; + // let originator = requestHeader.originator; + // let xCorrelator = requestHeader.xCorrelator; + // let traceIndicator = requestHeader.traceIndicator; + // let customerJourney = requestHeader.customerJourney; let req = { - 'url': '/' + coreModelPrefix + ':network-control-domain=live/control-construct=' + device['node-id'], + 'url': '/' + coreModelPrefix + ':network-control-domain=live/control-construct=' + device[NODE_ID], 'body': {} } let responseCode = ""; let responseBodyToDocument = {}; - let ret = await individualServicesService.getLiveControlConstructFromSW(req.url, user, originator, xCorrelator, traceIndicator, customerJourney, mountName, fields); + let ret = await individualServicesService.getLiveControlConstructFromSW( + req.url, + requestHeader.user, + requestHeader.originator, + requestHeader.xCorrelator, + requestHeader.traceIndicator, + requestHeader.customerJourney, + mountName, + fields + ); if (procedureIsRunning == false) { return; @@ -63,16 +79,24 @@ async function sendRequest(device) { responseCode = ret.code; responseBodyToDocument = ret; } - var executionAndTraceService = require('onf-core-model-ap/applicationPattern/services/ExecutionAndTraceService'); - executionAndTraceService.recordServiceRequest(xCorrelator, traceIndicator, user, originator, req.url, responseCode, req.body, responseBodyToDocument); + + executionAndTraceService.recordServiceRequest( + requestHeader.xCorrelator, + requestHeader.traceIndicator, + requestHeader.user, + requestHeader.originator, + req.url, + responseCode, + req.body, + responseBodyToDocument + ); return { 'ret': ret, - 'node-id': device['node-id'] + 'node-id': device[NODE_ID] }; } catch (error) { console.error(`Error in REST call for ${device.node_id}:`, error.message); - debugger; } } @@ -83,14 +107,13 @@ function prepareObjectForWindow(deviceListIndex) { try { let windowObject = { "index": deviceListIndex, - "node-id": deviceList[deviceListIndex]['node-id'], + "node-id": deviceList[deviceListIndex][NODE_ID], "ttl": responseTimeout, "retries": maximumNumberOfRetries }; return windowObject; } catch (error) { - console.log("Error in prepareObjectForWindow (" + error + ")"); - debugger; + console.error("Error in prepareObjectForWindow (" + error + ")"); } } @@ -110,7 +133,6 @@ function checkDeviceExistsInSlidingWindow(deviceNodeId) { return DEVICE_NOT_PRESENT; } catch (error) { console.log("Error in checkDeviceExistsInSlidingWindow (" + error + ")"); - debugger; } } @@ -130,7 +152,6 @@ function getNextDeviceListIndex() { return lastDeviceListIndex; } catch (error) { console.log("Error in getNextDeviceListIndex (" + error + ")"); - debugger; } } @@ -149,11 +170,11 @@ function addNextDeviceListElementInWindow() { counter += 1 let newDeviceListIndex = getNextDeviceListIndex(); if (newDeviceListIndex == -1) { - printLog('+++++ addNextDeviceListElementInWindow: newDeviceListIndex = -1 +++++', print_log_level >= 3) - return false + printLog('+++++ addNextDeviceListElementInWindow: newDeviceListIndex = -1 +++++', print_log_level >= 3); + return false; } if (checkDeviceExistsInSlidingWindow(deviceList[newDeviceListIndex]['node-id']) != DEVICE_NOT_PRESENT) { - printLog('+++++ Element ' + deviceList[newDeviceListIndex]['node-id'] + ' (indice: ' + newDeviceListIndex + ') already exists in Sliding Window +++++', print_log_level >= 3) + printLog('+++++ Element ' + deviceList[newDeviceListIndex][NODE_ID] + ' (index: ' + newDeviceListIndex + ') already exists in Sliding Window +++++', print_log_level >= 3); } else { slidingWindow.push(prepareObjectForWindow(newDeviceListIndex)); elementAdded = true; @@ -162,7 +183,6 @@ function addNextDeviceListElementInWindow() { return true; } catch (error) { console.log("Error in addNextDeviceListElementInWindow (" + error + ")") - debugger } } @@ -172,7 +192,7 @@ function addNextDeviceListElementInWindow() { function printList(listName, list) { let listGraph = listName + ': ['; for (let i = 0; i < list.length; i++) { - listGraph += (i < list.length - 1) ? (list[i]['node-id'] + '|') : list[i]['node-id']; + listGraph += (i < list.length - 1) ? (list[i][NODE_ID] + '|') : list[i][NODE_ID]; } listGraph += "] (" + list.length + ")"; return listGraph; @@ -206,7 +226,6 @@ function setDeviceListElementTimeStamp(node_id) { } } catch (error) { console.log("Error in setDeviceListElementTimeStamp (" + error + ")"); - debugger; } } @@ -224,16 +243,16 @@ async function startTtlChecking() { if (slidingWindow[index].ttl == 0) { let consoleMsg = ''; if (slidingWindow[index].retries == 0) { - consoleMsg = "Element " + slidingWindow[index]['node-id'] + " Timeout/Retries. Dropped from S-W."; + consoleMsg = "Element " + slidingWindow[index][NODE_ID] + " Timeout/Retries. Dropped from S-W."; slidingWindow.splice(index, 1); if (addNextDeviceListElementInWindow()) { - consoleMsg += (' Added element ' + slidingWindow[slidingWindow.length - 1]['node-id'] + ' in S-W and sent request...'); + consoleMsg += (' Added element ' + slidingWindow[slidingWindow.length - 1][NODE_ID] + ' in S-W and sent request...'); requestMessage(slidingWindow.length - 1); } } else { slidingWindow[index].ttl = responseTimeout; slidingWindow[index].retries -= 1; - consoleMsg = "Element " + slidingWindow[index]['node-id'] + " Timeout. -> Resend the request..."; + consoleMsg = "Element " + slidingWindow[index][NODE_ID] + " Timeout. -> Resend the request..."; requestMessage(index); } console.log(consoleMsg); @@ -245,7 +264,6 @@ async function startTtlChecking() { } } catch (error) { console.log("Error in startTtlChecking (" + error + ")"); - debugger; } } @@ -260,44 +278,46 @@ async function requestMessage(index) { if (index >= slidingWindow.length) { return; } + let startTime = new Date(); + function manageResponse(retObj) { let endTime = new Date(); let diffTime = endTime.getTime() - startTime.getTime(); let consoleMsg = ''; if (retObj.ret.code !== undefined) { - let elementIndex = checkDeviceExistsInSlidingWindow(retObj['node-id']); + let elementIndex = checkDeviceExistsInSlidingWindow(retObj[NODE_ID]); if (elementIndex == DEVICE_NOT_PRESENT) { - consoleMsg = '[Resp. Time: ' + diffTime + 'ms] Response from element ' + retObj['node-id'] + ' not more present in S-W. Ignore that.'; + consoleMsg = '[Resp. Time: ' + diffTime + 'ms] Response from element ' + retObj[NODE_ID] + ' not more present in S-W. Ignore that.'; } else { if (retObj.ret.code == 503) { - consoleMsg = '[Resp. Time: ' + diffTime + 'ms] Element ' + retObj['node-id'] + ' not available. Dropped from S-W.'; + consoleMsg = '[Resp. Time: ' + diffTime + 'ms] Element ' + retObj[NODE_ID] + ' not available. Dropped from S-W.'; } else { - consoleMsg = '[Resp. Time: ' + diffTime + 'ms] Error (' + retObj.ret.code + ' - ' + retObj.ret.message + ') from element ' + retObj['node-id'] + '. Dropped from S-W.'; + consoleMsg = '[Resp. Time: ' + diffTime + 'ms] Error (' + retObj.ret.code + ' - ' + retObj.ret.message + ') from element ' + retObj[NODE_ID] + '. Dropped from S-W.'; } slidingWindow.splice(elementIndex, 1); if (addNextDeviceListElementInWindow()) { - consoleMsg += (' Add element ' + slidingWindow[slidingWindow.length - 1]['node-id'] + ' in S-W and send request...'); + consoleMsg += (' Add element ' + slidingWindow[slidingWindow.length - 1][NODE_ID] + ' in S-W and send request...'); requestMessage(slidingWindow.length - 1); } } } else { - let elementIndex = checkDeviceExistsInSlidingWindow(retObj['node-id']); + let elementIndex = checkDeviceExistsInSlidingWindow(retObj[NODE_ID]); if (elementIndex == DEVICE_NOT_PRESENT) { - consoleMsg = '[Resp. Time: ' + diffTime + 'ms] Response from element ' + retObj['node-id'] + ' not more present in S-W. Ignore that.'; + consoleMsg = '[Resp. Time: ' + diffTime + 'ms] Response from element ' + retObj[NODE_ID] + ' not more present in S-W. Ignore that.'; } else { - consoleMsg = '[Resp. Time: ' + diffTime + 'ms] Response from element ' + retObj['node-id'] + '. Dropped from S-W.'; + consoleMsg = '[Resp. Time: ' + diffTime + 'ms] Response from element ' + retObj[NODE_ID] + '. Dropped from S-W.'; slidingWindow.splice(elementIndex, 1); - setDeviceListElementTimeStamp(retObj['node-id']); + setDeviceListElementTimeStamp(retObj[NODE_ID]); if (addNextDeviceListElementInWindow()) { - consoleMsg += (' Add element ' + slidingWindow[slidingWindow.length - 1]['node-id'] + ' in S-W and send request...'); + consoleMsg += (' Add element ' + slidingWindow[slidingWindow.length - 1][NODE_ID] + ' in S-W and send request...'); requestMessage(slidingWindow.length - 1); } } } console.log(consoleMsg); } - + sendRequest(slidingWindow[index]).then(async retObj => { let busy = true; let steps = 0; @@ -309,6 +329,7 @@ async function requestMessage(index) { busy = false; } } while (busy == true); + if (procedureIsRunning) { if (steps > 0) { console.log('SYNCH_IN_PROGRESS [from response] (steps: ' + steps + ')'); @@ -318,7 +339,6 @@ async function requestMessage(index) { }) } catch (error) { console.log("Error in requestMessage (" + error + ")"); - debugger; } } @@ -346,38 +366,36 @@ function getTime() { /** * Writes the realignment log file - * */ function writeRealigmentLogFile(curDeviceList, currSlidingWindow, newDeviceList, elemsAdded, elemsDropped, newSlidingWindow) { - - const fs = require('node:fs'); - const path = require('path'); const folderName = '/realignment_logs' try { if (!fs.existsSync(folderName)) { return; } } catch (error) { - console.log('fs.existsSync error: ' + error); + console.error('fs.existsSync error: ' + error); return; } function getFileName() { const d = new Date(); + function dualDigits(value) { let strVal = String(value); return (strVal.length == 1) ? ('0' + strVal) : strVal; } + return d.getFullYear() + '.' + dualDigits((d.getMonth() + 1)) + '.' + dualDigits(d.getDate()) + '_' + dualDigits(d.getHours()) + '.' + dualDigits(d.getMinutes()) + '.' + dualDigits(d.getSeconds()) + '.log'; } function printArray(arr) { - var elemsForLine = 0; + let elemsForLine = 0; content += '\n['; for (var i = 0; i < arr.length; i++) { - content += (arr[i]['node-id'] + '|'); + content += (arr[i][NODE_ID] + '|'); elemsForLine += 1; if (elemsForLine == 6) { content += '\n '; @@ -440,7 +458,7 @@ module.exports.updateDeviceListFromNotification = async function updateDeviceLis let dlString = prefix + ': [' let i = 0; for (; i < deviceList.length; i++) { - dlString += (deviceList[i]['node-id'] + '|') + dlString += (deviceList[i][NODE_ID] + '|'); } if (i > 0) { dlString = dlString.slice(0, -1); @@ -464,7 +482,7 @@ module.exports.updateDeviceListFromNotification = async function updateDeviceLis } if (status == 1) { // Connected for (var i = 0; i < deviceList.length; i++) { - if (deviceList[i]['node-id'] == node_id) { + if (deviceList[i][NODE_ID] == node_id) { console.log("Notification: element " + node_id + " already present in device list. Ignore that.") return; // Element already present } @@ -480,12 +498,12 @@ module.exports.updateDeviceListFromNotification = async function updateDeviceLis if (slidingWindow.length < slidingWindowSizeDb) { addNextDeviceListElementInWindow(); requestMessage(slidingWindow.length - 1); - console.log(' Add element ' + slidingWindow[slidingWindow.length - 1]['node-id'] + ' in S-W and send request...'); + console.log(' Add element ' + slidingWindow[slidingWindow.length - 1][NODE_ID] + ' in S-W and send request...'); } - } else { // Not connected + } else { // Not connected let found = false; for (let i = 0; i < deviceList.length; i++) { - if (deviceList[i]['node-id'] == node_id) { + if (deviceList[i][NODE_ID] == node_id) { found = true; printDL('Device List before not connected notification'); deviceList.splice(i, 1); @@ -494,14 +512,14 @@ module.exports.updateDeviceListFromNotification = async function updateDeviceLis } } if (found == false) { - console.log("Notification: element " + node_id + " not present in device list. Ignore that."); + console.log("Notification: element " + node_id + " not present in device list. Ignore that."); return; } for (let i = 0; i < slidingWindow.length; i++) { - if (slidingWindow[i]['node-id'] == node_id) { + if (slidingWindow[i][NODE_ID] == node_id) { slidingWindow.splice(i, 1); if (addNextDeviceListElementInWindow()) { - console.log(' Add element ' + slidingWindow[slidingWindow.length - 1]['node-id'] + ' in S-W and send request...'); + console.log(' Add element ' + slidingWindow[slidingWindow.length - 1][NODE_ID] + ' in S-W and send request...'); requestMessage(slidingWindow.length - 1); } } @@ -519,7 +537,7 @@ module.exports.updateDeviceListFromNotification = async function updateDeviceLis } /** - * Realigns the current device list with the new one + * Realigns the current device list with the new one * * newDeviceList is the new device list that update the old one. It's mandatory. */ @@ -559,32 +577,29 @@ module.exports.deviceListSynchronization = async function deviceListSynchronizat console.log('* ' + error); } - // // Calculate common elements and drop elements of ES-DL - // let commonEsElements = []; let dropEsElements = []; for (let i = 0; i < esDeviceList.length; i++) { let found = false; for (let j = 0; j < odlDeviceList.length; j++) { - if (esDeviceList[i]['node-id'] == odlDeviceList[j]['node-id']) { + if (esDeviceList[i]['node-id'] == odlDeviceList[j][NODE_ID]) { found = true; commonEsElements.push(esDeviceList[i]); break; } } if (!found) { - dropEsElements.push(esDeviceList[i]); + dropEsElements.push(esDeviceList[i]); } - } - // + } + // Calculate new elements of ODL-DL and print ODL-DL - // let newOdlElements = []; for (let i = 0; i < odlDeviceList.length; i++) { let found = false; for (let j = 0; j < esDeviceList.length; j++) { - if (odlDeviceList[i]['node-id'] == esDeviceList[j]['node-id']) { + if (odlDeviceList[i]['node-id'] == esDeviceList[j][NODE_ID]) { found = true; break; } @@ -593,14 +608,13 @@ module.exports.deviceListSynchronization = async function deviceListSynchronizat newOdlElements.push(odlDeviceList[i]); } } - // + // Drop all the sliding window elements not more present in new odl device list - // let elementsDroppedFromSlidingWindow = 0 for (let i = 0; i < slidingWindow.length;) { let found = false; for (let j = 0; j < odlDeviceList.length; j++) { - if (slidingWindow[i]['node-id'] == odlDeviceList[j]['node-id']) { + if (slidingWindow[i]['node-id'] == odlDeviceList[j][NODE_ID]) { found = true; break; } @@ -613,28 +627,21 @@ module.exports.deviceListSynchronization = async function deviceListSynchronizat } } - // // Shuffle new odl elements (commented issue 757) - // - //newOdlElements = shuffleArray(newOdlElements); + //newOdlElements = shuffleArray(newOdlElements); - // // If slidingWindow is empty - // if (slidingWindow.length == 0) { deviceList = [].concat(newOdlElements, commonEsElements); lastDeviceListIndex = -1; } else { - // // Get the last element of new sliding window - // let slidingWindowLastElement = slidingWindow[slidingWindow.length - 1]; - // + // Search the last element in commonEsElements to split commonEsElements - // let lastElementFound = false; for (let i = 0; i < commonEsElements.length; i++) { - if (slidingWindowLastElement['node-id'] == commonEsElements[i]['node-id']) { + if (slidingWindowLastElement['node-id'] == commonEsElements[i][NODE_ID]) { lastElementFound = true; lastDeviceListIndex = i; break; @@ -657,12 +664,10 @@ module.exports.deviceListSynchronization = async function deviceListSynchronizat } } - // // Write new ODL-DL to Elasticsearch - // let deviceListCleaned = []; for (let i = 0; i < deviceList.length; i++) { - deviceListCleaned.push({ "node-id": deviceList[i]["node-id"] }); + deviceListCleaned.push({ "node-id": deviceList[i][NODE_ID] }); } deviceList = deviceListCleaned; var deviceListStringiflied = JSON.stringify(deviceList); @@ -673,23 +678,22 @@ module.exports.deviceListSynchronization = async function deviceListSynchronizat console.log(error); } - // // Fill the sliding window at the max allowed and get new the elements - // let slidingWindowSize = (slidingWindowSizeDb > deviceList.length) ? deviceList.length : slidingWindowSizeDb; for (let i = slidingWindow.length; i < slidingWindowSize; i++) { addNextDeviceListElementInWindow(); requestMessage(slidingWindow.length - 1); - printLog('* Send request for new element: ' + slidingWindow[slidingWindow.length - 1]['node-id'], print_log_level >= 2); + printLog('* Send request for new element: ' + slidingWindow[slidingWindow.length - 1][NODE_ID], print_log_level >= 2); } - // + // Erase all the control constructs from elasticsearch referring elements not more present in new odl device list - // for (let i = 0; i < dropEsElements.length; i++) { - let cc_id = dropEsElements[i]['node-id']; + let cc_id = dropEsElements[i][NODE_ID]; try { - let ret = await individualServicesService.deleteRecordFromElasticsearch(7, '_doc', cc_id); + // Used a parameter instead a fixed value + let indexAlias = common[1].indexAlias; // Retrieve indexalias for ES + let ret = await individualServicesService.deleteRecordFromElasticsearch(indexAlias, '_doc', cc_id); printLog('* ' + ret.result, print_log_level >= 2); } catch (error) { console.log('* An error has occurred deleting ' + cc_id + ' from elasticsearch. Element does not exist.)', print_log_level >= 2); @@ -728,7 +732,6 @@ module.exports.startCyclicProcess = async function startCyclicProcess(logging_le procedureIsRunning = true; async function extractProfileConfiguration(uuid) { - const profileCollection = require('onf-core-model-ap/applicationPattern/onfModel/models/ProfileCollection'); let profile = await profileCollection.getProfileAsync(uuid); let objectKey = Object.keys(profile)[2]; profile = profile[objectKey]; @@ -778,16 +781,16 @@ module.exports.startCyclicProcess = async function startCyclicProcess(logging_le for (let i = 0; i < elasticsearchList.length; i++) { let found = false; for (let j = 0; j < odlDeviceList.length; j++) { - if (elasticsearchList[i]['node-id'] == odlDeviceList[j]['node-id']) { + if (elasticsearchList[i]['node-id'] == odlDeviceList[j][NODE_ID]) { found = true; commonEsElements.push(elasticsearchList[i]); - esString += (((i == 0) ? '' : '|') + elasticsearchList[i]['node-id']); + esString += (((i == 0) ? '' : '|') + elasticsearchList[i][NODE_ID]); break; } } if (!found) { dropEsElements.push(elasticsearchList[i]); - esString += (((i == 0) ? '' : '|') + elasticsearchList[i]['node-id']); + esString += (((i == 0) ? '' : '|') + elasticsearchList[i][NODE_ID]); } } esString += ('] (' + elasticsearchList.length + ')'); @@ -805,16 +808,16 @@ module.exports.startCyclicProcess = async function startCyclicProcess(logging_le for (let i = 0; i < odlDeviceList.length; i++) { let found = false; for (let j = 0; j < elasticsearchList.length; j++) { - if (odlDeviceList[i]['node-id'] == elasticsearchList[j]['node-id']) { + if (odlDeviceList[i]['node-id'] == elasticsearchList[j][NODE_ID]) { commonOdlElements.push(odlDeviceList[i]); - odlString += (((i == 0) ? '' : '|') + odlDeviceList[i]['node-id']); + odlString += (((i == 0) ? '' : '|') + odlDeviceList[i][NODE_ID]); found = true; break; } } if (!found) { newOdlElements.push(odlDeviceList[i]) - odlString += (((i == 0) ? '' : '|') + odlDeviceList[i]['node-id']); + odlString += (((i == 0) ? '' : '|') + odlDeviceList[i][NODE_ID]); } } odlString += ('] (' + odlDeviceList.length + ')'); @@ -823,22 +826,19 @@ module.exports.startCyclicProcess = async function startCyclicProcess(logging_le } catch (error) { console.log("Too many ODL elements to print in console.") } - // + // Shuffle the new elements (commented issue 757) - // //newOdlElements = shuffleArray(newOdlElements); - // // Calculate the new ODL-DL: [new odl elements shuffled] + [common es elements] - // let newString = 'Device List (Updated): ['; let newPiped = false; for (let i = 0; i < newOdlElements.length; i++) { - newString += (((i == 0) ? '' : '|') + newOdlElements[i]['node-id']); + newString += (((i == 0) ? '' : '|') + newOdlElements[i][NODE_ID]); newPiped = true; } for (let i = 0; i < commonEsElements.length; i++) { - newString += (((i == 0 && newPiped == false) ? '' : '|') + commonEsElements[i]['node-id']); + newString += (((i == 0 && newPiped == false) ? '' : '|') + commonEsElements[i][NODE_ID]); newPiped = true; } newString += ('] (' + odlDeviceList.length + ')'); @@ -847,13 +847,14 @@ module.exports.startCyclicProcess = async function startCyclicProcess(logging_le } catch (error) { console.log("Too many updated device list elements to print in console."); } - // + // Drop from ES all the elements not more present in ES-DL - // for (let i = 0; i < dropEsElements.length; i++) { - let cc_id = dropEsElements[i]['node-id']; + let cc_id = dropEsElements[i][NODE_ID]; try { - let ret = await individualServicesService.deleteRecordFromElasticsearch(7, '_doc', cc_id); + // Used a parameter instead a fixed value + let indexAlias = common[1].indexAlias; // Retrieve indexalias for ES + let ret = await individualServicesService.deleteRecordFromElasticsearch(indexAlias, '_doc', cc_id); printLog(ret.result, print_log_level >= 2); } catch (error) { console.log('* An error has occurred deleting ' + cc_id + ' from elasticsearch. Element does not exist.)', print_log_level >= 2); @@ -865,7 +866,7 @@ module.exports.startCyclicProcess = async function startCyclicProcess(logging_le let deviceListCleaned = []; for (let i = 0; i < odlDeviceList.length; i++) { - deviceListCleaned.push({ "node-id": odlDeviceList[i]["node-id"] }); + deviceListCleaned.push({ "node-id": odlDeviceList[i][NODE_ID] }); } deviceList = deviceListCleaned; let odlDeviceListString = JSON.stringify(deviceList); @@ -875,9 +876,7 @@ module.exports.startCyclicProcess = async function startCyclicProcess(logging_le console.log(error); } - // // Sliding Window - // let slidingWindowSize = (slidingWindowSizeDb > deviceList.length) ? deviceList.length : slidingWindowSizeDb; lastDeviceListIndex = -1; for (let i = 0; i < slidingWindowSize; i++) { @@ -886,17 +885,15 @@ module.exports.startCyclicProcess = async function startCyclicProcess(logging_le printLog(printList('Sliding Window', slidingWindow), print_log_level >= 1); for (let i = 0; i < slidingWindowSize; i++) { requestMessage(i); - printLog('Element ' + slidingWindow[i]['node-id'] + ' send request...', print_log_level >= 2); + printLog('Element ' + slidingWindow[i][NODE_ID] + ' send request...', print_log_level >= 2); } - // + // Periodic Synchronization - // const periodicSynchTime = deviceListSyncPeriod * 3600 * 1000; const { deviceListSynchronization } = module.exports; periodicSynchTimerId = setInterval(deviceListSynchronization, periodicSynchTime); - // + // TTL checking - // startTtlChecking(); return true; } @@ -919,6 +916,6 @@ module.exports.stopCyclicProcess = async function stopCyclicProcess() { clearInterval(ttlCheckingTimerId); } -module.exports.getDeviceListInMemory = async function getDeviceListInMemory(){ +module.exports.getDeviceListInMemory = async function getDeviceListInMemory() { return deviceList; } \ No newline at end of file diff --git a/server/service/individualServices/ElasticsearchPreparation.js b/server/service/individualServices/ElasticsearchPreparation.js index 3437b40b..71d68cf1 100644 --- a/server/service/individualServices/ElasticsearchPreparation.js +++ b/server/service/individualServices/ElasticsearchPreparation.js @@ -1,4 +1,5 @@ const { elasticsearchService, getIndexAliasAsync, operationalStateEnum } = require('onf-core-model-ap/applicationPattern/services/ElasticsearchService'); +const logger = require('../LoggingService.js').getLogger(); /** * @description Elasticsearch preparation. Checks if ES instance is configured properly. @@ -14,15 +15,15 @@ const { elasticsearchService, getIndexAliasAsync, operationalStateEnum } = requi * @returns {Promise} */ module.exports = async function prepareElasticsearch() { - console.log("Configuring Elasticsearch..."); + logger.info("Configuring Elasticsearch..."); let ping = await elasticsearchService.getElasticsearchClientOperationalStateAsync(); if (ping === operationalStateEnum.UNAVAILABLE) { - console.error(`Elasticsearch unavailable. Skipping Elasticsearch configuration.`); + logger.error(`Elasticsearch unavailable. Skipping Elasticsearch configuration.`); return; } await createIndexTemplate(); await elasticsearchService.createAlias(); - console.log('Elasticsearch is properly configured!'); + logger.info('Elasticsearch is properly configured!'); } /** @@ -74,7 +75,7 @@ async function createIndexTemplate() { "limit": "9000" } }, - "mapping.ignore_malformed": true + "mapping.ignore_malformed": true } }, mappings: { diff --git a/server/service/individualServices/IndividualServicesOperationsMapping.js b/server/service/individualServices/IndividualServicesOperationsMapping.js index 2b61dccc..30b4a82b 100644 --- a/server/service/individualServices/IndividualServicesOperationsMapping.js +++ b/server/service/individualServices/IndividualServicesOperationsMapping.js @@ -8,7 +8,7 @@ module.exports.individualServicesOperationsMapping = }, //mwdi actions - + "/v1/notify-device-alarms": { "/v1/notify-device-alarms": { "api-segment": "is", diff --git a/server/service/individualServices/PrepareForwardingConfiguration.js b/server/service/individualServices/PrepareForwardingConfiguration.js index cad6f41d..955fad19 100644 --- a/server/service/individualServices/PrepareForwardingConfiguration.js +++ b/server/service/individualServices/PrepareForwardingConfiguration.js @@ -56,7 +56,7 @@ exports.disregardApplication = function (operationClientConfigurationStatusList) forwardingConfigurationInputList.push( forwardingConfigurationInput ); - } + } } resolve(forwardingConfigurationInputList); } catch (error) { diff --git a/server/service/individualServices/SoftwareUpgrade.js b/server/service/individualServices/SoftwareUpgrade.js index b87b7e0a..0288f68c 100644 --- a/server/service/individualServices/SoftwareUpgrade.js +++ b/server/service/individualServices/SoftwareUpgrade.js @@ -14,6 +14,7 @@ const onfAttributeFormatter = require('onf-core-model-ap/applicationPattern/onfM const onfAttributes = require('onf-core-model-ap/applicationPattern/onfModel/constants/OnfAttributes'); const FcPort = require('onf-core-model-ap/applicationPattern/onfModel/models/FcPort'); const eventDispatcher = require('onf-core-model-ap/applicationPattern/rest/client/eventDispatcher'); +const logger = require('../LoggingService.js').getLogger(); const NOTIFY_APPROVALS_FD_NAME = 'PromptForBequeathingDataCausesRObeingRequestedToNotifyApprovalsOfNewApplicationsToNewRelease'; const NOTIFY_WITHDRAWN_APPROVALS_FD_NAME = 'PromptForBequeathingDataCausesRObeingRequestedToNotifyWithdrawnApprovalsToNewRelease'; @@ -43,6 +44,7 @@ exports.upgradeSoftwareVersion = async function (isdataTransferRequired, newRele await replaceOldReleaseWithNewRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney); resolve(); } catch (error) { + logger.error(error); reject(error); } }); @@ -68,6 +70,7 @@ async function redirectNotificationNewRelease(newReleaseUuid, user, xCorrelator, await PromptForBequeathingDataCausesRObeingRequestedToStopNotificationsToOldRelease(user, xCorrelator, traceIndicator, customerJourney); resolve(); } catch (error) { + logger.error(error); reject(error); } }); @@ -90,6 +93,7 @@ async function replaceOldReleaseWithNewRelease(newReleaseUuid, user, xCorrelator await promptForBequeathingDataCausesRequestForDeregisteringOfOldRelease(newReleaseUuid, user, xCorrelator, traceIndicator, customerJourney); resolve(); } catch (error) { + logger.error(error); reject(error); } }); @@ -136,7 +140,7 @@ async function PromptForBequeathingDataCausesTransferOfListOfApplications(user, } } catch (error) { - console.log(error); + logger.error(error); throw "operation is not success"; } } @@ -182,7 +186,7 @@ async function PromptForBequeathingDataCausesRObeingRequestedToNotifyApprovalsOf throw NOTIFY_APPROVALS_FD_NAME + "forwarding is not success for the input" + JSON.stringify(requestBody); } } catch (error) { - console.log(error); + logger.error(error); throw "operation is not success"; } @@ -227,7 +231,7 @@ async function PromptForBequeathingDataCausesRObeingRequestedToNotifyWithdrawnAp throw NOTIFY_WITHDRAWN_APPROVALS_FD_NAME + "forwarding is not success for the input" + JSON.stringify(requestBody); } } catch (error) { - console.log(error); + logger.error(error); throw "operation is not success"; } @@ -276,7 +280,7 @@ async function PromptForBequeathingDataCausesRObeingRequestedToStopNotifications } } catch (error) { - console.log(error); + logger.error(error); throw "operation is not success"; } @@ -324,12 +328,13 @@ async function promptForBequeathingDataCausesRequestForBroadcastingInfoAboutServ } } catch (error) { - console.log(error); + logger.error(error); throw "operation is not success"; } resolve(result); } catch (error) { + logger.error(error); reject(error); } }); @@ -369,12 +374,13 @@ async function promptForBequeathingDataCausesRequestForDeregisteringOfOldRelease } } } catch (error) { - console.log(error); + logger.error(error); throw "operation is not success"; } resolve(result); } catch (error) { + logger.error(error); reject(error); } }); @@ -434,6 +440,7 @@ function forwardRequest(forwardingKindName, attributeList, user, xCorrelator, tr ); resolve(result); } catch (error) { + logger.error(error); reject(error); } }); diff --git a/server/service/individualServices/alarmUpdater.js b/server/service/individualServices/alarmUpdater.js index 36e6e445..661b5cac 100644 --- a/server/service/individualServices/alarmUpdater.js +++ b/server/service/individualServices/alarmUpdater.js @@ -1,48 +1,100 @@ -const createHttpError = require("http-errors"); -exports.updateAlarmByTypeAndResource = function (json, alarmTypeId, resource, AlarmStatus, updatedAttributes) { +const logger = require('../LoggingService.js').getLogger(); + +// Constants Definition +const CURRENT_ALARM_ID = "current-alarm-identifier"; +const ALARMS_PAC = "alarms-1-0:alarm-pac"; +const CURRENT_ALARMS = "current-alarms"; +const ALARM_TYPE_ID = "alarm-type-id"; +const N_OF_CURRENT_ALARMS = "number-of-current-alarms"; + +exports.updateAlarmByTypeAndResource = function (json, alarmTypeId, resource, alarmStatus, updatedAttributes) { let resourceToUpdate = resource.replace(/core-model-1-4:network-control-domain=live\/control-construct=.+?\//g, 'core-model-1-4:control-construct/'); + resourceToUpdate = modifyResource(resourceToUpdate); let objectKey = Object.keys(json)[0]; - let alarms = json[objectKey]["alarms-1-0:alarm-pac"]["current-alarms"]["current-alarm-list"]; + + // Get the current alarms list + let alarms = json[objectKey][ALARMS_PAC][CURRENT_ALARMS]["current-alarm-list"]; + logger.info("Get List of current alarms, size is: " + alarms.length); + logger.debug(alarms); let found = false; + + // Iterate on the list for (let i = 0; i < alarms.length; i++) { let resourceToCompare = modifyResource(alarms[i]["resource"]); - if (alarms[i]["alarm-type-id"] === alarmTypeId && resourceToCompare === resourceToUpdate) { - if (AlarmStatus.indexOf("cleared") == -1 || AlarmStatus.indexOf("CLEARED") == -1) { + if (alarms[i][ALARM_TYPE_ID] === alarmTypeId && resourceToCompare === resourceToUpdate) { + if (!alarmStatus.toUpperCase().includes("CLEAR")) { + logger.info("Alarm id: " + alarmTypeId + " - on resource: " + resourceToUpdate + " - UPDATE"); for (let attr in updatedAttributes) { + if (attr == "resource") { + logger.debug("Skip Element: " + attr); + continue; + } alarms[i][attr] = updatedAttributes[attr]; } found = true; + break; // once is found, no needs to iterate.. } else { + logger.info("Alarm id: " + alarmTypeId + " - on resource: " + resourceToUpdate + " - CLEARED"); alarms.splice(i, 1); - alarms.forEach((item, index) => { - item["current-alarm-identifier"] = (index + 1).toString(); - }); + // No More used + // alarms.forEach((item, index) => { + // item[CURRENT_ALARM_ID] = (index + 1).toString(); + // }); let numberOfCurrentAlarms = alarms.length; - json[objectKey]["alarms-1-0:alarm-pac"]["current-alarms"]["number-of-current-alarms"] = numberOfCurrentAlarms; - //json["core-model-1-4:control-construct"][0]["alarms-1-0:alarm-pac"]["current-alarms"]["time-of-latest-change"] = newAlarm["timestamp"]; + json[objectKey][ALARMS_PAC][CURRENT_ALARMS][N_OF_CURRENT_ALARMS] = numberOfCurrentAlarms; + //json["core-model-1-4:control-construct"][0][ALARMS_PAC][CURRENT_ALARMS]["time-of-latest-change"] = newAlarm["timestamp"]; found = true; + break; // once is found, no needs to iterate.. } } } + if (!found) { - let maxIdentifier = Math.max(...alarms.map(alarm => parseInt(alarm["current-alarm-identifier"]))); - let newAlarm = { - "current-alarm-identifier": (maxIdentifier + 1).toString(), - "timestamp": updatedAttributes.timestamp, - "resource": updatedAttributes.resource, - "alarm-type-id": updatedAttributes["alarm-type-id"], - "alarm-type-qualifier": updatedAttributes["alarm-type-qualifier"], - "alarm-severity": "alarms-1-0:SEVERITY_TYPE_" + updatedAttributes["alarm-severity"].toUpperCase() - }; - alarms.push(newAlarm); - let numberOfCurrentAlarms = alarms.length; - json[objectKey]["alarms-1-0:alarm-pac"]["current-alarms"]["number-of-current-alarms"] = numberOfCurrentAlarms; - json[objectKey]["alarms-1-0:alarm-pac"]["current-alarms"]["time-of-latest-change"] = newAlarm["timestamp"]; + logger.debug("Alarm not found in the list"); + // No More used + // let maxIdentifier = Math.max(...alarms.map(alarm => parseInt(alarm[CURRENT_ALARM_ID]))); + // logger.debug("Alarm Max Identifier: " + maxIdentifier); + logger.info("Alarm id: " + alarmTypeId + " - on resource: " + resourceToUpdate + " - to be added"); + if (alarmStatus.toUpperCase().includes("CLEAR")) { + logger.warn("This is a CLEAR alarm type. Will not add to the list"); + } else { + logger.info("Add to the list - Alarm id: " + alarmTypeId); + let resourceBuild = rebuildResource(updatedAttributes.resource); + + let newAlarm = { + // "current-alarm-identifier": (maxIdentifier + 1).toString(), + "alarm-type-id": updatedAttributes[ALARM_TYPE_ID], + "alarm-type-qualifier": updatedAttributes["alarm-type-qualifier"], + "resource": resourceBuild, + "timestamp": updatedAttributes.timestamp, + "alarm-severity": updatedAttributes["alarm-severity"] + }; + + alarms.push(newAlarm); + let numberOfCurrentAlarms = alarms.length; + json[objectKey][ALARMS_PAC][CURRENT_ALARMS][N_OF_CURRENT_ALARMS] = numberOfCurrentAlarms; + json[objectKey][ALARMS_PAC][CURRENT_ALARMS]["time-of-latest-change"] = newAlarm["timestamp"]; + logger.debug("New Alarm added in the list"); + } + } else { + logger.debug("Alarm found in the list"); } } -function modifyResource (resource) { +function modifyResource(resource) { let outputString = resource.replace(/\[uuid='(.*?)'\]/g, '=$1').replace(/\[local-id='(.*?)'\]/g, '=$1'); return outputString; - } \ No newline at end of file +} + +function rebuildResource(resource) { + let step1 = resource.replace(/core-model-1-4:network-control-domain=live\/control-construct=.+?\//g, 'core-model-1-4:control-construct/'); + let regex = /logical-termination-point=([A-Za-z0-9]+(-[A-Za-z0-9]+)+)/i; // regex for logical termination point + let step2 = step1.replace(regex, "logical-termination-point[uuid='" + '$1' + "']"); + let regex2 = /layer-protocol=([A-Za-z0-9]+(-[A-Za-z0-9]+)+)/i; // regex for layer-protocol + let step3 = step2.replace(regex2, "layer-protocol[local-id='" + '$1' + "']"); + let regex3 = /equipment=([A-Za-z0-9]+(-[A-Za-z0-9]+)+)/i // regex for equipment + let step4 = step3.replace(regex3, "equipment[uuid='" + '$1' + "']"); + + return step4; +} \ No newline at end of file diff --git a/server/service/individualServices/cacheResponseBuilder.js b/server/service/individualServices/cacheResponseBuilder.js index d0eb9ec5..f300670d 100644 --- a/server/service/individualServices/cacheResponseBuilder.js +++ b/server/service/individualServices/cacheResponseBuilder.js @@ -1,156 +1,162 @@ +const net = require('net'); const createHttpError = require('http-errors'); +const logger = require('../LoggingService.js').getLogger(); + +const CONTROLCONST = "control-construct"; +const LOCALID = 'local-id'; exports.cacheResponseBuilder = async function (url, currentJSON) { - let objectKey = Object.keys(currentJSON)[0]; - currentJSON = currentJSON[objectKey]; - const parts = objectKey.split(':'); - let lastkey = null; - let lastUrlSegment = ""; - let penultimateUrlSegment = ""; - const urlSegments = url.split('/').filter(segment => segment.trim() !== ''); - let startParsing = false; - let i = urlSegments.length; - for (const segment of urlSegments) { - if (!startParsing) { - // Search second simbol "=" to start extraction - if (segment.includes('=')) { - startParsing = true; - } - i--; - continue; - } - //lastValue = key; - const [key, value] = segment.split('='); + let objectKey = Object.keys(currentJSON)[0]; + currentJSON = currentJSON[objectKey]; + const parts = objectKey.split(':'); + let lastkey = null; + let lastUrlSegment = ""; + let penultimateUrlSegment = ""; + const urlSegments = url.split('/').filter(segment => segment.trim() !== ''); + let startParsing = false; + let i = urlSegments.length; + for (const segment of urlSegments) { + if (!startParsing) { + // Search second simbol "=" to start extraction + if (segment.includes('=')) { + startParsing = true; + } + i--; + continue; + } + //lastValue = key; + const [key, value] = segment.split('='); - // Verify if the field exists in the current JSON - if (currentJSON.hasOwnProperty(key)) { - currentJSON = currentJSON[key]; - lastValue = key; - if (Array.isArray(currentJSON)) { - // If the field is an Array search for the field with the correct UUID or Local-id - const uuidDaCercare = decodeURIComponent(value); - const equipmentCercato = currentJSON.find(key => - (key.uuid && key.uuid === uuidDaCercare) || - (key['local-id'] && key['local-id'] === uuidDaCercare)); - if (equipmentCercato) { - if (i != 1) { - currentJSON = equipmentCercato; - } else { - currentJSON = [equipmentCercato]; - } - } else { - // console.log(`No elements found with UUID: ${uuidDaCercare}`); - throw new createHttpError(404, `No elements found with UUID: ${uuidDaCercare}`); - return - break; - } - } + // Verify if the field exists in the current JSON + if (currentJSON.hasOwnProperty(key)) { + currentJSON = currentJSON[key]; + lastValue = key; + if (Array.isArray(currentJSON)) { + // If the field is an Array search for the field with the correct UUID or Local-id + const uuidToFind = decodeURIComponent(value); + const equipmentFound = currentJSON.find(key => + (key.uuid && key.uuid === uuidToFind) || + (key[LOCALID] && key[LOCALID] === uuidToFind)); + if (equipmentFound) { + if (i != 1) { + logger.trace("equipmentFound from Object"); + currentJSON = equipmentFound; + } else { + logger.trace("equipmentFound from Array"); + currentJSON = [equipmentFound]; + } } else { - lastValue = key; - if (key != "control-construct"){ - throw new createHttpError(404, `Field not found: ${key}`); - } + logger.trace(`No elements found with UUID: ${uuidToFind}`); + throw new createHttpError(404, `No elements found with UUID: ${uuidToFind}`); } - lastkey = key; - i--; + } + } else { + lastValue = key; + if (key != CONTROLCONST) { + logger.error("Field not found: " + key); + throw new createHttpError(404, `Field not found: ${key}`); + } } - let topJsonWrapper = ""; - let size = urlSegments.length; - lastUrlSegment = urlSegments[size - 1]; - penultimateUrlSegment = urlSegments[size - 2]; - let targetPartIndex = -1; - for (let i = urlSegments.length - 1; i >= 0; i--) { - if (urlSegments[i].includes(':')) { - targetPartIndex = i; - break; - } + lastkey = key; + i--; + } + + let topJsonWrapper = ""; + let size = urlSegments.length; + lastUrlSegment = urlSegments[size - 1]; + penultimateUrlSegment = urlSegments[size - 2]; + let targetPartIndex = -1; + for (let i = urlSegments.length - 1; i >= 0; i--) { + if (urlSegments[i].includes(':')) { + targetPartIndex = i; + break; } - let prefix = ""; - if (targetPartIndex == -1) { - prefix = parts[0]; + } + let prefix = ""; + if (targetPartIndex == -1) { + prefix = parts[0]; + } else { + let fullPrefix = urlSegments[targetPartIndex].split(':'); + prefix = fullPrefix[0]; + } + + if (isIPAddress(prefix) || prefix == "localhost") { + prefix = parts[0]; + if (lastUrlSegment.indexOf("=") != -1) { + let parts2 = lastUrlSegment.split("="); + topJsonWrapper = prefix + ":" + parts2[0]; + if (lastUrlSegment.indexOf(CONTROLCONST) != -1) { + returnObject = { [topJsonWrapper]: [currentJSON] }; + } else { + returnObject = { [topJsonWrapper]: [currentJSON[0]] }; + } } else { - let fullPrefix = urlSegments[targetPartIndex].split(':'); - prefix = fullPrefix[0]; - } - if (isIPAddress(prefix) || prefix == "localhost") { - prefix = parts[0]; - if (lastUrlSegment.indexOf("=") != -1) { - let parts2 = lastUrlSegment.split("="); - topJsonWrapper = prefix + ":" + parts2[0]; - if (lastUrlSegment.indexOf("control-construct") != -1) { - returnObject = { [topJsonWrapper]: [currentJSON] }; - } else { - returnObject = { [topJsonWrapper]: [currentJSON[0]] }; - } - } else { - topJsonWrapper = prefix + ":" + lastUrlSegment; - if (lastUrlSegment.indexOf("control-construct") != -1) { - returnObject = { [topJsonWrapper]: [currentJSON] }; - } else { - returnObject = { [topJsonWrapper]: currentJSON }; - } - } - } else if (lastUrlSegment.indexOf("=") != -1) { - let parts2 = lastUrlSegment.split("="); - topJsonWrapper = prefix + ":" + parts2[0]; - if (lastUrlSegment.indexOf("control-construct") != -1) { - returnObject = { [topJsonWrapper]: [currentJSON] }; - } else { - returnObject = { [topJsonWrapper]: [currentJSON[0]] }; - } - } else if (lastUrlSegment.indexOf(":") != -1) { - let parts2 = lastUrlSegment.split(":"); - topJsonWrapper = prefix + ":" + parts2[1]; + topJsonWrapper = prefix + ":" + lastUrlSegment; + if (lastUrlSegment.indexOf(CONTROLCONST) != -1) { + returnObject = { [topJsonWrapper]: [currentJSON] }; + } else { returnObject = { [topJsonWrapper]: currentJSON }; + } + } + } else if (lastUrlSegment.indexOf("=") != -1) { + let parts2 = lastUrlSegment.split("="); + topJsonWrapper = prefix + ":" + parts2[0]; + if (lastUrlSegment.indexOf(CONTROLCONST) != -1) { + returnObject = { [topJsonWrapper]: [currentJSON] }; } else { - topJsonWrapper = prefix + ":" + lastUrlSegment; - returnObject = { [topJsonWrapper]: currentJSON }; + returnObject = { [topJsonWrapper]: [currentJSON[0]] }; } - /* - if (penultimateUrlSegment.indexOf(":") != -1 && lastUrlSegment.indexOf("control-construct") == -1) { - const parts1 = penultimateUrlSegment.split(':'); - if (lastUrlSegment.indexOf("+") != -1){ - const parts = lastUrlSegment.split('='); - lastUrlSegment = parts[0]; - } - topJsonWrapper = parts1[0] + ":" + lastUrlSegment; - returnObject = { [topJsonWrapper]: currentJSON }; - } else if (lastUrlSegment.indexOf(":") != -1){ - if (lastUrlSegment.indexOf("+") != -1){ - const parts = lastUrlSegment.split('+'); - lastUrlSegment = parts[1]; - } - topJsonWrapper = lastUrlSegment; - returnObject = { [topJsonWrapper]: currentJSON }; - } else if (lastUrlSegment.indexOf("=") != -1) { - let parts2 = lastUrlSegment.split("="); - topJsonWrapper = parts[0] + ":" + parts2[0]; - if (lastUrlSegment.indexOf("control-construct") != -1){ - returnObject = { [topJsonWrapper]: [currentJSON] }; - } else { - returnObject = { [topJsonWrapper]: [currentJSON[0]] }; - } - } else { - if (isIPAddress(prefix) || prefix == "localhost"){ - prefix = parts[0]; - } - topJsonWrapper = prefix + ":" + lastUrlSegment; - returnObject = { [topJsonWrapper]: currentJSON }; - } - */ - return returnObject; + } else if (lastUrlSegment.indexOf(":") != -1) { + let parts2 = lastUrlSegment.split(":"); + topJsonWrapper = prefix + ":" + parts2[1]; + returnObject = { [topJsonWrapper]: currentJSON }; + } else { + topJsonWrapper = prefix + ":" + lastUrlSegment; + returnObject = { [topJsonWrapper]: currentJSON }; + } + /* + if (penultimateUrlSegment.indexOf(":") != -1 && lastUrlSegment.indexOf("control-construct") == -1) { + const parts1 = penultimateUrlSegment.split(':'); + if (lastUrlSegment.indexOf("+") != -1){ + const parts = lastUrlSegment.split('='); + lastUrlSegment = parts[0]; + } + topJsonWrapper = parts1[0] + ":" + lastUrlSegment; + returnObject = { [topJsonWrapper]: currentJSON }; + } else if (lastUrlSegment.indexOf(":") != -1){ + if (lastUrlSegment.indexOf("+") != -1){ + const parts = lastUrlSegment.split('+'); + lastUrlSegment = parts[1]; + } + topJsonWrapper = lastUrlSegment; + returnObject = { [topJsonWrapper]: currentJSON }; + } else if (lastUrlSegment.indexOf("=") != -1) { + let parts2 = lastUrlSegment.split("="); + topJsonWrapper = parts[0] + ":" + parts2[0]; + if (lastUrlSegment.indexOf("control-construct") != -1){ + returnObject = { [topJsonWrapper]: [currentJSON] }; + } else { + returnObject = { [topJsonWrapper]: [currentJSON[0]] }; + } + } else { + if (isIPAddress(prefix) || prefix == "localhost"){ + prefix = parts[0]; + } + topJsonWrapper = prefix + ":" + lastUrlSegment; + returnObject = { [topJsonWrapper]: currentJSON }; + } + */ + return returnObject; } function notFoundError(message) { - const myJson = { - "code": 404, - "message": message - }; - return myJson; + const myJson = { + "code": 404, + "message": message + }; + return myJson; } -const net = require('net'); - function isIPAddress(input) { - return net.isIP(input) !== 0; // Return 0 if the string is not a valid IP address + return net.isIP(input) !== 0; // Return 0 if the string is not a valid IP address } \ No newline at end of file diff --git a/server/service/individualServices/cacheUpdateBuilder.js b/server/service/individualServices/cacheUpdateBuilder.js index 02be6b56..782ade61 100644 --- a/server/service/individualServices/cacheUpdateBuilder.js +++ b/server/service/individualServices/cacheUpdateBuilder.js @@ -1,8 +1,11 @@ const createHttpError = require("http-errors"); +const logger = require('../LoggingService.js').getLogger(); -exports.cacheUpdateBuilder = function (url, originalJSON, toInsert, filters) { +exports.cacheUpdateBuilder = function (url, originalJSON, toInsert, hasFilter) { const urlParts = url.split("?fields="); const myFields = urlParts[1]; + // let hasFilter = filters ? filters : (myFields != "" && myFields != undefined); + // Analyze URL to extract segments const urlSegments = urlParts[0].split('/').filter(segment => segment.trim() !== ''); @@ -21,38 +24,37 @@ exports.cacheUpdateBuilder = function (url, originalJSON, toInsert, filters) { continue; } - const [key, value] = segment.split('='); // Verify if the property exists in the current JSON if (currentJSON.hasOwnProperty(key)) { if (Array.isArray(currentJSON[key])) { // If the field is an array try to find the elemnt with the corrispondent UUID - const uuidDaCercare = decodeURIComponent(value); - const indexDaSostituire = currentJSON[key].findIndex(item => - (item.uuid && item.uuid === uuidDaCercare) || - (item['local-id'] && item['local-id'] === uuidDaCercare) + const uuidToFind = decodeURIComponent(value); + const indexToChange = currentJSON[key].findIndex(item => + (item.uuid && item.uuid === uuidToFind) || + (item['local-id'] && item['local-id'] === uuidToFind) ); - if (indexDaSostituire !== -1) { + if (indexToChange !== -1) { // Substitute only the element into the array with the new JSON if (currentJSON[key]) { if (i == 1) { - lastKey = "[" + objectKey + "]" + "." + key + "[" + indexDaSostituire + "]"; + lastKey = "[" + objectKey + "]" + "." + key + "[" + indexToChange + "]"; } else { - lastKey = lastKey + "." + key + "[" + indexDaSostituire + "]"; + lastKey = lastKey + "." + key + "[" + indexToChange + "]"; } - currentJSON = currentJSON[key][indexDaSostituire]; + currentJSON = currentJSON[key][indexToChange]; } else { - console.warn(`Field "${key}" not found in cache`); + logger.warn(`Field "${key}" not found in cache`); break; } - // console.log('JSON originale aggiornato:'); - // console.log(JSON.stringify(originalJSON, null, 2)); + // logger.trace('original JSON updated:'); + // logger.trace(JSON.stringify(originalJSON, null, 2)); } else { lastKey = lastKey + "." + key; //throw new createHttpError.NotFound(`Field "${key}"="${value}" not found in cache`); - console.warn(`No elements found with UUID: ${uuidDaCercare}`); + logger.warn(`No elements found with UUID: ${uuidToFind}`); break; } } else { @@ -65,128 +67,135 @@ exports.cacheUpdateBuilder = function (url, originalJSON, toInsert, filters) { currentJSON = currentJSON[key]; } } else { - // console.log(`Campo non trovato: ${key}`); + // logger.trace(`Field not found: ${key}`); break; } i += 1; } + if (lastKey == null) { lastKey = "[" + objectKey + "]"; } - // Verify if exists a last key and substitute it with the new JSON - if (lastKey) { - //console.log(originalJSON[lastKey]) - assignValueToJson(originalJSON, lastKey, toInsert, myFields); + // Verify if exists a last key and substitute it with the new JSON + if (lastKey) { // I think now is unuseful + // logger.trace(originalJSON[lastKey]) + assignValueToJson(originalJSON, lastKey, toInsert, hasFilter); } }; -function assignValueToJson(json, percorso, nuovoJSON, filters) { +// What does this function does? +function assignValueToJson(json, path, newJSON, hasFilters) { - const chiavi = percorso.split('.'); + const pathKeys = path.split('.'); - let oggetto = json; - let Filters = false; - if (filters != "" && filters != undefined) { - Filters = true; - } - let nomeArray = ""; - for (let i = 0; i < chiavi.length; i++) { - if (i == 0) { - const chiave = chiavi[i]; - const parentesiQuadraApertaIndex = chiave.indexOf('['); - const parentesiQuadraChiusaIndex = chiave.indexOf(']'); - const nomeArray = chiave.substring(1, parentesiQuadraChiusaIndex); - if (nomeArray.indexOf("control-construct") != -1) { - oggetto = oggetto[nomeArray]; + let objJSON = json; + // Unused code + // let Filters = false; + // if (filters != "" && filters != undefined) { + // Filters = true; + // } + let arrayName = ""; + for (let i = 0; i < pathKeys.length; i++) { + if (i == 0) { // Only for the first item of the loop + const keyToUse = pathKeys[i]; + const squareBracketOpenIdx = keyToUse.indexOf('['); + const squareBracketCloseIdx = keyToUse.indexOf(']'); + arrayName = keyToUse.substring(1, squareBracketCloseIdx); + if (arrayName.indexOf("control-construct") != -1) { + objJSON = objJSON[arrayName]; } else { - let objectKey = Object.keys(oggetto)[0]; - oggetto = oggetto[objectKey]; - let objectKey1 = Object.keys(oggetto)[0]; - oggetto = oggetto[nomeArray]; - // oggetto = oggetto[nomeArray]; + let objectKey = Object.keys(objJSON)[0]; + objJSON = objJSON[objectKey]; + // let objectKey1 = Object.keys(objJSON)[0]; // no more used + objJSON = objJSON[arrayName]; } // If the key doesn't contain square brackets get the object value - if (i === chiavi.length - 1) { + if (i === pathKeys.length - 1) { // If this is the last key in the path, assign the new value - if (Filters) { - let objectKey = Object.keys(nuovoJSON)[0]; - let newJSON = nuovoJSON[objectKey]; - let result = mergeJson(oggetto, newJSON) + if (hasFilters) { + let objectKey = Object.keys(newJSON)[0]; + let result = mergeJson(objJSON, newJSON[objectKey]); } else { - if (nuovoJSON === null) { - oggetto[nomeArray].splice(indice, 1); + if (newJSON === null) { + objJSON[arrayName].splice(indice, 1); // indice doesn't exists } else { - let objectKey = Object.keys(nuovoJSON)[0]; - let newJSON = nuovoJSON[objectKey]; - // oggetto[nomeArray] = newJSON; - oggetto = newJSON; + let objectKey = Object.keys(newJSON)[0]; + objJSON = newJSON[objectKey]; } } } - } else { - const chiave = chiavi[i]; - const parentesiQuadraApertaIndex = chiave.indexOf('['); - const parentesiQuadraChiusaIndex = chiave.indexOf(']'); + } else { // From the second element of iteration + const keyToUse = pathKeys[i]; + const squareBracketOpenIdx = keyToUse.indexOf('['); + const squareBracketCloseIdx = keyToUse.indexOf(']'); - if (parentesiQuadraApertaIndex !== -1 && parentesiQuadraChiusaIndex !== -1) { - nomeArray = chiave.substring(0, parentesiQuadraApertaIndex); - const indice = parseInt(chiave.substring(parentesiQuadraApertaIndex + 1, parentesiQuadraChiusaIndex), 10); + // This happen when is an array + if (squareBracketOpenIdx !== -1 && squareBracketCloseIdx !== -1) { + arrayName = keyToUse.substring(0, squareBracketOpenIdx); + const index = parseInt(keyToUse.substring(squareBracketOpenIdx + 1, squareBracketCloseIdx), 10); - if (i === chiavi.length - 1) { + if (i === pathKeys.length - 1) { // If this is the last key in the path, assign the new value - if (Filters) { - let objectKey = Object.keys(nuovoJSON)[0]; - let newJSON = nuovoJSON[objectKey]; - let result = mergeJson(oggetto[nomeArray][indice], newJSON) + if (hasFilters) { + let objectKey = Object.keys(newJSON)[0]; + let result = mergeJson(objJSON[arrayName][index], newJSON[objectKey]); } else { - if (nuovoJSON === null) { - oggetto[nomeArray].splice(indice, 1); - //delete oggetto[nomeArray][indice]; + if (newJSON === null) { + objJSON[arrayName].splice(index, 1); + //delete objJSON[arrayName][index]; } else { - let objectKey = Object.keys(nuovoJSON)[0]; - let newJSON = nuovoJSON[objectKey][0]; - oggetto[nomeArray][indice] = newJSON; + let objectKey = Object.keys(newJSON)[0]; + objJSON[arrayName][index] = newJSON[objectKey]; } } - } else { + } else { // Otherwise go on parsing the object - oggetto = oggetto[nomeArray][indice]; + objJSON = objJSON[arrayName][index]; } - } else { + } else { // This is a scalar/object value // If the key doesn't contain square brackets get the objet value - if (i === chiavi.length - 1) { - // Se questa è l'ultima chiave nel percorso, assegna il nuovo valore - if (Filters) { - let objectKey = Object.keys(nuovoJSON)[0]; - let newJSON = nuovoJSON[objectKey]; - let result = mergeJson(oggetto[nomeArray], newJSON) + if (i === pathKeys.length - 1) { + if (pathKeys.length == 2) { + arrayName = keyToUse; + } + // If is the last key on the path, then assign the value + if (hasFilters) { + let objectKey = Object.keys(newJSON)[0]; + let result = mergeJson(objJSON[keyToUse], newJSON[objectKey]); } else { - if (nuovoJSON != null) { - let objectKey = Object.keys(nuovoJSON)[0]; - let newJSON = nuovoJSON[objectKey][0]; - oggetto[nomeArray][indice] = newJSON; + if (newJSON != null) { + let objectKey = Object.keys(newJSON)[0]; + // if is latest + if (i == pathKeys.length -1 && + objectKey.includes(":") && arrayName.includes("-pac") + ) { + logger.debug("This is PAC configuration"); + let keyLast = objectKey.split(":"); + objJSON[keyLast[1]] = newJSON[objectKey]; + } else { + logger.debug("This doesn't have pac configuration"); + objJSON[arrayName] = newJSON[objectKey]; + } } } } else { // Otherwise go on parsing the object - oggetto = oggetto[chiave]; - nomeArray = chiave; + objJSON = objJSON[keyToUse]; + arrayName = keyToUse; } } } } /* if (Filters) { - let objectKey = Object.keys(nuovoJSON)[0]; - let newJSON = nuovoJSON[objectKey]; - let result = mergeJson(oggetto, newJSON) + let objectKey = Object.keys(newJSON)[0]; + let result = mergeJson(objJSON, newJSON[objectKey]); } else { - if (nuovoJSON !== null) { - let objectKey = Object.keys(nuovoJSON)[0]; - let newJSON = nuovoJSON[objectKey] - Object.assign(oggetto ,newJSON); + if (newJSON !== null) { + let objectKey = Object.keys(newJSON)[0]; + Object.assign(objJSON ,newJSON[objectKey]); } } */ @@ -196,16 +205,16 @@ function mergeJson(target, source) { if (Array.isArray(source)) { for (let i = 0; i < source.length; i++) { if (Array.isArray(target)) { - mergeJson(target[i], source[i]); + mergeJson(target[i], source[i]); // Recursive function } else { - mergeJson(target, source[i]); + mergeJson(target, source[i]); // Recursive function } } } else if (typeof source === 'object') { for (const key in source) { if (typeof source[key] === 'object') { if (target[key] && typeof target[key] === 'object') { - mergeJson(target[key], source[key]); + mergeJson(target[key], source[key]); // Recursive function } } else { const sourceValue = source[key]; @@ -215,4 +224,4 @@ function mergeJson(target, source) { } } } -} +} \ No newline at end of file diff --git a/server/service/individualServices/rest/client/Client.js b/server/service/individualServices/rest/client/Client.js index 01005005..bf6e881e 100644 --- a/server/service/individualServices/rest/client/Client.js +++ b/server/service/individualServices/rest/client/Client.js @@ -2,6 +2,7 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0'; const axios = require('axios'); const https = require('https'); +const logger = require('../../../LoggingService.js').getLogger(); /** * This function initiates a post method for the provided request object * @param {object} request : http request object @@ -17,11 +18,11 @@ exports.post = async function (options) { const header = { headers: { Authorization: options.headers.Authorization}}; //const Agent = {httpsAgent: agent}; try { - - let response = await axios( url,header); + let response = await axios(url, header); resolve(response); - //console.log(JSON.stringify(response.data)); + // logger.trace(JSON.stringify(response.data)); } catch (error) { + logger.error(error, "Post error"); reject(error); } }); diff --git a/server/service/individualServices/rest/client/dispacher.js b/server/service/individualServices/rest/client/dispacher.js index 122fa6ba..b7b2a87d 100644 --- a/server/service/individualServices/rest/client/dispacher.js +++ b/server/service/individualServices/rest/client/dispacher.js @@ -1,7 +1,7 @@ // @ts-check /** - * @file This module provides funtionality to trigger and dispatch rest request from this application to other applications + * @file This module provides funtionality to trigger and dispatch rest request from this application to other applications * This class consolidates the technology specific extensions. **/ @@ -9,6 +9,7 @@ const RequestHeader = require('./requestHeader'); const RestRequestBuilder = require('./requestBuilder'); +const logger = require('../../../LoggingService.js').getLogger(); /** * This funtion formulates the request body based on the operation name and application @@ -18,15 +19,14 @@ exports.dispatchEvent = function (url, method, httpRequestBody, Authorization) { return new Promise(async function (resolve, reject) { let result = false; try { - let httpRequestHeader = new RequestHeader( Authorization - - ); + ); + let response = await RestRequestBuilder.BuildAndTriggerRestRequest( //decodeURIComponent(url), url, - httpRequestHeader, + httpRequestHeader, httpRequestBody ); // let responseCode = response.status; @@ -42,4 +42,4 @@ exports.dispatchEvent = function (url, method, httpRequestBody, Authorization) { resolve(false); } }); -} \ No newline at end of file +} diff --git a/server/service/individualServices/rest/client/requestBuilder.js b/server/service/individualServices/rest/client/requestBuilder.js index eda0722c..26536e8a 100644 --- a/server/service/individualServices/rest/client/requestBuilder.js +++ b/server/service/individualServices/rest/client/requestBuilder.js @@ -5,6 +5,7 @@ **/ const restClient = require('./Client'); const createHttpError = require('http-errors'); +const logger = require('../../../LoggingService.js').getLogger(); /** * This function trigger a rest request by calling the restClient class
@@ -13,25 +14,27 @@ const createHttpError = require('http-errors'); * @returns {Promise} returns the http response received */ exports.BuildAndTriggerRestRequest = async function (url, requestHeader, requestBody) { - try { - - let request = { - url: url, - headers: requestHeader - // data: requestBody - } - let response = await restClient.post(request); - console.log("\n callback : " + url + " header :" + JSON.stringify(requestHeader) + - "body :" + JSON.stringify(requestBody) + "response code:" + response.status) - return response; - } catch (error) { - if (error.response) { - return error.response; - } else if (error.request) { - console.log(`Request errored with ${error}`); - return new createHttpError.RequestTimeout(); - } - console.log(`Unknown request error: ${error}`); - return new createHttpError.InternalServerError(); + try { + + let request = { + url: url, + headers: requestHeader + // data: requestBody + } + let response = await restClient.post(request); + + logger.debug("callback : " + url + " header :" + JSON.stringify(requestHeader) + + "body :" + JSON.stringify(requestBody) + "response code:" + response.status) + return response; + } catch (error) { + logger.error("POST fail!"); + if (error.response) { + return error.response; + } else if (error.request) { + logger.error(`Request errored with ${error}`); + return new createHttpError.RequestTimeout(); } + logger.error(`Unknown request error: ${error}`); + return new createHttpError.InternalServerError(); + } } \ No newline at end of file diff --git a/server/service/individualServices/rest/client/requestHeader.js b/server/service/individualServices/rest/client/requestHeader.js index 14a65d05..41056470 100644 --- a/server/service/individualServices/rest/client/requestHeader.js +++ b/server/service/individualServices/rest/client/requestHeader.js @@ -19,7 +19,6 @@ class RequestHeader { * @param {String} operationKey operation key to access the service in the client application. */ constructor(Authorization) { - if (Authorization != undefined && Authorization.length > 0) { this.Authorization = Authorization; } diff --git a/server/temporarySupportFiles/StartModule.js b/server/temporarySupportFiles/StartModule.js index cf10fb90..87491339 100644 --- a/server/temporarySupportFiles/StartModule.js +++ b/server/temporarySupportFiles/StartModule.js @@ -1,116 +1,113 @@ -// Start cyclic process -const cyclicProcessServicePath = '../service/individualServices/CyclicProcessService'; -const temporarySupportFilesPath = './temporarySupportFiles'; const fs = require('fs'); const path = require("path"); + +// Start cyclic process +const cyclicProcessServicePath = '../service/individualServices/CyclicProcessService'; +const temporarySupportFilesPath = './temporarySupportFiles'; + const cp = require(cyclicProcessServicePath + '/cyclicProcess'); const SINGLE_DEVICE_LIST = false; let devicelistSimulationIndex = 6; // - // Get the device list from a json file at the moment (simulation) - // - module.exports.getNewDeviceListExp = async function getNewDeviceListExp() { - try { - await new Promise((resolve, reject) => { - setTimeout(() => { - //simula richiesta deviceList - resolve(); - }, 1000); - }) - let fileName = '' - if (SINGLE_DEVICE_LIST) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal.Json"); - } else { - /* - if (devicelistSimulationIndex == 0) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal.Json"); - } else if (devicelistSimulationIndex == 1) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal1.Json"); - } else if (devicelistSimulationIndex == 2) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal2.Json"); - } else if (devicelistSimulationIndex == 3) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal3.Json"); - } else if (devicelistSimulationIndex == 4) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal4.Json"); - } else if (devicelistSimulationIndex == 5) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal5.Json"); - } - */ - fileName = path.resolve(__dirname, "TestLabDeviceMinimal" + devicelistSimulationIndex + ".Json"); - devicelistSimulationIndex = (devicelistSimulationIndex == 13) ? 6 : (devicelistSimulationIndex + 1); - } - let deviceList = JSON.parse(fs.readFileSync(fileName, 'utf8'))["network-topology:network-topology"].topology[0].node; - return deviceList; - - } catch (error) { - console.log("Error in getNewDeviceList(): " + error); - debugger; - } +// Get the device list from a json file at the moment (simulation) +// +module.exports.getNewDeviceListExp = async function getNewDeviceListExp() { + try { + await new Promise((resolve, reject) => { + setTimeout(() => { + //simulatation of devicelist request + resolve(); + }, 1000); + }) + let fileName = '' + if (SINGLE_DEVICE_LIST) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal.Json"); + } else { + /* + if (devicelistSimulationIndex == 0) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal.Json"); + } else if (devicelistSimulationIndex == 1) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal1.Json"); + } else if (devicelistSimulationIndex == 2) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal2.Json"); + } else if (devicelistSimulationIndex == 3) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal3.Json"); + } else if (devicelistSimulationIndex == 4) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal4.Json"); + } else if (devicelistSimulationIndex == 5) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal5.Json"); + } + */ + fileName = path.resolve(__dirname, "TestLabDeviceMinimal" + devicelistSimulationIndex + ".Json"); + devicelistSimulationIndex = (devicelistSimulationIndex == 13) ? 6 : (devicelistSimulationIndex + 1); } + let deviceList = JSON.parse(fs.readFileSync(fileName, 'utf8'))["network-topology:network-topology"].topology[0].node; + return deviceList; + + } catch (error) { + console.log("Error in getNewDeviceList(): " + error); + } +} module.exports.start = async function start() { - // - // Returns the deviceList with all equipments connected - // - function filterConnectedDevices(deviceList){ - try { - return deviceList.filter(device =>{ - return device['netconf-node-topology:connection-status'] === 'connected'; - }) - } catch(error) { - } - } + // Returns the deviceList with all equipments connected + function filterConnectedDevices(deviceList) { + try { + return deviceList.filter(device => { + return device['netconf-node-topology:connection-status'] === 'connected'; + }) + } catch (error) { - // - // Get the device list from a json file at the moment (simulation) - // - async function getNewDeviceList() { - try { - await new Promise((resolve, reject) => { - setTimeout(() => { - //simula richiesta deviceList - resolve(); - }, 1000); - }) - let fileName = '' - if (SINGLE_DEVICE_LIST) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal.Json"); - } else { - if (devicelistSimulationIndex == 0) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal1.Json"); // [A|B|C|D|E|F|G|H|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z] - } else if (devicelistSimulationIndex == 1) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal2.Json"); // [L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z] - } else if (devicelistSimulationIndex == 2) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal3.Json"); // [S|T|U|V|W|X|Y|Z] - } else if (devicelistSimulationIndex == 3) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal4.Json"); // [A|B|C|D|E] - } else if (devicelistSimulationIndex == 4) { - fileName = path.resolve(__dirname, "TestLabDeviceMinimal5.Json"); // [] - } - devicelistSimulationIndex = (devicelistSimulationIndex == 4) ? 0 : (devicelistSimulationIndex + 1); - } - let deviceList = JSON.parse(fs.readFileSync(fileName, 'utf8'))["network-topology:network-topology"].topology[0].node; - deviceList = filterConnectedDevices(deviceList); - return deviceList; + } + } - } catch (error) { - console.log("Error in getNewDeviceList(): " + error); - debugger; + // Get the device list from a json file at the moment (simulation) + async function getNewDeviceList() { + try { + await new Promise((resolve, reject) => { + setTimeout(() => { + //simula richiesta deviceList + resolve(); + }, 1000); + }) + let fileName = '' + if (SINGLE_DEVICE_LIST) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal.Json"); + } else { + if (devicelistSimulationIndex == 0) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal1.Json"); // [A|B|C|D|E|F|G|H|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z] + } else if (devicelistSimulationIndex == 1) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal2.Json"); // [L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z] + } else if (devicelistSimulationIndex == 2) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal3.Json"); // [S|T|U|V|W|X|Y|Z] + } else if (devicelistSimulationIndex == 3) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal4.Json"); // [A|B|C|D|E] + } else if (devicelistSimulationIndex == 4) { + fileName = path.resolve(__dirname, "TestLabDeviceMinimal5.Json"); // [] } + devicelistSimulationIndex = (devicelistSimulationIndex == 4) ? 0 : (devicelistSimulationIndex + 1); + } + let deviceList = JSON.parse(fs.readFileSync(fileName, 'utf8'))["network-topology:network-topology"].topology[0].node; + deviceList = filterConnectedDevices(deviceList); + return deviceList; + + } catch (error) { + console.log("Error in getNewDeviceList(): " + error); } + } - async function startDeviceListRealignmentSimulation() { + async function startDeviceListRealignmentSimulation() { - const delay = 15 + Math.floor(Math.random() * 30); - setTimeout(async () => { - //let newDeviceList = await getNewDeviceList(); - cp.deviceListSynchronization(); - startDeviceListRealignmentSimulation(); - }, delay * 1000); - } - cp.startCyclicProcess(2); - -} \ No newline at end of file + const delay = 15 + Math.floor(Math.random() * 30); + setTimeout(async () => { + //let newDeviceList = await getNewDeviceList(); + cp.deviceListSynchronization(); + startDeviceListRealignmentSimulation(); + }, delay * 1000); + } + cp.startCyclicProcess(2); + +} diff --git a/server/temporarySupportFiles/TestLabDeviceMinimal10.Json b/server/temporarySupportFiles/TestLabDeviceMinimal10.Json index bfa4df8a..b5101384 100644 --- a/server/temporarySupportFiles/TestLabDeviceMinimal10.Json +++ b/server/temporarySupportFiles/TestLabDeviceMinimal10.Json @@ -19,10 +19,10 @@ "node-id": "CO12126", "netconf-node-topology:connection-status": "connected" }, - { + { "node-id": "513250009", "netconf-node-topology:connection-status": "connected" - }, + }, { "node-id": "CO12124", "netconf-node-topology:connection-status": "connected" @@ -30,7 +30,7 @@ { "node-id": "CO13306", "netconf-node-topology:connection-status": "connected" - }, + }, { "node-id": "CCCCCCC", "netconf-node-topology:connection-status": "connected" diff --git a/server/temporarySupportFiles/TestLabDeviceMinimal11.Json b/server/temporarySupportFiles/TestLabDeviceMinimal11.Json index 98ecfcd3..650fcec6 100644 --- a/server/temporarySupportFiles/TestLabDeviceMinimal11.Json +++ b/server/temporarySupportFiles/TestLabDeviceMinimal11.Json @@ -19,10 +19,10 @@ "node-id": "CO12126", "netconf-node-topology:connection-status": "connected" }, - { + { "node-id": "513250009", "netconf-node-topology:connection-status": "connected" - }, + }, { "node-id": "CO12124", "netconf-node-topology:connection-status": "connected" @@ -30,16 +30,16 @@ { "node-id": "CO13306", "netconf-node-topology:connection-status": "connected" - }, + }, { "node-id": "CCCCCCC", "netconf-node-topology:connection-status": "connected" }, - { + { "node-id": "CO15950", "netconf-node-topology:connection-status": "connected" }, - { + { "node-id": "CO13305", "netconf-node-topology:connection-status": "connected" } diff --git a/server/temporarySupportFiles/TestLabDeviceMinimal12.Json b/server/temporarySupportFiles/TestLabDeviceMinimal12.Json index 8e3576fb..df47442a 100644 --- a/server/temporarySupportFiles/TestLabDeviceMinimal12.Json +++ b/server/temporarySupportFiles/TestLabDeviceMinimal12.Json @@ -19,10 +19,10 @@ "node-id": "CO12126", "netconf-node-topology:connection-status": "connected" }, - { + { "node-id": "513250009", "netconf-node-topology:connection-status": "connected" - }, + }, { "node-id": "CO12124", "netconf-node-topology:connection-status": "connected" @@ -30,12 +30,12 @@ { "node-id": "CO13306", "netconf-node-topology:connection-status": "connected" - }, - { + }, + { "node-id": "CO15950", "netconf-node-topology:connection-status": "connected" }, - { + { "node-id": "CO13305", "netconf-node-topology:connection-status": "connected" } diff --git a/server/temporarySupportFiles/TestLabDeviceMinimal8.Json b/server/temporarySupportFiles/TestLabDeviceMinimal8.Json index 18742526..27a2d8d6 100644 --- a/server/temporarySupportFiles/TestLabDeviceMinimal8.Json +++ b/server/temporarySupportFiles/TestLabDeviceMinimal8.Json @@ -30,7 +30,7 @@ { "node-id": "CO13306", "netconf-node-topology:connection-status": "connected" - }, + }, { "node-id": "AAAAAAA", "netconf-node-topology:connection-status": "connected" diff --git a/server/temporarySupportFiles/TestLabDeviceMinimal9.Json b/server/temporarySupportFiles/TestLabDeviceMinimal9.Json index 6ae3fcd5..d1597193 100644 --- a/server/temporarySupportFiles/TestLabDeviceMinimal9.Json +++ b/server/temporarySupportFiles/TestLabDeviceMinimal9.Json @@ -19,7 +19,7 @@ "node-id": "CO12126", "netconf-node-topology:connection-status": "connected" }, - { + { "node-id": "513250009", "netconf-node-topology:connection-status": "connected" }, @@ -34,11 +34,11 @@ { "node-id": "CO13306", "netconf-node-topology:connection-status": "connected" - }, + }, { "node-id": "AAAAAAA", "netconf-node-topology:connection-status": "connected" - }, + }, { "node-id": "CCCCCCC", "netconf-node-topology:connection-status": "connected"