Compare commits

...

401 Commits

Author SHA1 Message Date
Dmitry Dunaev
d938c26329 Chg: helm set v2.0.0-RC1 image 2021-10-01 14:44:20 +03:00
stephb9959
6dd1ee63a0 Updating Configuration Validator. 2021-09-30 09:31:55 -07:00
stephb9959
a28904ba62 Updated the configuration validator with latest schema. 2021-09-30 08:56:09 -07:00
stephb9959
bc4bcd7a5c Added the "validateconfig" command. Same used in OW-PROV. 2021-09-30 06:44:23 -07:00
stephb9959
01cc10bd63 Added the "validateOnly" flag for configuration validation. Same used in OW-PROV. 2021-09-30 06:40:13 -07:00
stephb9959
2961b7bb42 Adding required security logging 2021-09-29 20:26:12 -07:00
stephb9959
ee2df31e51 Adding IP address in connection message for provisioning system. 2021-09-29 08:25:38 -07:00
stephb9959
2717ed9d23 Adding IP address in connection message for provisioning system. 2021-09-29 08:07:04 -07:00
stephb9959
942e99cf41 Adding IP address in connection message for provisioning system. 2021-09-29 07:59:47 -07:00
stephb9959
7340abf40e Merge remote-tracking branch 'origin/master' 2021-09-29 06:49:14 -07:00
stephb9959
1d1d744d67 Fix for new device veing added. 2021-09-29 06:49:06 -07:00
Dmitry Dunaev
8656cac16e [WIFI-4240] Fix: revert changes in helm values on ucentral.websocket.* properties 2021-09-28 16:14:49 +03:00
oblom0v
d9552b3971 Add missing backslash in entrypoint script 2021-09-28 13:23:15 +02:00
Dmitry Dunaev
1685224cba [WIFI-4240] Fix: helm deployment template 2021-09-28 13:13:47 +03:00
oblom0v
1ab94d0b78 Restore changes from PR #52 2021-09-28 10:56:03 +02:00
stephb9959
35cc18b1dc Standardizing logs messages and HTTP error messages. 2021-09-27 22:54:52 -07:00
stephb9959
35fbf1d5ca Standardizing logs messages and HTTP error messages. 2021-09-27 22:20:20 -07:00
stephb9959
d29876f948 Build change. 2021-09-27 21:12:49 -07:00
stephb9959
d8b4d4a173 Build change. 2021-09-27 15:38:58 -07:00
Stephane Bourque
ff577f2aa3 Merge pull request #55 from Telecominfraproject/dev-2.2
Dev 2.2
2021-09-27 15:33:38 -07:00
stephb9959
6b871a27e2 conflict 2021-09-27 22:31:02 +00:00
stephb9959
b4b2707f3f conflict 2021-09-27 22:30:00 +00:00
stephb9959
153477b649 resolve conflicts 2021-09-27 22:17:40 +00:00
stephb9959
f73389af3c resolve conflicts 2021-09-27 22:15:37 +00:00
stephb9959
eb361cad14 resolve conflicts 2021-09-27 22:12:12 +00:00
Stephane Bourque
0e7dcf88a3 Merge pull request #52 from Telecominfraproject/WIFI-4240-adapt-ucentral-sdk
[WIFI-4240] Adapt uCentral SDK for deployment changes
2021-09-27 14:07:26 -07:00
Stephane Bourque
7726c8b346 Merge pull request #53 from Telecominfraproject/feature/wifi-4240--adapt-helm
[WIFI-4240] Chg: adapt helm files to 2.2 renaming
2021-09-27 14:07:07 -07:00
stephb9959
b3a0593f8e Refactoring yaml file name. 2021-09-27 09:50:01 -07:00
stephb9959
cd047f8d38 Refactoring errors. 2021-09-27 09:30:58 -07:00
oblom0v
96b09eacc3 Adapt Github actions workflows 2021-09-27 15:35:05 +02:00
Dmitry Dunaev
cafb26e13d [WIFI-4240] Chg: adapt helm files to 2.2 renaming 2021-09-27 15:49:13 +03:00
oblom0v
007d034a54 Add new packages to Docker build 2021-09-24 15:47:10 +02:00
oblom0v
6d578193b6 Adapt renaming in Docker and associated config 2021-09-24 10:17:15 +02:00
stephb9959
0d63f9882d Fixing stats. 2021-09-23 11:46:37 -07:00
stephb9959
1ea2542a00 Refactoring DB Access. 2021-09-23 11:31:33 -07:00
stephb9959
87054cfaa3 Refactoring DB Access. 2021-09-23 11:28:44 -07:00
stephb9959
b4fd04ef9c Refactoring DB Access. 2021-09-23 10:21:49 -07:00
stephb9959
0e1bd681d8 Merge remote-tracking branch 'origin/dev-2.2' into dev-2.2 2021-09-23 10:16:59 -07:00
stephb9959
3919c95250 Refactoring DB Access. 2021-09-23 10:16:44 -07:00
Johann Hoffmann
e85e00a5db [WIFI-3938] Remove ./add-ca-cert.sh script in Docker Compose deployment (#51)
* Update ca-certificates in entrypoint script

* Add restapi-ca.pem to Docker image
2021-09-23 18:04:37 +02:00
Johann Hoffmann
1ef2a62b06 [WIFI-3016] Add support for configuration through environment variables (#48)
* Add template and envsubst call in docker-entrypoint.sh

* Fix env variable name
2021-09-23 18:04:19 +02:00
Johann Hoffmann
95ce12fabc Change ownership of uCentralGW root directory inside Dockerfile (#47) 2021-09-23 18:03:53 +02:00
stephb9959
408183eada Refactoring DB Access. 2021-09-22 22:40:59 -07:00
stephb9959
b7d42c76dc Refactoring DB Access. 2021-09-22 11:41:10 -07:00
stephb9959
7ee0aa57a9 Refactoring DB Access. 2021-09-22 11:18:07 -07:00
stephb9959
51dd6dbc13 Refactoring DB Access. 2021-09-22 11:05:20 -07:00
stephb9959
7f4e6303c7 Refactoring DB Access. 2021-09-22 10:42:27 -07:00
stephb9959
3b59a36012 Ficxing the Newest command call. 2021-09-22 07:12:04 -07:00
stephb9959
3ca43225ae Fixing some device DB issues and improving upgrade detection for configuration. 2021-09-21 22:15:26 -07:00
stephb9959
119638f108 Fixing some device DB issues and improving upgrade detection for configuration. 2021-09-21 21:59:08 -07:00
stephb9959
dd8265c1c7 Fixing some device DB issues and improving upgrade detection for configuration. 2021-09-21 21:48:22 -07:00
stephb9959
f2f413dbfe Fixing some device DB issues and improving upgrade detection for configuration. 2021-09-21 21:38:15 -07:00
stephb9959
271d97e152 Fixing some device DB issues and improving upgrade detection for configuration. 2021-09-21 21:25:03 -07:00
stephb9959
cda780bbca Fixing some device DB issues and improving upgrade detection for configuration. 2021-09-21 20:47:46 -07:00
stephb9959
a739f1e48c Fixing some device DB issues and improving upgrade detection for configuration. 2021-09-21 14:57:51 -07:00
stephb9959
7881e4297b Fixing some device DB issues and improving upgrade detection for configuration. 2021-09-21 14:57:31 -07:00
Johann Hoffmann
0fa0af3159 [WIFI-3938] Remove ./add-ca-cert.sh script in Docker Compose deployment (#51)
* Update ca-certificates in entrypoint script

* Add restapi-ca.pem to Docker image
2021-09-21 19:02:03 +02:00
stephb9959
3ea4e5a641 Fixing config reload. 2021-09-21 08:42:42 -07:00
stephb9959
75fda33eaf Adding RESTAPI_handler fix. 2021-09-20 07:52:33 -07:00
stephb9959
1d9e30ab0f Updating documentation. 2021-09-19 16:20:24 -07:00
stephb9959
771ea62a3e Updating documentation. 2021-09-19 16:19:00 -07:00
stephb9959
c89bee14c0 Adding processing for system commands to support OS information. 2021-09-18 22:31:41 -07:00
stephb9959
f9e52526b4 Adding processing for system commands to support OS information. 2021-09-18 22:00:09 -07:00
stephb9959
ed7ecc0eff Adding processing for system commands to support OS information. 2021-09-18 15:58:40 -07:00
stephb9959
79128169c2 Adding processing for system commands to support OS information. 2021-09-18 15:53:37 -07:00
stephb9959
557538e30d Adding processing for system commands to support OS information. 2021-09-18 15:45:25 -07:00
stephb9959
5d5bdd99d8 Adding processing for system commands to support OS information. 2021-09-18 15:40:51 -07:00
stephb9959
d1b2524632 Adding processing for system commands to support OS information. 2021-09-18 15:38:44 -07:00
stephb9959
2eb3238cdc Adding processing for system commands to support OS information. 2021-09-18 15:28:05 -07:00
stephb9959
b7bc615d05 Adding processing for system commands to support OS information. 2021-09-18 10:32:46 -07:00
stephb9959
222f7df0e4 Adding processing for system commands to support OS information. 2021-09-18 10:05:05 -07:00
stephb9959
c93459bf18 Addressing the command lockup. 2021-09-18 00:01:00 -07:00
stephb9959
8d2173a046 Changing mutex type 2021-09-16 22:01:33 -07:00
stephb9959
efd8b81625 Finishing the TelemetrStream. Changed the mode so now Chrome also works. 2021-09-16 14:35:27 -07:00
stephb9959
24163b5fce Finishing the TelemetrStream. Changed the mode so now Chrome also works. 2021-09-16 14:29:23 -07:00
stephb9959
f50ce2f816 Improving incoming device management with multiple reactors. 2021-09-16 14:13:18 -07:00
stephb9959
cc4ba61c15 Improving incoming device management with multiple reactors. 2021-09-16 12:08:30 -07:00
stephb9959
bbc0255ad4 Improving incoming device management with multiple reactors. 2021-09-16 11:32:17 -07:00
stephb9959
1e0628abf4 Changing WebSocket connection for better performance. 2021-09-16 11:27:26 -07:00
stephb9959
5d8e9355b1 Changing WebSocket connection for better performance. 2021-09-16 11:25:54 -07:00
stephb9959
3eaedf4752 Changing WebSocket connection for better performance. 2021-09-16 11:09:28 -07:00
stephb9959
da38f204b6 Changing WebSocket connection for better performance. 2021-09-16 11:05:42 -07:00
stephb9959
ab29614b99 Changing WebSocket connection for better performance. 2021-09-16 11:03:55 -07:00
stephb9959
881015331c Changing WebSocket connection for better performance. 2021-09-16 10:57:05 -07:00
stephb9959
16ce257dc5 Changing WebSocket connection for better performance. 2021-09-16 10:45:29 -07:00
stephb9959
8b63e5a873 Changing WebSocket connection for better performance. 2021-09-16 10:39:45 -07:00
stephb9959
3b690b1878 Changing WebSocket connection for better performance. 2021-09-16 10:37:55 -07:00
stephb9959
c9157f1df4 Changing WebSocket connection for better performance. 2021-09-16 10:29:50 -07:00
stephb9959
d5f6c7a976 Changing WebSocket connection for better performance. 2021-09-16 10:27:06 -07:00
stephb9959
c9528b7c1d Changing WebSocket connection for better performance. 2021-09-16 10:22:54 -07:00
stephb9959
cf1b5c019f Changing WebSocket connection for better performance. 2021-09-16 08:51:06 -07:00
stephb9959
ee075fff67 Changing WebSocket connection for better performance. 2021-09-16 08:49:53 -07:00
stephb9959
348f30a05f Changing WebSocket connection for better performance. 2021-09-16 08:48:29 -07:00
stephb9959
c0930929d9 Changing WebSocket connection for better performance. 2021-09-16 08:47:42 -07:00
stephb9959
cbd2b3ccb9 Changing WebSocket connection for better performance. 2021-09-16 08:43:17 -07:00
stephb9959
c53d98282a Changing WebSocket connection for better performance. 2021-09-16 08:39:56 -07:00
stephb9959
871063e029 Changing WebSocket connection for better performance. 2021-09-16 08:22:41 -07:00
stephb9959
94c6f89f4a Changing WebSocket connection for better performance. 2021-09-16 08:16:46 -07:00
stephb9959
24f1561847 Changing WebSocket connection for better performance. 2021-09-16 08:07:51 -07:00
stephb9959
61472453a1 Changing WebSocket connection for better performance. 2021-09-16 08:04:29 -07:00
stephb9959
4031c94fb9 Adding processing for close frame. 2021-09-16 00:14:07 -07:00
stephb9959
25079004b8 Adding processing for close frame. 2021-09-16 00:10:15 -07:00
stephb9959
61f89fb005 Adding processing for close frame. 2021-09-16 00:05:58 -07:00
stephb9959
5b51a097b2 Adding processing for close frame. 2021-09-15 23:59:39 -07:00
stephb9959
417b82ce70 Adding processing for close frame. 2021-09-15 23:57:06 -07:00
stephb9959
6ca66e313f Adding processing for close frame. 2021-09-15 23:50:18 -07:00
stephb9959
45a7d5066e Adding processing for close frame. 2021-09-15 23:48:21 -07:00
stephb9959
000a01ab09 Adding processing for close frame. 2021-09-15 23:44:41 -07:00
stephb9959
fca3fcf6a8 Adding processing for close frame. 2021-09-15 23:35:59 -07:00
stephb9959
f3ff04c185 Adding processing for close frame. 2021-09-15 23:31:41 -07:00
stephb9959
5d96d5f572 Adding processing for close frame. 2021-09-15 23:20:21 -07:00
stephb9959
7fc45c160e Adding processing for close frame. 2021-09-15 23:15:13 -07:00
stephb9959
83c1bb305b Adding processing for close frame. 2021-09-15 23:11:02 -07:00
stephb9959
63ac9d2c72 Adding processing for close frame. 2021-09-15 23:05:15 -07:00
stephb9959
0ee5c56d33 Adding processing for close frame. 2021-09-15 22:59:13 -07:00
stephb9959
f6cd8bd73e Adding processing for close frame. 2021-09-15 22:58:20 -07:00
stephb9959
d49b89b775 Adding processing for close frame. 2021-09-15 22:54:41 -07:00
stephb9959
7183767a50 Adding processing for close frame. 2021-09-15 21:33:52 -07:00
stephb9959
b38c657a27 Adding processing for close frame. 2021-09-15 21:31:57 -07:00
stephb9959
2ea8fdf57f Adding processing for close frame. 2021-09-15 19:11:30 -07:00
stephb9959
b8d5b86b3e Adding processing for close frame. 2021-09-15 19:05:08 -07:00
stephb9959
0aa5837ea2 Adding processing for close frame. 2021-09-15 19:01:28 -07:00
stephb9959
187f1669cf Adding processing for close frame. 2021-09-15 18:54:36 -07:00
stephb9959
faebf38a3f Adding processing for close frame. 2021-09-15 17:19:23 -07:00
stephb9959
488d5d0a24 Adding processing for close frame. 2021-09-15 17:15:58 -07:00
stephb9959
461094d883 Adding processing for close frame. 2021-09-15 17:09:55 -07:00
stephb9959
bf00fa34f4 Adding processing for close frame. 2021-09-15 17:05:38 -07:00
stephb9959
2d283ffd32 Adding processing for close frame. 2021-09-15 17:02:00 -07:00
stephb9959
5ec8523b46 Adding processing for close frame. 2021-09-15 17:01:21 -07:00
stephb9959
a78c2f6961 Adding processing for close frame. 2021-09-15 16:42:52 -07:00
stephb9959
14f2ea79e1 Adding processing for close frame. 2021-09-15 16:37:16 -07:00
stephb9959
fcb3f2efbc Adding processing for close frame. 2021-09-15 16:24:22 -07:00
stephb9959
2061a3a699 Adding processing for close frame. 2021-09-15 16:20:00 -07:00
stephb9959
8e4c528da5 Adding processing for close frame. 2021-09-15 16:18:34 -07:00
stephb9959
8277f8dd92 Adding processing for close frame. 2021-09-15 16:14:56 -07:00
stephb9959
6a1f844631 Adding processing for close frame. 2021-09-15 16:11:57 -07:00
stephb9959
0ba02f1c70 Adding processing for close frame. 2021-09-15 13:52:05 -07:00
stephb9959
79e0304841 Adding processing for close frame. 2021-09-15 13:25:43 -07:00
stephb9959
5fa7a2d766 Changing telemetry close. 2021-09-15 12:42:14 -07:00
stephb9959
1d1caa7270 Adding proper security logging. 2021-09-15 12:02:00 -07:00
stephb9959
d740167972 Adding proper security logging. 2021-09-15 11:56:55 -07:00
stephb9959
bf93257343 Adding proper security logging. 2021-09-15 11:56:30 -07:00
stephb9959
2286a9063f Telemetry Stream Implemented. 2021-09-14 22:28:23 -07:00
stephb9959
1e35473b82 Telemetry Stream Implemented. 2021-09-14 22:12:53 -07:00
stephb9959
17f0dc4de9 Changing log level from error to information. 2021-09-14 22:07:57 -07:00
stephb9959
8c21b86d5c Changing log level from error to information. 2021-09-14 22:03:33 -07:00
stephb9959
f6780d545d Changing log level from error to information. 2021-09-14 21:52:18 -07:00
stephb9959
6a63a252d5 Changing log level from error to information. 2021-09-14 21:51:49 -07:00
stephb9959
51f8bd7342 Changing log level from error to information. 2021-09-14 21:40:57 -07:00
stephb9959
c0d199a12e Changing log level from error to information. 2021-09-14 21:37:45 -07:00
stephb9959
06a997c6cb Changing log level from error to information. 2021-09-14 21:25:39 -07:00
stephb9959
c2ead350aa Changing log level from error to information. 2021-09-14 21:12:55 -07:00
stephb9959
9941b9a15c Changing log level from error to information. 2021-09-14 21:08:24 -07:00
stephb9959
ef58d30ae3 Changing log level from error to information. 2021-09-14 21:04:56 -07:00
stephb9959
aa6e4e6350 Changing log level from error to information. 2021-09-14 20:55:52 -07:00
stephb9959
6e03253aac Changing log level from error to information. 2021-09-14 20:54:16 -07:00
stephb9959
79c37e3e71 Changing log level from error to information. 2021-09-14 19:49:11 -07:00
stephb9959
44fca56806 Changing log level from error to information. 2021-09-14 19:46:55 -07:00
stephb9959
7d0571269a Changing en erroneous log level. 2021-09-13 09:04:49 -07:00
stephb9959
0734e93b7c Changing log level from error to information. 2021-09-13 08:34:56 -07:00
stephb9959
5986d34e24 Fixing CommandManager problems. 2021-09-12 14:07:05 -07:00
stephb9959
0edd85e991 Fixing CommandManager problems. 2021-09-12 12:40:02 -07:00
stephb9959
1d4995641b Fixing CommandManager problems. 2021-09-11 20:18:51 -07:00
stephb9959
3be56ada41 Fixing RPC Loop lock problem. 2021-09-11 20:12:45 -07:00
stephb9959
a1160f7de5 Adding support for fileuplaod URI 2021-09-10 20:52:52 -07:00
stephb9959
17971d1dd0 Fixing RPC Loop lock problem. 2021-09-10 20:46:55 -07:00
stephb9959
7a762ab3f2 Adding support for fileuplaod URI 2021-09-10 20:45:41 -07:00
stephb9959
1a9ddd2df9 Adding support for fileuplaod URI 2021-09-10 20:27:57 -07:00
stephb9959
f3ae6de093 Adding support for fileuplaod URI 2021-09-10 20:16:32 -07:00
stephb9959
219e8fc59e Adding support for fileuplaod URI 2021-09-10 20:09:17 -07:00
stephb9959
389fcb9f3b Adding support for fileuplaod URI 2021-09-10 20:03:39 -07:00
stephb9959
e40abd2a91 Adding support for fileuplaod URI 2021-09-10 19:55:33 -07:00
stephb9959
ee11dc8d91 Adding support for fileuplaod URI 2021-09-10 19:51:34 -07:00
stephb9959
a9ec2e7821 Adding support for fileuplaod URI 2021-09-10 19:09:03 -07:00
stephb9959
b6b1c99c86 Adding support for fileuplaod URI 2021-09-10 18:58:43 -07:00
stephb9959
31f96968b2 Adding support for fileuplaod URI 2021-09-09 10:47:24 -07:00
stephb9959
1e845a6ff2 Fixing bug 3202 2021-09-09 09:00:39 -07:00
stephb9959
0e9ddee588 Adding some logs for fileuploading. 2021-09-09 08:14:06 -07:00
stephb9959
6e167372b5 Adding support for fileuplaod URI 2021-09-09 07:52:08 -07:00
stephb9959
1e1f0c37e9 Adding ucentral.fileupoloader.uri to support port mapping through docker. 2021-09-09 07:45:35 -07:00
stephb9959
4cf10b0f3a Solve WIFI-3733 and WIFI-3434 2021-09-07 17:57:17 -07:00
stephb9959
314fef87e2 Adding telemetry stream. 2021-09-07 11:13:40 -07:00
stephb9959
e4e2075021 Merge remote-tracking branch 'origin/master' 2021-09-03 08:03:23 -07:00
stephb9959
314ae21d6a Fixing disconnection bug. 2021-09-03 08:03:12 -07:00
stephb9959
8ad0da5781 Fixed disconne ctions. 2021-09-02 19:10:01 -07:00
Johann Hoffmann
935cc78bb4 [WIFI-3016] Add support for configuration through environment variables (#48)
* Add template and envsubst call in docker-entrypoint.sh

* Fix env variable name
2021-09-02 19:01:36 +02:00
stephb9959
5bc7508d96 Fixed disconne ctions. 2021-09-01 23:37:30 -07:00
stephb9959
498e8f880c Fixed disconne ctions. 2021-09-01 23:22:13 -07:00
stephb9959
e9e5d8be41 Fixed disconne ctions. 2021-09-01 23:07:01 -07:00
stephb9959
319e8918b1 Fixed disconne ctions. 2021-09-01 19:24:15 -07:00
stephb9959
7892489e96 Addressing the failure to close a socket and duplicte logs messages. Docker problem. 2021-09-01 17:25:27 -07:00
stephb9959
24785e2f63 Addressing the failure to close a socket and duplicte logs messages. Docker problem. 2021-09-01 17:05:03 -07:00
stephb9959
52736f4a4c Addressing the failure to close a socket and duplicte logs messages. Docker problem. 2021-09-01 16:38:13 -07:00
stephb9959
e7334122b5 Addressing the failure to close a socket and duplicte logs messages. Docker problem. 2021-09-01 16:14:25 -07:00
stephb9959
33168f35d5 Addressing the failure to close a socket and duplicte logs messages. Docker problem. 2021-09-01 12:05:32 -07:00
stephb9959
0d6471acae Fixing Namespace 2021-08-31 22:52:18 -07:00
stephb9959
41a04c9108 Fixing Namespace 2021-08-31 17:08:54 -07:00
stephb9959
95cc17bb16 Fixing Namespace 2021-08-31 15:30:54 -07:00
stephb9959
9f9e1b4cdb Fixing Namespace 2021-08-31 14:53:11 -07:00
Johann Hoffmann
df71d60c2c Change ownership of uCentralGW root directory inside Dockerfile (#47) 2021-08-30 14:52:35 +02:00
Dmitry Dunaev
9eef500eb9 [WIFI-3202] Fix: helm path for fileuploader should be in persist dir 2021-08-30 12:11:40 +03:00
Stephane Bourque
8172b9c55e Merge pull request #46 from Telecominfraproject/dev-2.1
Fixing uploads dir
2021-08-26 09:25:06 -07:00
stephb9959
a35d3d73c2 Fixing DB setup 2021-08-26 09:22:21 -07:00
Stephane Bourque
5ae99dd04b Merge pull request #45 from Telecominfraproject/dev-2.1
Merging Dev 2.1 into master
2021-08-26 08:21:19 -07:00
Dmitry Dunaev
5f118b51d4 Merge pull request #42 from Telecominfraproject/feature/wifi-5150--external-db
[WIFI-3150] Add: external databases as optional dependencies for Helm chart
2021-08-24 14:21:48 +03:00
stephb9959
b7a762ad44 Fixing DB setup 2021-08-23 21:42:18 -07:00
stephb9959
a236bd7e4a Fixing DB setup 2021-08-22 08:30:28 -07:00
stephb9959
25af9bee46 Fixing wrong microservice type 2021-08-21 15:15:31 -07:00
stephb9959
897f5076b2 Fixing wrong microservice type 2021-08-21 14:40:03 -07:00
stephb9959
dd7a7bbc74 Moving to OpenWifi namespace 2021-08-21 11:42:36 -07:00
stephb9959
ef4af5b379 Adding example to OpenAPI 2021-08-19 07:45:15 -07:00
stephb9959
cfb562bb7a Fixing the eventqueue command 2021-08-19 07:42:15 -07:00
stephb9959
0675192f2c Microservice bus cleanup 2021-08-18 23:21:41 -07:00
stephb9959
27f0c5fe75 Microservice bus cleanup 2021-08-18 23:21:30 -07:00
stephb9959
5153f16d00 Microservice bus cleanup 2021-08-17 14:24:16 -07:00
stephb9959
deff8e5253 Microservice bus cleanup 2021-08-17 14:15:47 -07:00
stephb9959
152ba10a13 Fixing dashboard associations not being reset between runs. 2021-08-17 09:23:44 -07:00
Dmitry Dunaev
36cb68fef7 [WIFI-3150] Add: external databases as optional dependencies for Helm chart 2021-08-17 13:08:34 +03:00
stephb9959
7874cf3bd0 Adding authenticated web socket interface. 2021-08-13 11:15:42 -07:00
stephb9959
6ea7e93cb0 Adding authenticated web socket interface. 2021-08-13 09:25:33 -07:00
stephb9959
3520fb5ed4 Adding authenticated web socket interface. 2021-08-13 09:20:55 -07:00
stephb9959
c2266581b9 Adding authenticated web socket interface. 2021-08-13 09:02:43 -07:00
stephb9959
389de28cfb Adding authenticated web socket interface. 2021-08-13 08:58:15 -07:00
stephb9959
595dc5d42b Adding authenticated web socket interface. 2021-08-13 08:48:49 -07:00
stephb9959
c1d75c09be Adding authenticated web socket interface. 2021-08-13 08:41:35 -07:00
stephb9959
c0941512ae Adding authenticated web socket interface. 2021-08-13 08:39:38 -07:00
stephb9959
1f83f954dd Adding a command to test the WebSocket interface: wstest 2021-08-12 23:43:31 -07:00
stephb9959
3f7385d248 Fixing WebSocket interface for serial number cache. 2021-08-12 23:34:07 -07:00
stephb9959
25d13d3cb2 Fixing WebSocket interface for serial number cache. 2021-08-12 23:30:46 -07:00
stephb9959
5120b2cb64 Fixing WebSocket interface for serial number cache. 2021-08-12 23:26:09 -07:00
stephb9959
bca4f6cfcd Fixing WebSocket interface for serial number cache. 2021-08-12 22:47:56 -07:00
stephb9959
0b2ca909ed Adding WebSocket generic interface for SerialNumber Search for inventory. 2021-08-12 10:58:11 -07:00
stephb9959
3a5a5ae7bc Adding WebSocket generic interface for SerialNumber Search for inventory. 2021-08-12 10:12:41 -07:00
stephb9959
1d102cf1e9 Adding WebSocket generic interface for SerialNumber Search for inventory. 2021-08-12 10:04:45 -07:00
stephb9959
4644d231c4 Fixing no associations returned for not connected devices. 2021-08-11 15:56:03 -07:00
stephb9959
c50ed2f252 Fixing no associations returned for not connected devices. 2021-08-11 15:42:44 -07:00
stephb9959
7bba3da732 Fixing no associations returned for not connected devices. 2021-08-11 14:15:33 -07:00
stephb9959
6f9abd32e7 Fixing bug where we were still expecting a file after a trace that generated an error. 2021-08-11 09:45:36 -07:00
stephb9959
1c3e98619a Adding Associations in device status. 2021-08-11 08:45:29 -07:00
stephb9959
20fe93fcdc Fixing return values for delete 2021-08-11 07:54:07 -07:00
stephb9959
57a9114ac5 Fixing some minor corner cases error validation for REST calls. 2021-08-05 08:26:16 -07:00
stephb9959
4b2eecf8b0 Addressing Trace issues. 2021-08-04 20:04:38 -07:00
stephb9959
ed88cbfce6 Addressing Trace issues. 2021-08-04 19:52:00 -07:00
stephb9959
f7e70f5839 Addressing Trace issues. 2021-08-04 19:50:11 -07:00
stephb9959
d76ef5e1d0 Addressing Trace issues. 2021-08-04 19:40:47 -07:00
stephb9959
a4cf28c858 Addressing Trace issues. 2021-08-04 11:40:13 -07:00
stephb9959
4f5e21d658 Merge remote-tracking branch 'origin/master' 2021-08-04 11:39:32 -07:00
stephb9959
bd5f7cd373 Addressing Trace issues. 2021-08-04 11:39:24 -07:00
Dmitry Dunaev
d74795fd96 Merge pull request #41 from Telecominfraproject/fix/k8s-security-context
Fix: add securityContext to make mounted volumes accessible by the application user
2021-08-04 18:12:40 +03:00
stephb9959
3fe17e58de Addressing Trace issues. 2021-08-03 23:34:14 -07:00
stephb9959
adba0fbe22 Addressing Trace issues. 2021-08-03 23:22:05 -07:00
stephb9959
64a99e5079 Addressing Trace issues. 2021-08-03 23:12:42 -07:00
stephb9959
34def33f69 Addressing Trace issues. 2021-08-03 23:04:29 -07:00
stephb9959
de34051cd4 Addressing Trace issues. 2021-08-03 22:56:42 -07:00
stephb9959
346d845ee9 Addressing Trace issues. 2021-08-03 22:36:26 -07:00
stephb9959
83ada431de Fixing DB Range settings 2021-08-03 15:38:53 -07:00
stephb9959
2563d7e9b3 Fixing DB Range settings 2021-08-03 15:35:27 -07:00
stephb9959
1f0f3e8f38 Fixing DB Range settings 2021-08-03 14:57:28 -07:00
stephb9959
f13ecd0d1c Fixing DB Range settings 2021-08-03 14:54:37 -07:00
stephb9959
54f35de99f Fixing DB Range settings 2021-08-03 14:53:52 -07:00
stephb9959
f7b6c6f90f Fixing DB Range settings 2021-08-03 14:16:41 -07:00
stephb9959
f003149b8d Fixing DB Range settings 2021-08-03 14:07:11 -07:00
stephb9959
4f9e7c9677 Fixing DB Range settings 2021-08-03 14:05:08 -07:00
stephb9959
14d7aad56c Fixing DB Range settings 2021-08-03 14:00:08 -07:00
stephb9959
aa4d2ae764 Fixing DB Range settings 2021-08-03 12:35:22 -07:00
stephb9959
4e60b248ca Fixing DB Range settings 2021-08-03 12:13:44 -07:00
stephb9959
685f9024d7 Fixing DB Range settings 2021-08-03 11:47:15 -07:00
stephb9959
104d429b69 Fixing DB Range settings 2021-08-03 11:30:51 -07:00
stephb9959
8cf5672a73 Improving OpenSSL support. 2021-08-03 10:48:55 -07:00
stephb9959
186f7624a6 Improving OpenSSL support. 2021-08-03 10:28:42 -07:00
stephb9959
8986cde273 Improving OpenSSL support. 2021-08-03 10:11:02 -07:00
stephb9959
0abc3de4cd Improving OpenSSL support. 2021-08-03 10:07:49 -07:00
stephb9959
d219fab455 Improving OpenSSL support. 2021-08-03 09:54:45 -07:00
stephb9959
3b3e79ac14 Improving OpenSSL support. 2021-08-03 09:39:30 -07:00
stephb9959
2ff32a69e6 Improving OpenSSL support. 2021-08-03 09:32:18 -07:00
stephb9959
2b66f15bda Improving OpenSSL support. 2021-08-03 09:28:14 -07:00
stephb9959
508ff00663 Improving OpenSSL support. 2021-08-03 09:21:32 -07:00
stephb9959
d0fc391cde Improving OpenSSL support. 2021-08-03 09:14:29 -07:00
Dmitry Dunaev
77a031eaa3 [WIFI-3332] Fix: add securityContext to make mounted volumes accessible by the application user 2021-08-03 18:47:59 +03:00
stephb9959
a6f6421992 Improving OpenSSL support. 2021-08-03 08:03:14 -07:00
stephb9959
fdf497397e Improving OpenSSL support. 2021-08-03 07:54:43 -07:00
stephb9959
ab605655e1 Improving OpenSSL support. 2021-08-03 07:47:28 -07:00
stephb9959
422574ed65 Improving OpenSSL support. 2021-08-03 07:38:12 -07:00
stephb9959
34f9b6f761 Improving OpenSSL support. 2021-08-03 07:33:31 -07:00
stephb9959
27e8178444 Improving OpenSSL support. 2021-08-03 07:29:08 -07:00
stephb9959
ba6796cd16 Improving OpenSSL support. 2021-08-03 07:25:13 -07:00
stephb9959
816d5da3ba Improving OpenSSL support. 2021-08-03 07:17:47 -07:00
stephb9959
c9c3c16e0b Improving OpenSSL support. 2021-08-02 23:00:13 -07:00
stephb9959
35dc055c40 Improving OpenSSL support. 2021-08-02 22:57:48 -07:00
stephb9959
6760ca1da1 Improving OpenSSL support. 2021-08-02 22:47:58 -07:00
stephb9959
36e6ee3ac4 Improving OpenSSL support. 2021-08-02 22:18:09 -07:00
stephb9959
362d97de1f Improving OpenSSL support. 2021-08-02 22:15:23 -07:00
stephb9959
530a2bb772 Improving OpenSSL support. 2021-08-02 22:12:15 -07:00
stephb9959
b333af3465 Improving OpenSSL support. 2021-08-02 22:10:46 -07:00
stephb9959
1b405987bf Improving OpenSSL support. 2021-08-02 22:07:29 -07:00
stephb9959
6dd52f86b9 Improving OpenSSL support. 2021-08-02 21:12:38 -07:00
stephb9959
76081e82af Improving OpenSSL support. 2021-08-02 20:54:47 -07:00
stephb9959
ebe2d16a87 Improving OpenSSL support. 2021-08-02 15:40:34 -07:00
stephb9959
60e4ced29a Improving OpenSSL support. 2021-08-02 15:33:24 -07:00
stephb9959
5683054349 Improving OpenSSL support. 2021-08-02 15:29:44 -07:00
stephb9959
210a96c143 Improving OpenSSL support. 2021-08-02 15:00:54 -07:00
stephb9959
92e108aa6b Improving OpenSSL support. 2021-08-02 14:54:49 -07:00
stephb9959
691b82589d Improving OpenSSL support. 2021-08-02 14:54:01 -07:00
stephb9959
4b471af065 Improving OpenSSL support. 2021-08-02 14:51:15 -07:00
stephb9959
3c556da991 Improving OpenSSL support. 2021-08-02 14:48:04 -07:00
stephb9959
9ddd371c86 Improving OpenSSL support. 2021-08-02 14:42:52 -07:00
stephb9959
5391468ea2 Improving OpenSSL support. 2021-08-02 14:37:36 -07:00
stephb9959
8daffc2ccf Improving OpenSSL support. 2021-08-02 14:36:15 -07:00
stephb9959
f58c204f51 Improving OpenSSL support. 2021-08-02 14:28:13 -07:00
stephb9959
5e857d6019 Improving OpenSSL support. 2021-08-02 14:16:47 -07:00
stephb9959
a7fe50f956 Improving OpenSSL support. 2021-08-02 14:15:07 -07:00
stephb9959
40239079a4 Improving OpenSSL support. 2021-08-02 10:09:42 -07:00
stephb9959
27c4602fca Improving OpenSSL support. 2021-08-02 09:52:38 -07:00
stephb9959
c107c6da93 Improving OpenSSL support. 2021-08-02 09:50:29 -07:00
stephb9959
f67995b4a9 Improving OpenSSL support. 2021-08-02 09:49:19 -07:00
stephb9959
851fdb1f1d Improving OpenSSL support. 2021-08-02 09:43:17 -07:00
stephb9959
8f52dc57ba Improving OpenSSL support. 2021-08-02 09:39:52 -07:00
stephb9959
427ee37b16 Improving OpenSSL support. 2021-08-02 09:37:29 -07:00
stephb9959
fc153f7fc9 Merge remote-tracking branch 'origin/master' 2021-08-02 09:31:04 -07:00
stephb9959
5c9f571565 Improving OpenSSL support. 2021-08-02 09:30:52 -07:00
stephb9959
ab3905f6d8 Improving OpenSSL support. 2021-08-02 09:29:56 -07:00
Dmitry Dunaev
9cee7d4588 [WIFI-3286] Fix: set default logging to stdout 2021-08-02 15:32:43 +03:00
stephb9959
dd95731b22 Improving OpenSSL support. 2021-08-01 22:43:01 -07:00
stephb9959
101384d595 Improving OpenSSL support. 2021-08-01 22:41:21 -07:00
stephb9959
77297d5a3e Improving OpenSSL support. 2021-08-01 22:36:53 -07:00
stephb9959
8b3c3a50ed Improving OpenSSL support. 2021-08-01 22:29:28 -07:00
stephb9959
4b5128e41d Trying to improve connection speed. 2021-07-31 20:38:33 -07:00
stephb9959
b11d713e5b Adding associations in the dashboard 2021-07-30 22:17:18 -07:00
stephb9959
143c4078d4 Fixing dashboard. 2021-07-29 22:24:50 -07:00
stephb9959
b6babaa2f8 Fixing dashboard. 2021-07-29 16:28:47 -07:00
stephb9959
57f0425bc0 Chaning mutex types. 2021-07-29 14:29:05 -07:00
stephb9959
c28159ebe7 Chaning mutex types. 2021-07-29 14:18:37 -07:00
stephb9959
2a0be33c23 Chaning mutex types. 2021-07-29 13:24:46 -07:00
stephb9959
f1c77c0a63 Chaning mutex types. 2021-07-29 11:47:59 -07:00
stephb9959
64fd80f489 Changing version 2021-07-28 11:08:11 -07:00
stephb9959
840481f0d0 Changing version 2021-07-28 08:34:40 -07:00
stephb9959
f7e450a66e Merge remote-tracking branch 'origin/master' 2021-07-28 08:31:47 -07:00
stephb9959
2d8f925115 Chaning version 2021-07-28 08:31:38 -07:00
Dmitry Dunaev
3988f6c38c Fix: use more accessable path for logs 2021-07-28 11:37:06 +03:00
Dmitry Dunaev
4d1ebd398a Fix: logging.channels.c2.path for helm deployment 2021-07-28 11:23:46 +03:00
Dmitry Dunaev
2790fb0de1 Merge pull request #40 from Telecominfraproject/fix/make-chown-optional
Fix: make chown execution optional in docker-entrypoint
2021-07-28 10:58:12 +03:00
Dmitry Dunaev
02c40835f5 Fix: make chown execution optional in docker-entrypoint 2021-07-28 10:58:00 +03:00
stephb9959
4c75a2cd71 Adding systemd script. 2021-07-27 20:09:56 -07:00
stephb9959
d0df73fa86 Fixing uptime. 2021-07-27 15:42:12 -07:00
stephb9959
660570df44 Merge remote-tracking branch 'origin/master' 2021-07-27 12:02:47 -07:00
stephb9959
5f8f4137b0 Fixed wrong header in Kafka message 2021-07-27 12:02:34 -07:00
Johann Hoffmann
de164d30dd [WIFI-3232] Fix Docker Compose deployment (#39)
* Add entrypoint script with chown and the possibility to run as a non-priviliged user

* Fix docker-entrypoint.sh permissions

* Set permissions on docker-entrypoint.sh since Git preserves executable bit

* Change to colon separator
2021-07-27 15:12:28 +02:00
stephb9959
a69c51afd3 Merge remote-tracking branch 'origin/master' 2021-07-23 18:43:11 -07:00
stephb9959
161ddd281e Fixed wrong header in Kafka message 2021-07-23 18:43:04 -07:00
Dmitry Dunaev
5e36935f3b Merge pull request #38 from Telecominfraproject/feature/add-build
[WIFI-3223] Add: build file for correct versioning
2021-07-23 19:27:56 +03:00
Dmitry Dunaev
91dd93fcd5 [WIFI-3223] Add: build file for correct versioning 2021-07-23 19:27:44 +03:00
cbuschfb
12152a6a6e Merge branch 'master' of https://github.com/Telecominfraproject/wlan-cloud-ucentralgw 2021-07-23 08:20:38 -04:00
cbuschfb
326b33ce63 expressWiFi config example
Signed-off-by: cbuschfb <chrisbusch@fb.com>
2021-07-23 08:20:02 -04:00
stephb9959
9effac0c6e Fixed wrong header in Kafka message 2021-07-22 09:24:28 -07:00
stephb9959
4bc8788df2 Fixed wrong header in Kafka message 2021-07-21 16:47:54 -07:00
stephb9959
e8cfcbb507 Fixed wrong header in Kafka message 2021-07-21 14:41:48 -07:00
stephb9959
44f427fcc7 Fixed wrong header in Kafka message 2021-07-21 14:37:45 -07:00
stephb9959
487e043e4f Fixed wrong header in Kafka message 2021-07-21 14:31:58 -07:00
stephb9959
6d294e6add Fixed wrong header in Kafka message 2021-07-21 12:10:27 -07:00
stephb9959
d39fe0b07c Fixed wrong header in Kafka message 2021-07-21 12:04:17 -07:00
stephb9959
64719877f3 Fixed wrong header in Kafka message 2021-07-21 12:01:23 -07:00
stephb9959
127e455fe5 Fixed wrong header in Kafka message 2021-07-21 11:51:23 -07:00
stephb9959
e7b625d058 Fixed wrong header in Kafka message 2021-07-21 11:45:58 -07:00
stephb9959
fdccb31482 Fixed wrong header in Kafka message 2021-07-21 11:35:38 -07:00
stephb9959
fc1daade6e Merge remote-tracking branch 'origin/master' 2021-07-21 11:32:42 -07:00
stephb9959
99e937614b Fixed wrong header in Kafka message 2021-07-21 11:32:35 -07:00
Dmitry Dunaev
f341598056 Merge pull request #37 from Telecominfraproject/feature/helm-docs
[WIFI-2592] Add: Helm README
2021-07-21 14:28:29 +03:00
Dmitry Dunaev
0f6ec15fa2 [WIFI-2592] Add: Helm README 2021-07-21 14:11:13 +03:00
Johann Hoffmann
34a04b406c [WIFI-3045] Move docker-compose including documentation to wlan-cloud-ucentral-deploy (#36)
* Move Docker Compose deployment to wlan-cloud-ucentral-deploy repo

* Fixed CA cert path

* Remove working-directory since both repositories are used
2021-07-20 14:02:19 +02:00
stephb9959
a2ae90a7cb Fixed wrong header in Kafka message 2021-07-19 23:57:24 -07:00
stephb9959
52e252576a Fixed wrong header in Kafka message 2021-07-19 21:48:11 -07:00
stephb9959
9345c4892d Fixing security on internal web service & kafka. 2021-07-19 09:38:04 -07:00
stephb9959
89c325190a Merge remote-tracking branch 'origin/master' 2021-07-19 09:27:45 -07:00
stephb9959
add35585e0 Fixing security on internal web service & kafka. 2021-07-19 09:27:38 -07:00
Dmitry Dunaev
b8fe3e41fa Merge pull request #35 from Telecominfraproject/feature/git-release
[WIFI-2622] Add: branching release model in CI
2021-07-19 17:08:07 +03:00
stephb9959
bb4effa518 Fixing slow Kafka and removing callback system (replaced by Kafka). 2021-07-18 21:15:35 -07:00
stephb9959
997f2c4787 Fixing slow Kafka and removing callback system (replaced by Kafka). 2021-07-18 21:14:11 -07:00
stephb9959
56f0a3f46a Fixing slow Kafka and removing callback system (replaced by Kafka). 2021-07-18 21:12:12 -07:00
stephb9959
ff911cb478 Fixing --version command line option. 2021-07-17 20:09:49 -07:00
stephb9959
f31aa8711e Merge remote-tracking branch 'origin/master' 2021-07-17 17:35:21 -07:00
stephb9959
523bbbcb84 Removing ODBC dependencies, removing stray debug statement. 2021-07-17 17:35:11 -07:00
Dmitry Dunaev
0010a5fc02 [WIFI-2622] Add: branching release model in CI 2021-07-16 18:17:25 +03:00
cbuschfb
8a440cfcd8 type wifi-frames 2GHz
Signed-off-by: cbuschfb <chrisbusch@fb.com>
2021-07-16 09:47:56 -04:00
cbuschfb
3ebd5426f4 Add wifi-frames as metrics service to SSIDs
Signed-off-by: cbuschfb <chrisbusch@fb.com>
2021-07-16 09:38:53 -04:00
cbuschfb
46b3cad88b Basic metrics with NAT mode Dual SSID (2ghz/5Ghz)
Signed-off-by: cbuschfb <chrisbusch@fb.com>
2021-07-16 09:25:18 -04:00
stephb9959
e756a7c1cd Merge remote-tracking branch 'origin/master' 2021-07-15 21:03:02 -07:00
stephb9959
8e216417f7 Fixed a Kafka startup bug 2021-07-15 21:02:54 -07:00
Johann Hoffmann
3a7a386a87 Add ucentralgw user in Dockerfile and adapt script (#34) 2021-07-15 10:46:52 +02:00
stephb9959
ebc6af17b3 Merge remote-tracking branch 'origin/master' 2021-07-14 07:23:46 -07:00
stephb9959
c3d17499b1 Final refactor of namespace before merge. 2021-07-14 07:23:39 -07:00
Johann Hoffmann
01473a337b Update README.md 2021-07-14 14:07:06 +02:00
oblom0v
4e9dfe53d5 Fix script path 2021-07-14 13:17:15 +02:00
oblom0v
39a6daecf5 Fix Docker Compose CI workflow 2021-07-14 12:59:50 +02:00
stephb9959
897dc735d1 Merge branch 'master' of github.com:Telecominfraproject/wlan-cloud-ucentralgw 2021-07-13 18:07:34 -07:00
stephb9959
8c406c57e0 Removed extra apostrophe 2021-07-14 01:06:20 +00:00
stephb9959
923386a06f Merge branch 'master' of github.com:Telecominfraproject/wlan-cloud-ucentralgw 2021-07-13 17:51:56 -07:00
stephb9959
ca52d187ca Final refactor of namespace before merge. 2021-07-13 17:50:20 -07:00
Stephane Bourque
925285b7db Merge pull request #33 from Telecominfraproject/dev-microservice
Moving microservice into main
2021-07-13 08:15:26 -07:00
oblom0v
f8fd154dd8 Fix script name 2021-07-13 17:11:08 +02:00
oblom0v
8b0586b122 Adapt new config file changes 2021-07-13 17:05:10 +02:00
oblom0v
4d119fabd5 Remove duplicate ucentralgw-ui entry and adapt Docker Compose CI job to microservice structure 2021-07-13 16:55:31 +02:00
177 changed files with 10524 additions and 5843 deletions

View File

@@ -7,11 +7,12 @@ on:
- '**.md'
branches:
- master
- dev-microservice
- 'release/*'
tags:
- 'v*'
pull_request:
branches:
- master
- dev-microservice
defaults:
run:
@@ -26,66 +27,71 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: build Docker image
run: docker build -t wlan-cloud-ucentralgw:${{ github.sha }} .
- name: Build Docker image
run: docker build -t wlan-cloud-owgw:${{ github.sha }} .
- name: log into Docker registry
- name: Tag Docker image
run: |
TAGS="${{ github.sha }}"
if [[ ${GITHUB_REF} == "refs/heads/"* ]]
then
CURRENT_TAG=$(echo ${GITHUB_REF#refs/heads/} | tr '/' '-')
TAGS="$TAGS $CURRENT_TAG"
else
if [[ ${GITHUB_REF} == "refs/tags/"* ]]
then
CURRENT_TAG=$(echo ${GITHUB_REF#refs/tags/} | tr '/' '-')
TAGS="$TAGS $CURRENT_TAG"
else # PR build
CURRENT_TAG=$(echo ${GITHUB_HEAD_REF#refs/heads/} | tr '/' '-')
TAGS="$TAGS $CURRENT_TAG"
fi
fi
echo "Result tags: $TAGS"
for tag in $TAGS; do
docker tag wlan-cloud-owgw:${{ github.sha }} ${{ env.DOCKER_REGISTRY_URL }}/owgw:$tag
done
- name: Log into Docker registry
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/pull/') || github.ref == 'refs/heads/master'
uses: docker/login-action@v1
with:
registry: ${{ env.DOCKER_REGISTRY_URL }}
username: ${{ env.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
- name: push Docker image
- name: Push Docker images
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/pull/') || github.ref == 'refs/heads/master'
run: |
TAGS="${{ github.sha }}"
if [ ${GITHUB_REF} == "refs/heads/master" ]
then
TAGS="$TAGS ${GITHUB_REF#refs/heads/}"
else # PR build
CURRENT_TAG=$(echo ${GITHUB_HEAD_REF#refs/heads/} | tr '/' '-')
TAGS="$TAGS $CURRENT_TAG"
fi
echo "Pushing tags $TAGS"
for tag in $TAGS; do
docker tag wlan-cloud-ucentralgw:${{ github.sha }} ${{ env.DOCKER_REGISTRY_URL }}/ucentralgw:$tag
docker push ${{ env.DOCKER_REGISTRY_URL }}/ucentralgw:$tag
done
docker images | grep ${{ env.DOCKER_REGISTRY_URL }}/owgw | awk -F ' ' '{print $1":"$2}' | xargs -I {} docker push {}
docker-compose:
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/pull/') || github.ref == 'refs/heads/master'
runs-on: ubuntu-20.04
needs: docker
steps:
- name: Check out repository
- name: Check out wlan-cloud-ucentral-deploy repository
uses: actions/checkout@v2
- name: Create certificate and key files from Github secrets
env:
DIGICERT_TIP_WILDCARD_CERT: ${{ secrets.DIGICERT_TIP_WILDCARD_CERT }}
DIGICERT_TIP_WILDCARD_KEY: ${{ secrets.DIGICERT_TIP_WILDCARD_KEY }}
run: |
cat certificates/issuer.pem certificates/root.pem > docker-compose/ucentral-data/certs/restapi-ca.pem
echo "$DIGICERT_TIP_WILDCARD_CERT" > docker-compose/ucentral-data/certs/websocket-cert.pem
echo "$DIGICERT_TIP_WILDCARD_CERT" > docker-compose/ucentral-data/certs/restapi-cert.pem
echo "$DIGICERT_TIP_WILDCARD_KEY" > docker-compose/ucentral-data/certs/websocket-key.pem
echo "$DIGICERT_TIP_WILDCARD_KEY" > docker-compose/ucentral-data/certs/restapi-key.pem
with:
repository: Telecominfraproject/wlan-cloud-ucentral-deploy
path: wlan-cloud-ucentral-deploy
- name: Instantiate Docker Compose deployment
working-directory: ./docker-compose
working-directory: ./wlan-cloud-ucentral-deploy/docker-compose
env:
UCENTRALGW_TAG: ${{ github.sha }}
OWGW_TAG: ${{ github.sha }}
run: |
docker-compose up -d
docker-compose -f docker-compose.yml -f docker-compose.selfsigned.yml --env-file .env.selfsigned up -d
- name: Wait for uCentralGW to be alive and kicking
- name: Wait for OWSec to be alive and kicking
run: |
n=0
until [ "$n" -ge 3 ]
do
curl -s 127.0.0.1:15015 && break
curl -s 127.0.0.1:16102 && break
n=$((n+1))
if [ "$n" -eq 3]; then
exit 1
@@ -94,19 +100,24 @@ jobs:
fi
done
- name: Check functionality of uCentralGW
- name: Check out wlan-cloud-ucentralgw repository
uses: actions/checkout@v2
with:
path: wlan-cloud-ucentralgw
- name: Check functionality of microservices
env:
UCENTRALGW: "ucentral.cicd.lab.wlan.tip.build:16001"
FLAGS: "-s --cacert docker-compose/ucentral-data/certs/restapi-ca.pem --resolve ucentral.cicd.lab.wlan.tip.build:16001:127.0.0.1"
OWSEC: "openwifi.wlan.local:16001"
FLAGS: "-s --cacert ./wlan-cloud-ucentral-deploy/docker-compose/certs/restapi-ca.pem --resolve openwifi.wlan.local:16001:127.0.0.1"
run: |
./test_scripts/curl/cli listdevices
./wlan-cloud-ucentralgw/test_scripts/curl/cli listdevices
- name: Display information about running containers and log ucentralgw output
working-directory: ./docker-compose
working-directory: ./wlan-cloud-ucentral-deploy/docker-compose
if: always()
run: |
docker-compose ps -a
docker-compose logs
docker-compose -f docker-compose.yml -f docker-compose.selfsigned.yml --env-file .env.selfsigned ps -a
docker-compose -f docker-compose.yml -f docker-compose.selfsigned.yml --env-file .env.selfsigned logs
# disable until repo is public
#- name: export Docker image

View File

@@ -4,7 +4,6 @@ on:
pull_request:
branches:
- master
- dev-microservice
types: [ closed ]
defaults:
@@ -18,4 +17,4 @@ jobs:
- name: Cleanup Docker image with PR branch tag
run: |
export PR_BRANCH_TAG=$(echo ${GITHUB_HEAD_REF#refs/heads/} | tr '/' '-')
curl -uucentral:${{ secrets.DOCKER_REGISTRY_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral/ucentralgw/$PR_BRANCH_TAG"
curl -uucentral:${{ secrets.DOCKER_REGISTRY_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral/owgw/$PR_BRANCH_TAG"

3
.gitignore vendored
View File

@@ -25,3 +25,6 @@ _deps
test_scripts/curl/token.json
.vscode/c_cpp_properties.json
test_scripts/curl/result.json
*.swp
helm/charts/*
!helm/charts/.gitkeep

View File

@@ -82,6 +82,9 @@ Do wifiscan for a device.
- `serial`: device serial number
- `verbose`: verbose=true/false
### telemetry <serial>
Start `telemetry` stream for a device.
### trace <serial> <duration> <network>
Launch a remote trace for a device.
- `serial`: device serial number
@@ -161,12 +164,23 @@ Get a list of devices based on a list.
### deviceswithstatus
Get devices with their status.
### setloglevel <sys> <level>
Set the logging system level for individual subsystems.
- `sys`: ufileuploader/websocket/storage/restapi/commandmanager/auth/deviceregistry/all
- `level`: level:none/fatal/critical/error/warning/notice/information/debug/trace
### setloglevel <subsystem> <loglevel>
Set the log level for s specific subsystem.
### getfile <uuid>
### getloglevels
Get the current log levels for all subsystems.
### getloglevelnames
Get the log level names available.
### getsubsystemnames
Get the list of subsystems.
### systeminfo
Get basic system information.
### reloadsubsystem <subsystem name>
Reload the configuration for a subsystem.### getfile <uuid>
Get the file associated with trace command <uuid>.
- `uuid`: UUID of file to retrieve

View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.13)
project(ucentralgw VERSION 0.4.0)
project(owgw VERSION 2.2.0)
set(CMAKE_CXX_STANDARD 17)
@@ -38,6 +38,8 @@ set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost REQUIRED system)
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(nlohmann_json_schema_validator REQUIRED)
if(SMALL_BUILD)
find_package(Poco REQUIRED COMPONENTS Crypto JWT Net Util NetSSL Data DataSQLite)
@@ -45,13 +47,12 @@ else()
find_package(CppKafka REQUIRED)
find_package(PostgreSQL REQUIRED)
find_package(MySQL REQUIRED)
find_package(ODBC REQUIRED)
find_package(Poco REQUIRED COMPONENTS JSON Crypto JWT Net Util NetSSL Data DataSQLite DataPostgreSQL DataMySQL DataODBC)
find_package(Poco REQUIRED COMPONENTS JSON Crypto JWT Net Util NetSSL Data DataSQLite DataPostgreSQL DataMySQL)
endif()
include_directories(/usr/local/include /usr/local/opt/openssl/include src include/kafka /usr/local/opt/mysql-client/include)
add_executable( ucentralgw
add_executable( owgw
build
src/Daemon.cpp src/Daemon.h
src/RESTAPI_server.cpp src/RESTAPI_server.h
@@ -74,38 +75,50 @@ add_executable( ucentralgw
src/RESTAPI_command.cpp src/RESTAPI_command.h
src/FileUploader.cpp src/FileUploader.h
src/RESTAPI_file.cpp src/RESTAPI_file.h
src/CommandChannel.cpp src/CommandChannel.h
src/RESTAPI_system_command.cpp src/RESTAPI_system_command.h
src/RESTAPI_BlackList.cpp src/RESTAPI_BlackList.h
src/Utils.h src/Utils.cpp src/storage_blacklist.cpp
src/storage_command.cpp src/storage_healthcheck.cpp src/storage_statistics.cpp src/storage_logs.cpp
src/storage_device.cpp src/storage_capabilities.cpp src/storage_defconfig.cpp src/storage_sqlite.cpp
src/storage_mysql.cpp src/storage_pgql.cpp src/storage_odbc.cpp src/storage_tables.cpp src/RESTAPI_callback.cpp
src/RESTAPI_callback.h src/CallbackManager.cpp src/CallbackManager.h
src/storage_device.cpp src/storage_capabilities.cpp src/storage_defconfig.cpp
src/storage_tables.cpp
src/storage_setup.cpp
src/StateProcessor.cpp src/StateProcessor.h
src/storage_lifetime_stats.cpp src/uCentralProtocol.h src/RESTAPI_protocol.h
src/ALBHealthCheckServer.h src/Kafka_topics.h src/uCentralTypes.h
src/ALBHealthCheckServer.h src/Kafka_topics.h
src/OUIServer.cpp src/OUIServer.h
src/RESTAPI_ouis.cpp src/RESTAPI_ouis.h
src/MicroService.cpp src/MicroService.h
src/RESTAPI_RPC.cpp src/RESTAPI_RPC.h src/AuthClient.cpp src/AuthClient.h src/OpenAPIRequest.cpp src/OpenAPIRequest.h src/RESTAPI_utils.h src/RESTAPI_utils.cpp src/StorageArchiver.cpp src/StorageArchiver.h)
src/RESTAPI_RPC.cpp src/RESTAPI_RPC.h
src/AuthClient.cpp src/AuthClient.h
src/OpenAPIRequest.cpp src/OpenAPIRequest.h
src/RESTAPI_utils.h src/RESTAPI_utils.cpp
src/StorageArchiver.cpp src/StorageArchiver.h
src/Dashboard.cpp src/Dashboard.h
src/RESTAPI_deviceDashboardHandler.cpp src/RESTAPI_deviceDashboardHandler.h
src/SerialNumberCache.cpp src/SerialNumberCache.h
src/RESTAPI_webSocketServer.cpp src/RESTAPI_webSocketServer.h
src/OpenWifiTypes.h src/TelemetryStream.cpp src/TelemetryStream.h
src/RESTAPI_GenericServer.cpp src/RESTAPI_GenericServer.h
src/RESTAPI_errors.h src/RESTAPI_TelemetryWebSocket.cpp src/RESTAPI_TelemetryWebSocket.h
src/ConfigurationValidator.cpp src/ConfigurationValidator.h src/ConfigurationCache.cpp src/ConfigurationCache.h)
if(NOT SMALL_BUILD)
target_sources(ucentralgw PUBLIC src/KafkaManager.cpp src/KafkaManager.h)
target_sources(owgw PUBLIC src/KafkaManager.cpp src/KafkaManager.h)
endif()
INSTALL(TARGETS ucentralgw
INSTALL(TARGETS owgw
RUNTIME DESTINATION /usr/bin
)
target_link_libraries(ucentralgw PUBLIC
target_link_libraries(owgw PUBLIC
${Poco_LIBRARIES} ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
if(NOT SMALL_BUILD)
target_link_libraries(ucentralgw PUBLIC
${MySQL_LIBRARIES} ${ODBC_LIBRARIES} ${ZLIB_LIBRARIES}
target_link_libraries(owgw PUBLIC
${MySQL_LIBRARIES} ${ZLIB_LIBRARIES}
CppKafka::cppkafka
nlohmann_json_schema_validator
)
if(UNIX AND NOT APPLE)
target_link_libraries(ucentralgw PUBLIC PocoJSON)
target_link_libraries(owgw PUBLIC PocoJSON)
endif()
endif()

View File

@@ -1,16 +1,18 @@
FROM alpine AS builder
RUN apk update && \
apk add --no-cache openssl openssh && \
apk add --no-cache ncurses-libs && \
apk add --no-cache bash util-linux coreutils curl && \
apk add --no-cache make cmake gcc g++ libstdc++ libgcc git zlib-dev yaml-cpp-dev && \
apk add --no-cache openssl-dev boost-dev unixodbc-dev postgresql-dev mariadb-dev && \
apk add --no-cache apache2-utils yaml-dev apr-util-dev && \
apk add --no-cache lua-dev librdkafka-dev
RUN apk add --update --no-cache \
openssl openssh \
ncurses-libs \
bash util-linux coreutils curl \
make cmake gcc g++ libstdc++ libgcc git zlib-dev yaml-cpp-dev \
openssl-dev boost-dev unixodbc-dev postgresql-dev mariadb-dev \
apache2-utils yaml-dev apr-util-dev \
lua-dev librdkafka-dev \
nlohmann-json
RUN git clone https://github.com/stephb9959/poco /poco
RUN git clone https://github.com/stephb9959/cppkafka /cppkafka
RUN git clone https://github.com/pboettch/json-schema-validator /json-schema-validator
WORKDIR /cppkafka
RUN mkdir cmake-build
@@ -26,30 +28,47 @@ RUN cmake ..
RUN cmake --build . --config Release -j8
RUN cmake --build . --target install
ADD CMakeLists.txt /ucentralgw/
ADD cmake /ucentralgw/cmake
ADD src /ucentralgw/src
WORKDIR /ucentralgw
WORKDIR /json-schema-validator
RUN mkdir cmake-build
WORKDIR /ucentralgw/cmake-build
WORKDIR cmake-build
RUN cmake ..
RUN make
RUN make install
ADD CMakeLists.txt build /owgw/
ADD cmake /owgw/cmake
ADD src /owgw/src
WORKDIR /owgw
RUN mkdir cmake-build
WORKDIR /owgw/cmake-build
RUN cmake ..
RUN cmake --build . --config Release -j8
FROM alpine
RUN mkdir /ucentral
RUN mkdir /ucentralgw-data
RUN apk add --update --no-cache librdkafka mariadb-connector-c libpq unixodbc
ENV OWGW_USER=owgw \
OWGW_ROOT=/owgw-data \
OWGW_CONFIG=/owgw-data
COPY --from=builder /ucentralgw/cmake-build/ucentralgw /ucentral/ucentralgw
RUN addgroup -S "$OWGW_USER" && \
adduser -S -G "$OWGW_USER" "$OWGW_USER"
RUN mkdir /openwifi
RUN mkdir -p "$OWGW_ROOT" "$OWGW_CONFIG" && \
chown "$OWGW_USER": "$OWGW_ROOT" "$OWGW_CONFIG"
RUN apk add --update --no-cache librdkafka mariadb-connector-c libpq unixodbc su-exec gettext ca-certificates
COPY --from=builder /owgw/cmake-build/owgw /openwifi/owgw
COPY --from=builder /cppkafka/cmake-build/src/lib/* /lib/
COPY --from=builder /poco/cmake-build/lib/* /lib/
EXPOSE 15002
EXPOSE 16002
EXPOSE 16003
EXPOSE 17002
EXPOSE 16102
COPY owgw.properties.tmpl ${OWGW_CONFIG}/
COPY docker-entrypoint.sh /
RUN wget https://raw.githubusercontent.com/Telecominfraproject/wlan-cloud-ucentral-deploy/main/docker-compose/certs/restapi-ca.pem \
-O /usr/local/share/ca-certificates/restapi-ca-selfsigned.pem
ENTRYPOINT /ucentral/ucentralgw
EXPOSE 15002 16002 16003 17002 16102
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/openwifi/owgw"]

View File

@@ -518,6 +518,48 @@ The device should answer:
}
```
#### Controller requesting telemetry stream information
Controller sends this command when it needs the device to telemetry streaming.
```
{ "jsonrpc" : "2.0" ,
"method" : "telemetry" ,
"params" : {
"serial" : <serial number> ,
"interval" : 0-60, # number of seconds for polling information. 0 means to shutdown the stream
"types" : [ "dhcp", "rrm"], <this must be an array: array of 1 or 2 elements, right now only "rrm" and "dhcp" are supported
},
"id" : <some number>
}
```
The device should answer:
```
{ "jsonrpc" : "2.0" ,
"result" : {
"serial" : <serial number> ,
"status" : {
"error" : 0 or an error number,
"text" : <description of the error or success>
}
},
"id" : <same number>
}
```
When the interval is greater than 0, the gateway will start to receive messages
```
{ "jsonrpc" : "2.0" ,
"method" : "telemetry" ,
"params" : {
"serial" : <serial number> ,
"data" : <A JSON document describing the information coming from the device>
}
}
```
The device will stop sending data after 30 minutes or if it receives a `telemetry` command with an interval of 0.
#### Controller requesting an `rtty` session
Controller sends this command an administrator requests to start an `rtty` session with the AP.
```

146
README.md
View File

@@ -26,9 +26,9 @@ Poco may take several minutes depending on the platform you are building on.
### Ubuntu
These instructions have proven to work on Ubuntu 20.4.
```
sudo apt install git cmake g++ libssl-dev libmariabd-dev unixodbc-dev
sudo apt install git cmake g++ libssl-dev libmariadb-dev unixodbc-dev
sudo apt install libpq-dev libaprutil1-dev apache2-dev libboost-all-dev
sudo apt install librdkafka-dev liblua5.3-dev
sudo apt install librdkafka-dev liblua5.3-dev libmysqlclient-dev
git clone https://github.com/stephb9959/poco
cd poco
@@ -153,8 +153,8 @@ cmake -DSMALL_BUILD=1 ..
make
```
### After the build step is completed
Once your build is done. You can remove the Poco source as it is no longer needed.
### After completing the build
After completing the build, you can remove the Poco source as it is no longer needed.
#### Expected directory layout
From the directory where your cloned source is, you will need to create the `certs`, `logs`, and `uploads` directories.
@@ -179,7 +179,7 @@ You should now have the following:
+-- test_scripts
+-- openapi
+-- uploads
+-- ucentralgw.properties
+-- owgw.properties
```
### Certificates
@@ -218,15 +218,15 @@ document. Once you have these files, you need to renamed them `restapi-key.pem`,
in your browner
#### Configuration
The configuration for this service is kept in a properties file. This file is called `ucentralgw.properties` and you can
see the latest version [here](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/ucentralgw.properties). The file will be loaded from
the directory set by the environment variable `UCENTRAL_CONFIG`. To use environment variables in the configuration,
The configuration for this service is kept in a properties file. This file is called `owgw.properties` and you can
see the latest version [here](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/owgw.properties). The file will be loaded from
the directory set by the environment variable `UCENTRALGW_CONFIG`. To use environment variables in the configuration,
you must use `$<varname>`. Only `path names` support the use of environment variables. The sample configuration requires very
little changes if you keep the suggested directory structure. For the sample configuration to work, you need to define 2
environment variables.
```
export UCENTRAL_ROOT=`pwd`
export UCENTRAL_CONFIG=`pwd`
export OWGW_ROOT=`pwd`
export UCENTRALGW_CONFIG=`pwd`
```
If you current working directory is the root of the project, this will set the variables properly. Otherwise, you can set the variables
to point to wherever is necessary.
@@ -234,7 +234,7 @@ to point to wherever is necessary.
##### Important config entries
###### This is the logging directory
```
logging.channels.c2.path = $UCENTRAL_ROOT/logs/sample.log
logging.channels.c2.path = $OWGW_ROOT/logs/sample.log
```
###### This is the type of storage in use
@@ -244,23 +244,23 @@ storage.type = sqlite
###### Autoprovisioning settings
```asm
ucentral.autoprovisioning = true
ucentral.devicetypes.0 = AP:linksys_ea8300,edgecore_eap101,linksys_e8450-ubi
ucentral.devicetypes.1 = SWITCH:edgecore_ecs4100-12ph
ucentral.devicetypes.2 = IOT:esp32
openwifi.autoprovisioning = true
openwifi.devicetypes.0 = AP:linksys_ea8300,edgecore_eap101,linksys_e8450-ubi
openwifi.devicetypes.1 = SWITCH:edgecore_ecs4100-12ph
openwifi.devicetypes.2 = IOT:esp32
```
###### This is the RESTAPI endpoint
```asm
ucentral.restapi.host.0.backlog = 100
ucentral.restapi.host.0.security = relaxed
ucentral.restapi.host.0.rootca = $UCENTRAL_ROOT/certs/restapi-ca.pem
ucentral.restapi.host.0.address = *
ucentral.restapi.host.0.port = 16002
ucentral.restapi.host.0.cert = $UCENTRAL_ROOT/certs/restapi-cert.pem
ucentral.restapi.host.0.key = $UCENTRAL_ROOT/certs/restapi-key.pem
ucentral.restapi.host.0.key.password = mypassword
openwifi.restapi.host.0.backlog = 100
openwifi.restapi.host.0.security = relaxed
openwifi.restapi.host.0.rootca = $OWGW_ROOT/certs/restapi-ca.pem
openwifi.restapi.host.0.address = *
openwifi.restapi.host.0.port = 16002
openwifi.restapi.host.0.cert = $OWGW_ROOT/certs/restapi-cert.pem
openwifi.restapi.host.0.key = $OWGW_ROOT/certs/restapi-key.pem
openwifi.restapi.host.0.key.password = mypassword
```
##### This is the end point for the devices to connect with
@@ -309,12 +309,12 @@ You will need to get the `cert.pem` and `key.pem` from Digicert. The rest is her
```asm
ucentral.websocket.host.0.backlog = 500
ucentral.websocket.host.0.rootca = $UCENTRAL_ROOT/certs/root.pem
ucentral.websocket.host.0.issuer = $UCENTRAL_ROOT/certs/issuer.pem
ucentral.websocket.host.0.cert = $UCENTRAL_ROOT/certs/websocket-cert.pem
ucentral.websocket.host.0.key = $UCENTRAL_ROOT/certs/websocket-key.pem
ucentral.websocket.host.0.clientcas = $UCENTRAL_ROOT/certs/clientcas.pem
ucentral.websocket.host.0.cas = $UCENTRAL_ROOT/certs/cas
ucentral.websocket.host.0.rootca = $OWGW_ROOT/certs/root.pem
ucentral.websocket.host.0.issuer = $OWGW_ROOT/certs/issuer.pem
ucentral.websocket.host.0.cert = $OWGW_ROOT/certs/websocket-cert.pem
ucentral.websocket.host.0.key = $OWGW_ROOT/certs/websocket-key.pem
ucentral.websocket.host.0.clientcas = $OWGW_ROOT/certs/clientcas.pem
ucentral.websocket.host.0.cas = $OWGW_ROOT/certs/cas
ucentral.websocket.host.0.address = *
ucentral.websocket.host.0.port = 15002
ucentral.websocket.host.0.security = strict
@@ -324,17 +324,17 @@ ucentral.websocket.maxreactors = 20
###### This is the end point for the devices when uploading files
```asm
ucentral.fileuploader.host.0.backlog = 100
ucentral.fileuploader.host.0.rootca = $UCENTRAL_ROOT/certs/restapi-ca.pem
ucentral.fileuploader.host.0.security = relaxed
ucentral.fileuploader.host.0.address = *
ucentral.fileuploader.host.0.name = 192.168.1.176
ucentral.fileuploader.host.0.port = 16003
ucentral.fileuploader.host.0.cert = $UCENTRAL_ROOT/certs/restapi-cert.pem
ucentral.fileuploader.host.0.key = $UCENTRAL_ROOT/certs/restapi-key.pem
ucentral.fileuploader.host.0.key.password = mypassword
ucentral.fileuploader.path = $UCENTRAL_ROOT/uploads
ucentral.fileuploader.maxsize = 10000
openwifi.fileuploader.host.0.backlog = 100
openwifi.fileuploader.host.0.rootca = $OWGW_ROOT/certs/restapi-ca.pem
openwifi.fileuploader.host.0.security = relaxed
openwifi.fileuploader.host.0.address = *
openwifi.fileuploader.host.0.name = 192.168.1.176
openwifi.fileuploader.host.0.port = 16003
openwifi.fileuploader.host.0.cert = $OWGW_ROOT/certs/restapi-cert.pem
openwifi.fileuploader.host.0.key = $OWGW_ROOT/certs/restapi-key.pem
openwifi.fileuploader.host.0.key.password = mypassword
openwifi.fileuploader.path = $OWGW_ROOT/uploads
openwifi.fileuploader.maxsize = 10000
```
###### host.0.address entries
@@ -343,7 +343,7 @@ the `*`. Using the `*` means all interfaces will be able to accept connections.
by changing the `0` to another index. You need to repeat the whole configuration block for each index. Indexes must be sequential
start at `0`.
###### ucentral.fileuploader.host.0.name
###### openwifi.fileuploader.host.0.name
This must point to the IP or FQDN of your uCentralGW.
#### Running the gateway
@@ -369,7 +369,7 @@ can be any of the keys you are already using. You must keep that keep secret and
this is the entry
```asm
ucentral.service.key = $UCENTRAL_ROOT/certs/websocket-key.pem
openwifi.service.key = $OWGW_ROOT/certs/websocket-key.pem
```
#### Command line options
@@ -391,7 +391,7 @@ A uCentral gateway implementation for TIP.
```
##### file
This allows you to point to another file without specifying the UCENTRAL_CONFIG variable. The file name must end in `.properties`.
This allows you to point to another file without specifying the UCENTRALGW_CONFIG variable. The file name must end in `.properties`.
##### daemon
Run this as a UNIX service
##### pidfile
@@ -440,9 +440,9 @@ then
exit 1
fi
if [[ ! -f ucentralgw.properties ]]
if [[ ! -f owgw.properties ]]
then
echo "Configuration file ucentralgw.properties is missing in the current directory"
echo "Configuration file owgw.properties is missing in the current directory"
exit 2
fi
@@ -452,15 +452,15 @@ docker run -d -p 15002:15002 \
--init \
--volume="$PWD:/ucentral-data" \
-e UCENTRAL_ROOT="/ucentral-data" \
-e UCENTRAL_CONFIG="/ucentral-data" \
-e UCENTRALGW_CONFIG="/ucentral-data" \
--name="ucentralgw" $DOCKER_NAME
```
Create yourself a directory and copy that script which you can also get from [here](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/docker_run.sh).
You must have the basic configuration file copied in the directory. This file must be called `ucentralgw.properties`. You can bring your own or
copy it from [here](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/ucentralgw.properties). Please look at [this](#certificates-with-docker) to have the right
certificates. You need to make sure that the names match the content of the `ucentralgw.properties`
You must have the basic configuration file copied in the directory. This file must be called `owgw.properties`. You can bring your own or
copy it from [here](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/owgw.properties). Please look at [this](#certificates-with-docker) to have the right
certificates. You need to make sure that the names match the content of the `owgw.properties`
file. Once all this is done, you can simply run `docker_run.sh`.
#### Docker installation directory layout
@@ -472,15 +472,15 @@ Run-time root
----- certs (same as above)
+---- logs (dir)
+---- uploads (dir)
+---- ucentralgw.properties (file)
+---- owgw.properties (file)
```
#### `ucentralgw.properties` for Docker
#### `owgw.properties` for Docker
If you use the pre-made configuration file, and you follow the directory layout, the only line you must change
is the following line:
```asm
ucentral.fileuploader.host.0.name = 192.168.1.176
openwifi.fileuploader.host.0.name = 192.168.1.176
```
This line should reflect the IP of your gateway or its FQDN. You must make sure that this name or IP is accessible
@@ -491,31 +491,13 @@ Please refer to the `certs` directory from the sections above.
#### Configuration with Docker
The configuration for this service is kept in a properties file. Currently, this configuration file must be kept in the
current directory of uCentral or one level up. This file is called `ucentralgw.properties` and you can see the latest version
[here](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/ucentralgw.properties). The file will be loaded from
the directory set by the environment variable `UCENTRAL_CONFIG`. To use environment variables in the configuration,
current directory of uCentral or one level up. This file is called `owgw.properties` and you can see the latest version
[here](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/owgw.properties). The file will be loaded from
the directory set by the environment variable `UCENTRALGW_CONFIG`. To use environment variables in the configuration,
you must use `$<varname>`. The path for the logs for the service must exist prior to starting the
service. The path is defined under `logging.channels.c2.path`. Only `path names` support the use of
environment variables. Here is a sample configuration:
### Docker Compose
The repository also contains a Docker Compose file, which you can use to instantiate a complete deployment of the uCentral microservices and related components for local development purposes. To spin up a local development environment:
1. Switch into the project directory with `cd docker-compose/`.
2. This repository contains a gateway certificate signed by TIP and a self-signed certificate for the REST API and other components which are used by default in the Compose deployment. The certificates are valid for the `*.wlan.local` domain and the Docker Compose uCentral microservice configs use `ucentral.wlan.local` as a hostname, so make sure you add an entry in your hosts file (or in your local DNS solution) which points to `127.0.0.1`.
3. If you have your own certificates and want to use the deployment for anything other than local development copy your certs into the `certs/` directory and reference them in the appropriate sections of the microservice configuration files. Make sure to also adapt the sections which reference the hostname. For more information on certificates please see the [certificates section](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw#certificates) of this README and/or [CERTIFICATES.md](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/CERTIFICATES.md).
4. Docker Compose pulls the microservice images from the JFrog repository. If you want to change the image tag or some of the image versions which are used for the other services, have a look into the `.env` file. You'll also find service specific `.env` files in this directory. Edit them if you want to change database passwords (highly recommended!) or other configuration data. Don't forget to adapt your changes in the application configuration files.
5. Open `docker-compose/ucentralgw-data/ucentral.properties` to change [authentication data](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw#default-username-and-password) for uCentralGW (again highly recommended!).
6. Spin up the deployment with `docker-compose up -d`.
7. Navigate to the UI which listens to `127.0.0.1` and login with your uCentralGW authentication data.
8. To use the [curl test script](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/TEST_CURL.md) to talk to the API set the following environment variables:
```
export UCENTRALSEC="ucentral.wlan.local:16001"
export FLAGS="-s --cacert docker-compose/ucentral-data/certs/restapi-ca.pem"
```
The `--cacert` option is necessary since the REST API certificates are self-signed. Omit the option if you provide your own signed certificates.
PS: The Docker Compose deployment creates five local volumes to persist mostly database data and data for Zookeeper and Kafka. If you want re-create the deployment and remove all persistent application and database data just delete the volumes with `docker volume rm $(docker volume ls -qf name=ucentral)` after you stopped the services with `docker-compose down`.
## uCentral communication protocol
The communication protocol between the device and the controller is detailed in this [document](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/PROTOCOL.md).
@@ -525,29 +507,29 @@ And here is [how to use it](https://github.com/Telecominfraproject/wlan-cloud-uc
## Using the API
In the `test_scripts` directory, you will find a series of scripts that will show you how to use the API
with [curl](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/TEST_CURL.md)
with [curl](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/CLI.md)
or [python](https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/main/TEST_PYTHON.md).
More scripts will be added in the future.
## Firewall Considerations
- The protocol uses TCP port 15002 between the devices and the gateway. This port must be opened.
- Devices use the TCP port 16003 to upload files. This port is configurable in the `ucentralgw.properties` file. Look for `ucentral.fileuploader.host.0.port`.
- The RESTAPI is accessed through TCP port 16002 by default. This port is configurable in the `ucentralgw.properties` file. Look for the entry `ucentral.restapi.host.0.port`.
- Devices use the TCP port 16003 to upload files. This port is configurable in the `owgw.properties` file. Look for `openwifi.fileuploader.host.0.port`.
- The RESTAPI is accessed through TCP port 16002 by default. This port is configurable in the `owgw.properties` file. Look for the entry `openwifi.restapi.host.0.port`.
## Kafka integration
So what about Kafka? Well, the gateway has basic integration with Kafka. It is turned off by default, to turn it on, in the configuration:
```asm
ucentral.kafka.enable = false
ucentral.kafka.brokerlist = 127.0.0.1:9092
ucentral.kafka.commit = false
ucentral.kafka.queue.buffering.max.ms = 50
openwifi.kafka.enable = false
openwifi.kafka.brokerlist = 127.0.0.1:9092
openwifi.kafka.commit = false
openwifi.kafka.queue.buffering.max.ms = 50
```
#### `ucentral.kafka.enable`
#### `openwifi.kafka.enable`
Kind of obvious but hey, set `true` or `false`. Default is `false`
#### `ucentral.kafka.brokerlist`
#### `openwifi.kafka.brokerlist`
This is a comma separator list of the brokers in your `kafka` deployment.
#### Kafka topics

2
build
View File

@@ -1 +1 @@
113
74

View File

@@ -84,8 +84,9 @@
<Option type="1"/>
<Option compiler="gcc"/>
<Compiler>
<Add option="-DAPP_VERSION=&quot;0.4.0&quot;"/>
<Add option="-DBUILD_NUMBER=&quot;61&quot;"/>
<Add option="-DAPP_VERSION=&quot;0.7.0&quot;"/>
<Add option="-DBUILD_NUMBER=&quot;120&quot;"/>
<Add option="-DTIP_GATEWAY_SERVICE=&quot;1&quot;"/>
<Add option="-D_DEBUG"/>
<Add option="-DPOCO_ENABLE_CPP14"/>
<Add option="-DPOCO_ENABLE_CPP11"/>
@@ -98,6 +99,7 @@
<Add option="-DBOOST_ALL_NO_LIB"/>
<Add directory="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src"/>
<Add directory="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/include/kafka"/>
<Add directory="/usr/local/opt/mysql-client/include"/>
<Add directory="/usr/local/include"/>
<Add directory="/usr/local/opt/openssl/include"/>
<Add directory="/usr/local/opt/mysql-client/include/mysql"/>
@@ -121,8 +123,9 @@
<Option type="1"/>
<Option compiler="gcc"/>
<Compiler>
<Add option="-DAPP_VERSION=&quot;0.4.0&quot;"/>
<Add option="-DBUILD_NUMBER=&quot;61&quot;"/>
<Add option="-DAPP_VERSION=&quot;0.7.0&quot;"/>
<Add option="-DBUILD_NUMBER=&quot;120&quot;"/>
<Add option="-DTIP_GATEWAY_SERVICE=&quot;1&quot;"/>
<Add option="-D_DEBUG"/>
<Add option="-DPOCO_ENABLE_CPP14"/>
<Add option="-DPOCO_ENABLE_CPP11"/>
@@ -135,6 +138,7 @@
<Add option="-DBOOST_ALL_NO_LIB"/>
<Add directory="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src"/>
<Add directory="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/include/kafka"/>
<Add directory="/usr/local/opt/mysql-client/include"/>
<Add directory="/usr/local/include"/>
<Add directory="/usr/local/opt/openssl/include"/>
<Add directory="/usr/local/opt/mysql-client/include/mysql"/>
@@ -155,16 +159,106 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/build">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/ALBHealthCheckServer.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/AuthClient.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/AuthClient.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/CentralConfig.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/CentralConfig.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/CommandChannel.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/CommandChannel.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/CommandManager.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/CommandManager.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/Daemon.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/Daemon.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/DeviceRegistry.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/DeviceRegistry.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/FileUploader.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/FileUploader.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/KafkaManager.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/KafkaManager.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/Kafka_topics.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/MicroService.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/MicroService.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/OUIServer.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/OUIServer.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/OpenAPIRequest.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/OpenAPIRequest.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_BlackList.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_BlackList.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_callback.cpp">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_GWobjects.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_callback.h">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_GWobjects.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_InternalServer.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_InternalServer.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_RPC.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_RPC.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_SecurityObjects.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_SecurityObjects.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_command.cpp">
@@ -221,16 +315,13 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_handler.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_oauth2Handler.cpp">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_ouis.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_oauth2Handler.h">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_ouis.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_objects.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_objects.h">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_protocol.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_server.cpp">
@@ -245,16 +336,46 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_system_command.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_unknownRequestHandler.cpp">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_utils.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_unknownRequestHandler.h">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/RESTAPI_utils.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/kafka_service.cpp">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/StateProcessor.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/kafka_service.h">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/StateProcessor.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/StorageArchiver.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/StorageArchiver.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/StorageService.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/StorageService.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/SubSystemServer.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/SubSystemServer.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/Utils.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/Utils.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/WebSocketServer.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/WebSocketServer.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_blacklist.cpp">
@@ -272,13 +393,10 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_device.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_firmware_updates.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_healthcheck.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_identity.cpp">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_lifetime_stats.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_logs.cpp">
@@ -287,9 +405,6 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_mysql.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_odbc.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_pgql.cpp">
<Option target="ucentralgw"/>
</Unit>
@@ -302,82 +417,10 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/storage_tables.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uAuthService.cpp">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCentralProtocol.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uAuthService.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCallbackManager.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCallbackManager.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCentral.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCentral.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCentralConfig.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCentralConfig.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCentralWebSocketServer.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCentralWebSocketServer.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCommandChannel.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCommandChannel.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCommandManager.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCommandManager.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uDeviceRegistry.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uDeviceRegistry.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uFileUploader.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uFileUploader.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uFirmwareManager.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uFirmwareManager.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uStorageService.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uStorageService.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uSubSystemServer.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uSubSystemServer.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uUtils.cpp">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uUtils.h">
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/src/uCentralTypes.h">
<Option target="ucentralgw"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/CMakeLists.txt">
@@ -440,12 +483,6 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoCryptoConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoCryptoTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoCryptoTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoCryptoTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
@@ -464,48 +501,18 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataMySQLConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataMySQLTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataMySQLTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataMySQLTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataMySQLTargets.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataODBCConfig.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataODBCConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataODBCTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataODBCTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataODBCTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataODBCTargets.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataPostgreSQLConfig.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataPostgreSQLConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataPostgreSQLTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataPostgreSQLTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataPostgreSQLTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
@@ -518,24 +525,12 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataSQLiteConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataSQLiteTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataSQLiteTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataSQLiteTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataSQLiteTargets.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoDataTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
@@ -548,12 +543,6 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoFoundationConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoFoundationTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoFoundationTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoFoundationTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
@@ -566,12 +555,6 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoJSONConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoJSONTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoJSONTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoJSONTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
@@ -584,12 +567,6 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoJWTConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoJWTTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoJWTTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoJWTTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
@@ -608,24 +585,12 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoNetSSLConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoNetSSLTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoNetSSLTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoNetSSLTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoNetSSLTargets.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoNetTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoNetTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoNetTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
@@ -638,12 +603,6 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoUtilConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoUtilTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoUtilTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoUtilTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
@@ -656,12 +615,6 @@
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoXMLConfigVersion.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoXMLTargets-debug.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoXMLTargets-release.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>
<Unit filename="/Users/stephb/Desktop/Dropbox/clion/wlan-cloud-ucentralgw/../../../../../../usr/local/lib/cmake/Poco/PocoXMLTargets-relwithdebinfo.cmake">
<Option virtualFolder="CMake Files\..\..\..\..\..\..\usr\local\lib\cmake\Poco\"/>
</Unit>

View File

@@ -1,9 +0,0 @@
COMPOSE_PROJECT_NAME=ucentral
POSTGRES_TAG=latest
MYSQL_TAG=latest
UCENTRALGW_TAG=master
UCENTRALGWUI_TAG=main
UCENTRALSEC_TAG=main
RTTYS_TAG=3.6.0
KAFKA_TAG=latest
ZOOKEEPER_TAG=latest

View File

@@ -1,2 +0,0 @@
KAFKA_CFG_ZOOKEEPER_CONNECT=zookeeper:2181
ALLOW_PLAINTEXT_LISTENER=yes

View File

@@ -1,4 +0,0 @@
MYSQL_ROOT_PASSWORD=root
MYSQL_USER=rttys
MYSQL_PASSWORD=rttys
MYSQL_DATABASE=rttys

View File

@@ -1,5 +0,0 @@
POSTGRES_PASSWORD=ucentralgw
POSTGRES_USER=ucentralgw
UCENTRALSEC_DB=ucentralsec
UCENTRALSEC_DB_USER=ucentralsec
UCENTRALSEC_DB_PASSWORD=ucentralsec

View File

@@ -1,2 +0,0 @@
UCENTRALGW_ROOT=/ucentralgw-data
UCENTRALGW_CONFIG=/ucentralgw-data

View File

@@ -1,2 +0,0 @@
DEFAULT_UCENTRALSEC_URL=https://ucentral.wlan.local:16001
ALLOW_UCENTRALSEC_CHANGE=false

View File

@@ -1,2 +0,0 @@
UCENTRALSEC_ROOT=/ucentralsec-data
UCENTRALSEC_CONFIG=/ucentralsec-data

View File

@@ -1,10 +0,0 @@
#!/usr/bin/env bash
set -e
SERVICES="ucentralgw.wlan.local ucentralsec.wlan.local"
for i in $SERVICES; do
docker-compose exec $i apk add ca-certificates
docker cp certs/restapi-ca.pem ucentral_$i\_1:/usr/local/share/ca-certificates/
docker-compose exec $i update-ca-certificates
done

View File

@@ -1,3 +0,0 @@
*
!.gitignore
!cas/

View File

@@ -1,2 +0,0 @@
*
!.gitignore

View File

@@ -1,18 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIC4DCCAcgCCQC7oc+4dT4WlTANBgkqhkiG9w0BAQsFADAyMQswCQYDVQQGEwJD
QTEMMAoGA1UECgwDVElQMRUwEwYDVQQDDAwqLndsYW4ubG9jYWwwHhcNMjEwNzA3
MDkyOTAxWhcNMzEwNzA1MDkyOTAxWjAyMQswCQYDVQQGEwJDQTEMMAoGA1UECgwD
VElQMRUwEwYDVQQDDAwqLndsYW4ubG9jYWwwggEiMA0GCSqGSIb3DQEBAQUAA4IB
DwAwggEKAoIBAQD67KEKKHj1xyj0Sc+/WSFeXluhp+76V/8njnGcTus8IsaHWeAj
O1T1/PnqNMNP3CSgCpAZRn7Eom33HH89pC7iIE5t3aGrFzxZ6AxFgECUCkby1j9D
j7PawapJ7XNqT4P4ZGEGOWlLGE9oUpF2pr3B3jBwmV9t9d/Zp8na23K7rnsr5kNn
RXp6iPNPpynppNQFBwzsovyhu9tzk/zz3gohSY9f6oyNNaKcZwN/yrG4B8FnRfa7
WFNvkPi5zAjJ3oEXMp+Im2/SvSqzptYwZhplb14ILZ5ClkSwAslG8FiOAzXr887r
hgEPzqP6SNIOwy/B/AMOFQl6wPvXBwz9eNW1AgMBAAEwDQYJKoZIhvcNAQELBQAD
ggEBAA8Oa8jannqNRdqOuY460Pum1B61kGmf2OK2ZiMaddlxqL3ZBdXPqF02hwSd
q6uxCVP5NgvqSm+pTHaDcODJiCBrMmGQqHT82LuoCyk1BMqH/PYm+kfazPhKF31x
Me7E47DQzk4tMyV28HBCHH6UicQ05ryT1yBfmj8JmYNx9ezmJcanu0/eyI2Lv8Ar
Y7mrgblfOUnsif2w/aUaOsoY1t6/ThgTBc3BTMtUXXAcMiPLu4mSdN6nCm75Qp5q
4zl/SNPjLnmtpHhLDtr4swf6vZw0RG7ECCf6Av8lv8mJG6g53YM8jfe0EzLqbAFf
iSuQbt5n6lMWVgv+FKwXjwAda+Q=
-----END CERTIFICATE-----

View File

@@ -1,18 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIC4DCCAcgCCQC7oc+4dT4WlTANBgkqhkiG9w0BAQsFADAyMQswCQYDVQQGEwJD
QTEMMAoGA1UECgwDVElQMRUwEwYDVQQDDAwqLndsYW4ubG9jYWwwHhcNMjEwNzA3
MDkyOTAxWhcNMzEwNzA1MDkyOTAxWjAyMQswCQYDVQQGEwJDQTEMMAoGA1UECgwD
VElQMRUwEwYDVQQDDAwqLndsYW4ubG9jYWwwggEiMA0GCSqGSIb3DQEBAQUAA4IB
DwAwggEKAoIBAQD67KEKKHj1xyj0Sc+/WSFeXluhp+76V/8njnGcTus8IsaHWeAj
O1T1/PnqNMNP3CSgCpAZRn7Eom33HH89pC7iIE5t3aGrFzxZ6AxFgECUCkby1j9D
j7PawapJ7XNqT4P4ZGEGOWlLGE9oUpF2pr3B3jBwmV9t9d/Zp8na23K7rnsr5kNn
RXp6iPNPpynppNQFBwzsovyhu9tzk/zz3gohSY9f6oyNNaKcZwN/yrG4B8FnRfa7
WFNvkPi5zAjJ3oEXMp+Im2/SvSqzptYwZhplb14ILZ5ClkSwAslG8FiOAzXr887r
hgEPzqP6SNIOwy/B/AMOFQl6wPvXBwz9eNW1AgMBAAEwDQYJKoZIhvcNAQELBQAD
ggEBAA8Oa8jannqNRdqOuY460Pum1B61kGmf2OK2ZiMaddlxqL3ZBdXPqF02hwSd
q6uxCVP5NgvqSm+pTHaDcODJiCBrMmGQqHT82LuoCyk1BMqH/PYm+kfazPhKF31x
Me7E47DQzk4tMyV28HBCHH6UicQ05ryT1yBfmj8JmYNx9ezmJcanu0/eyI2Lv8Ar
Y7mrgblfOUnsif2w/aUaOsoY1t6/ThgTBc3BTMtUXXAcMiPLu4mSdN6nCm75Qp5q
4zl/SNPjLnmtpHhLDtr4swf6vZw0RG7ECCf6Av8lv8mJG6g53YM8jfe0EzLqbAFf
iSuQbt5n6lMWVgv+FKwXjwAda+Q=
-----END CERTIFICATE-----

View File

@@ -1,28 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQD67KEKKHj1xyj0
Sc+/WSFeXluhp+76V/8njnGcTus8IsaHWeAjO1T1/PnqNMNP3CSgCpAZRn7Eom33
HH89pC7iIE5t3aGrFzxZ6AxFgECUCkby1j9Dj7PawapJ7XNqT4P4ZGEGOWlLGE9o
UpF2pr3B3jBwmV9t9d/Zp8na23K7rnsr5kNnRXp6iPNPpynppNQFBwzsovyhu9tz
k/zz3gohSY9f6oyNNaKcZwN/yrG4B8FnRfa7WFNvkPi5zAjJ3oEXMp+Im2/SvSqz
ptYwZhplb14ILZ5ClkSwAslG8FiOAzXr887rhgEPzqP6SNIOwy/B/AMOFQl6wPvX
Bwz9eNW1AgMBAAECggEAZdJT3u1heEqjAc5Z8QnYEpUzlbuxrAC9V23kCEu2BScP
bKk53NIcvd00BKf4gZWRfygKJVeH5X8MJHR55aeUJsp5SPfgvK6nHMye/iz3B5vM
AoqSDXZow2JHGcyzQvaVVNxWytHNOl3ZCzpGMOGkquDgwzBZmyNk/Muri5X1TtbH
DgeYdht2YiHqHdGWsLNU1vZAgzlwD8fXg65XOmNehjWnowhpNRCgpcDeJCtEuNzt
6iXFWffjO6YTbVnoM5xhLROjLv6gYP4wxsQSZc/NGz9Jow7VxlYZg9wCE75bduFn
7D5O4OgVgPgYbyCutpB/o4PMNURb4V/5p2OAEgLX2QKBgQD+kHYRAaawRbaY4jGf
isj0oh2C/Z99Mqf/nnpPwmUwrhpmnQ+pRdWBw940tPrEpVoOcCPWQ5hO1zUET18d
xQqs3zd6lEhJogmMqkjOT670YBEX/wyALd3M5F3HT/K2aixL1XaCCpAl97JB9RyB
zGIr5c+mIOVK/uYrlFO28thXzwKBgQD8VumZIYZpWeE7pTyCg0PcDYlNATA/VKoD
9YrGqEEHGgFNJEWj8Xj8aqBzaPoUk+eGp7NfSoOchVM+Bf3ktWy5doZCmNuxlOyq
Ix5yrB2jyYceaSf2nxHqlD2VhKB/YJx0yTU1UkB5dG4nYnqiUg7c5JeQOVzwFKm1
t6/Hk/cXOwKBgGT+yWjL3+cVcXFMZGWouTudSdobZ3hTbaWTqXEVbfIXUPAfJgSB
aUi3feQpXUhBVe5efUlXvgihhy4zk0gLUcXuNWOTiu5ztBgzwvjfUkkwB/geP0Zn
bBULEU2vIVtP2k0n3oGPUUtO71ENvwacIOLLpUuCx5WudYEasu/lfwGvAoGBAOiE
manuF3HaTU3tu20z0YLiwkK/tpqUxDjzuBXIEmudzdcsdjNUHbzR79mIwO/XPf95
ZjKHcfD3dbXwRXzKpE3dZmfVfJMM/GrmA3d9G67B04z1Lsr01siGIp004cOd3W1L
vojMqvZ/j8Ug3InX/TQUO4i9IuNi1uLISOQpdwTjAoGAG33swIFnH/mz7ubu8wfE
9nwe8NNf56kbFBG2FMuHvo8GYj0sqylwtZnh4TCwlTzqUO8e6oFdK8Ot6z7H9Fa3
vnDD2WRwEFydRP5fbW5eFmGbzLfHlzUY+Do81qrUMF47LEN94X7yaXdb/vNW57lp
K9hGF1Bdk8089Knm3l1Fc4w=
-----END PRIVATE KEY-----

View File

@@ -1,27 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIEgDCCA2igAwIBAgIUaKVB2xg9gr/sS6FvzMex0xSbEzswDQYJKoZIhvcNAQEL
BQAwbDELMAkGA1UEBhMCVVMxJDAiBgNVBAoTG1RlbGVjb20gSW5mcmEgUHJvamVj
dCwgSW5jLjEMMAoGA1UECxMDVElQMSkwJwYDVQQDEyBUZWxlY29tIEluZnJhIFBy
b2plY3QgSXNzdWluZyBDQTAeFw0yMTA3MDgxMDQ5MTVaFw0yNTA3MDgxMDQ5MTVa
MDIxCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNUSVAxFTATBgNVBAMMDCoud2xhbi5s
b2NhbDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL2rlMfV7/Si2Svx
J1YOEz6KJLvey995/0MkQvAG0RM6TpFwgUNnpYFFozcWME8MGSxws+6hOzDoMmHC
pgpP/KZ/Fyu9iUdzTxsJMyMxIW9sYbBMkQgBmvjkBlXDk5NfHh+yJBVxb7JlJ6vJ
oT7EJMzgKpYpFnO+bddalUVsDp3qQIjSvJIxl77vwgZQUJx0qCm17VTBhyM2RTJ3
jtr7kcWDm3jyyTVUvlM9g3DM9g0hUPMN0R5PP2HuqDdtYoY51krsm2mmVIYYnyAN
BDawmwYnZJfcC4gFzZJ5wK5NFjSKmd1mYp0damlSh0/uHxPyd4rm2QhUCQH92yKM
+9qYU70CAwEAAaOCAVIwggFOMAwGA1UdEwEB/wQCMAAwHQYDVR0OBBYEFM0mIZuE
6aly7ZKXl0KWjprcO9/uMB8GA1UdIwQYMBaAFLMbVLjgR6s98ziA5Dzl/QBhbdHo
MA4GA1UdDwEB/wQEAwIFoDAWBgNVHSUBAf8EDDAKBggrBgEFBQcDATCBhgYIKwYB
BQUHAQEEejB4MCgGCCsGAQUFBzABhhxodHRwOi8vb2NzcC5vbmUuZGlnaWNlcnQu
Y29tMEwGCCsGAQUFBzAChkBodHRwOi8vY2FjZXJ0cy5vbmUuZGlnaWNlcnQuY29t
L1RlbGVjb21JbmZyYVByb2plY3RJc3N1aW5nQ0EuY3J0ME0GA1UdHwRGMEQwQqBA
oD6GPGh0dHA6Ly9jcmwub25lLmRpZ2ljZXJ0LmNvbS9UZWxlY29tSW5mcmFQcm9q
ZWN0SXNzdWluZ0NBLmNybDANBgkqhkiG9w0BAQsFAAOCAQEAAyb7X9qW0z0QJrl2
oAalMCh/gSJy5oER3L7iu/pnP3GREbr6bh6+1/MAf2bgnN2CUOKQHbozB7yCkM6V
8m5RnL4ePKVP5yIrbs48uM5Hl14QFLU4ZtFao6js0haoWWEgMo3sfbeyfOU0ScyW
ET5zfbDub3gUbWYmlz6hyV5aJoznaFjJTNP7SRQ9CHMTMHh3wAPfVlvG2TdcwwbM
ZKkdAHpl1NwRxyiBPJfkejGWrY3ZAs10te7u9Lsc9yZZKL8SU9J/mrO9tM5HLeUr
nCJN4RI7RyTuDw4LdMZW1Ju5QBXoZL9mj4KXIbUkDwryhbAxdQ1OnwD4O/avMChk
TNJzIw==
-----END CERTIFICATE-----

View File

@@ -1,28 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC9q5TH1e/0otkr
8SdWDhM+iiS73svfef9DJELwBtETOk6RcIFDZ6WBRaM3FjBPDBkscLPuoTsw6DJh
wqYKT/ymfxcrvYlHc08bCTMjMSFvbGGwTJEIAZr45AZVw5OTXx4fsiQVcW+yZSer
yaE+xCTM4CqWKRZzvm3XWpVFbA6d6kCI0rySMZe+78IGUFCcdKgpte1UwYcjNkUy
d47a+5HFg5t48sk1VL5TPYNwzPYNIVDzDdEeTz9h7qg3bWKGOdZK7JtpplSGGJ8g
DQQ2sJsGJ2SX3AuIBc2SecCuTRY0ipndZmKdHWppUodP7h8T8neK5tkIVAkB/dsi
jPvamFO9AgMBAAECggEBAJgYoaRmcJfShyhvp8WgX9pE2RQ2o3I/2Gy1BWCJdtte
ZGbIuz+cO+IgP7QK/Q5Ge2Fht0hizp53dP9kIdYfMlEplSEkSpObahIaHIHaAh/h
36yKmbq73tQ7tsDLpuoE2pk8Nydi4dlCuL9PXxiAHaqVEFF9/V0vldGd+BnFfyst
retXgockCH+fqddM5Kp+H0bmjXzLke/b8T9KsdSBz7lg1Z67kmMrHLe14Q4Hgmr/
pFBkGGWKTFn48OXfncrv+oQAGED7r9c5UEdpOB6SBDxuddfzgkw9urnpKrYC/KOs
HLBTaGew73O81BsbaZlUiVxTdewrmFk2nG6UIPoGaxkCgYEA7IYOjIfNJOEPIWYP
zj4eipTy6zFk4L7tX3wX4wsor93rz8ArlF8sgNoyUhbKm6H++ZfVezLs2jcjJJ8Q
sXLwQ6L/D8aVb6AOVeC1WYJu5+wXIDX0H+1318a5+3bKVPn+hktJGEgCBvplVRnh
yzpQ+2v1SBp9qEzoSl1sV6gm1tsCgYEAzUnZcjUhHvoXLXJ1lfagCC6QsmjqzpJv
VdTKJlDuZ0qQGC6Ts+wKfM3MoiOsXW0pByC5lWwE43c/KU8J358j3OSSNafIFeD1
cxtYzJlMgnw5Y2Zt9tj+QW/1BOMdOftnPSOnsk6rpdCBMW6a2tYubJjbAuge+a2O
939XGnV0R0cCgYEA0bvmNtNNJAC2LAWWymnnJzgBWHFKZMipMNyXSethPuHo8yYS
/tSOYAwcRxKSwwMZWDY9RavYv3/ZF+Y9JT0otLFav6B2bq9dRuWlqiOxONLvhs6R
Faa7eIlt7gBeVpAAFRG5VWC0+38aUCZNRKsHmIsYy8FB3/Winh7NrcUb+7UCgYBi
egCTZqUixPmFVZjOfWY7Rosm6mlo+pnp5I+sXbpfVkdVMlKsRpipUdfOF6rBjnHV
937PDOgzbaqg2Ed2PFLpzcPNdVToGefkdcPdMdSf65Nj+WjatzEQlvJEi+YjQFQ/
4fC5+j8g5apz2gjy3Teb5J96/3qMbxNb6nwQNzO2VQKBgHyHUJOrhvv9+vs7v8nu
9DgV0b5eNO0g6Q4Ji7oqs24PssPQRA4gMtwmPT8Ha+wWGVzQt2U5LmjsLlrqAO6O
+Fa3c63sgmt672A8BJ3PL8LI8E2keZiH6rwADSUFp3TZoU2SHamw5NEruNRMIF1R
0LMsuAs2KEdnwAth2ZmUF2+S
-----END PRIVATE KEY-----

View File

@@ -1,120 +0,0 @@
version: '3'
volumes:
postgresql_data:
driver: local
mysql_data:
driver: local
zookeeper_data:
driver: local
zookeeper_datalog:
driver: local
kafka_data:
driver: local
services:
postgresql:
image: "postgres:${POSTGRES_TAG}"
env_file:
- .env_postgresql
restart: unless-stopped
volumes:
- postgresql_data:/var/lib/postgresql/data
- ./init-ucentralsec-db.sh:/docker-entrypoint-initdb.d/init-ucentralsec-db.sh
mysql:
image: "mysql:${MYSQL_TAG}"
env_file:
- .env_mysql
restart: unless-stopped
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
volumes:
- mysql_data:/var/lib/mysql
ucentralgw.wlan.local:
image: "tip-tip-wlan-cloud-ucentral.jfrog.io/ucentralgw:${UCENTRALGW_TAG}"
env_file:
- .env_ucentralgw
depends_on:
- postgresql
- kafka
- rttys
restart: unless-stopped
ports:
- "127.0.0.1:15002:15002"
- "127.0.0.1:16002:16002"
- "127.0.0.1:16003:16003"
- "127.0.0.1:16102:16102"
volumes:
- ./ucentralgw-data:/ucentralgw-data
- ./certs:/ucentralgw-data/certs
- ../certificates/root.pem:/ucentralgw-data/certs/root.pem
- ../certificates/issuer.pem:/ucentralgw-data/certs/issuer.pem
- ../certificates/clientcas.pem:/ucentralgw-data/certs/clientcas.pem
ucentralgw-ui:
image: "tip-tip-wlan-cloud-ucentral.jfrog.io/ucentralgw-ui:${UCENTRALGWUI_TAG}"
env_file:
- .env_ucentralgw-ui
depends_on:
- ucentralgw.wlan.local
restart: unless-stopped
ports:
- "127.0.0.1:80:80"
ucentralsec.wlan.local:
image: "tip-tip-wlan-cloud-ucentral.jfrog.io/ucentralsec:${UCENTRALSEC_TAG}"
env_file:
- .env_ucentralsec
depends_on:
- postgresql
- kafka
- rttys
- ucentralgw.wlan.local
restart: unless-stopped
ports:
- "127.0.0.1:16001:16001"
- "127.0.0.1:16101:16101"
volumes:
- ./ucentralsec-data:/ucentralsec-data
- ./certs:/ucentralsec-data/certs
- ../certificates/root.pem:/ucentralsec-data/certs/root.pem
- ../certificates/issuer.pem:/ucentralsec-data/certs/issuer.pem
- ../certificates/clientcas.pem:/ucentralsec-data/certs/clientcas.pem
ucentralgw-ui:
image: "tip-tip-wlan-cloud-ucentral.jfrog.io/ucentralgw-ui:${UCENTRALGWUI_TAG}"
env_file:
- .env_ucentralgw-ui
depends_on:
- ucentralgw
restart: unless-stopped
ports:
- "127.0.0.1:80:80"
rttys:
image: "tip-tip-wlan-cloud-ucentral.jfrog.io/rttys:${RTTYS_TAG}"
depends_on:
- mysql
restart: unless-stopped
volumes:
- ./certs/restapi-cert.pem:/etc/rttys/restapi-cert.pem
- ./certs/restapi-key.pem:/etc/rttys/restapi-key.pem
- ./rttys/rttys.conf:/rttys/rttys.conf
zookeeper:
image: "zookeeper:${ZOOKEEPER_TAG}"
restart: unless-stopped
volumes:
- zookeeper_data:/data
- zookeeper_datalog:/datalog
kafka:
image: "docker.io/bitnami/kafka:${KAFKA_TAG}"
env_file:
- .env_kafka
restart: unless-stopped
depends_on:
- zookeeper
volumes:
- kafka_data:/bitnami/kafka

View File

@@ -1,8 +0,0 @@
#!/bin/bash
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
CREATE USER $UCENTRALSEC_DB_USER WITH ENCRYPTED PASSWORD '$UCENTRALSEC_DB_PASSWORD';
CREATE DATABASE $UCENTRALSEC_DB;
GRANT ALL PRIVILEGES ON DATABASE $UCENTRALSEC_DB TO $UCENTRALSEC_DB_USER;
EOSQL

View File

@@ -1,18 +0,0 @@
addr-dev: :5912
addr-user: :5913
#addr-web: :5914
#web-redir-url:# Auth for http
http-username: rttys
http-password: rttys
ssl-cert: /etc/rttys/restapi-cert.pem
ssl-key: /etc/rttys/restapi-key.pem
token: 96181c567b4d0d98c50f127230068fa8
# font-size: 16
# No login required to connect device.
# Values can be device IDs separated by spaces,
# or a "*" indicates that all devices do not require login
# http://localhost:5913/connect/rtty1
white-list: "*"
#white-list: rtty1 rtty2
# mysql database source
db: rttys:rttys@tcp(mysql)/rttys

View File

@@ -1,181 +0,0 @@
#
# uCentral protocol server for devices. This is where you point
# all your devices. You can replace the * for address by the specific
# address of one of your interfaces
#
ucentral.websocket.host.0.backlog = 500
ucentral.websocket.host.0.rootca = $UCENTRALGW_ROOT/certs/root.pem
ucentral.websocket.host.0.issuer = $UCENTRALGW_ROOT/certs/issuer.pem
ucentral.websocket.host.0.cert = $UCENTRALGW_ROOT/certs/websocket-cert.pem
ucentral.websocket.host.0.key = $UCENTRALGW_ROOT/certs/websocket-key.pem
ucentral.websocket.host.0.clientcas = $UCENTRALGW_ROOT/certs/clientcas.pem
ucentral.websocket.host.0.cas = $UCENTRALGW_ROOT/certs/cas
ucentral.websocket.host.0.address = *
ucentral.websocket.host.0.port = 15002
ucentral.websocket.host.0.security = strict
ucentral.websocket.host.0.key.password = mypassword
ucentral.websocket.maxreactors = 20
#
# REST API access
#
ucentral.restapi.host.0.backlog = 100
ucentral.restapi.host.0.security = relaxed
ucentral.restapi.host.0.rootca = $UCENTRALGW_ROOT/certs/restapi-ca.pem
ucentral.restapi.host.0.address = *
ucentral.restapi.host.0.port = 16002
ucentral.restapi.host.0.cert = $UCENTRALGW_ROOT/certs/restapi-cert.pem
ucentral.restapi.host.0.key = $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.restapi.host.0.key.password = mypassword
ucentral.internal.restapi.host.0.backlog = 100
ucentral.internal.restapi.host.0.security = relaxed
ucentral.internal.restapi.host.0.rootca = $UCENTRALGW_ROOT/certs/restapi-ca.pem
ucentral.internal.restapi.host.0.address = *
ucentral.internal.restapi.host.0.port = 17002
ucentral.internal.restapi.host.0.cert = $UCENTRALGW_ROOT/certs/restapi-cert.pem
ucentral.internal.restapi.host.0.key = $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.internal.restapi.host.0.key.password = mypassword
#
# Used to upload files to the service.
# You should replace the 'name' vaalue with the IP address of your gateway or an FQDN
# that your devices can reach
#
ucentral.fileuploader.host.0.backlog = 100
ucentral.fileuploader.host.0.rootca = $UCENTRALGW_ROOT/certs/restapi-ca.pem
ucentral.fileuploader.host.0.security = relaxed
ucentral.fileuploader.host.0.address = *
ucentral.fileuploader.host.0.name = ucentral.wlan.local
ucentral.fileuploader.host.0.port = 16003
ucentral.fileuploader.host.0.cert = $UCENTRALGW_ROOT/certs/restapi-cert.pem
ucentral.fileuploader.host.0.key = $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.fileuploader.host.0.key.password = mypassword
ucentral.fileuploader.path = $UCENTRALGW_ROOT/uploads
ucentral.fileuploader.maxsize = 10000
#
# Generic section that all microservices must have
#
ucentral.service.key = $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.system.data = $UCENTRALGW_ROOT/data
ucentral.system.debug = true
ucentral.system.uri.private = https://ucentralgw.wlan.local:17002
ucentral.system.uri.public = https://ucentral.wlan.local:16002
ucentral.system.commandchannel = /tmp/app.ucentralgw
#
# Gateway Microservice Specific Section
#
ucentral.autoprovisioning = true
ucentral.devicetypes.0 = AP:linksys_ea8300,edgecore_eap101,linksys_e8450-ubi
ucentral.devicetypes.1 = SWITCH:edgecore_ecs4100-12ph
ucentral.devicetypes.2 = IOT:esp32
oui.download.uri = https://linuxnet.ca/ieee/oui.txt
firmware.autoupdate.policy.default = auto
#
# rtty
#
rtty.enabled = true
rtty.server = rttys
rtty.port = 5912
rtty.token = 96181c567b4d0d98c50f127230068fa8
rtty.timeout = 60
rtty.viewport = 5913
#############################
# Generic information for all micro services
#############################
#
# NLB Support
#
alb.enable = true
alb.port = 16102
oui.download.uri = https://linuxnet.ca/ieee/oui.txt
#
# Kafka
#
ucentral.kafka.group.id = gateway
ucentral.kafka.client.id = gateway1
ucentral.kafka.enable = true
# ucentral.kafka.brokerlist = a1.arilia.com:9092
ucentral.kafka.brokerlist = kafka:9092
ucentral.kafka.auto.commit = false
ucentral.kafka.queue.buffering.max.ms = 50
#
# This section select which form of persistence you need
# Only one selected at a time. If you select multiple, this service will die if a horrible
# death and might make your beer flat.
#
#storage.type = sqlite
storage.type = postgresql
#storage.type = mysql
#storage.type = odbc
storage.type.sqlite.db = devices.db
storage.type.sqlite.idletime = 120
storage.type.sqlite.maxsessions = 128
storage.type.postgresql.maxsessions = 64
storage.type.postgresql.idletime = 60
storage.type.postgresql.host = postgresql
storage.type.postgresql.username = ucentralgw
storage.type.postgresql.password = ucentralgw
storage.type.postgresql.database = ucentralgw
storage.type.postgresql.port = 5432
storage.type.postgresql.connectiontimeout = 60
storage.type.mysql.maxsessions = 64
storage.type.mysql.idletime = 60
storage.type.mysql.host = localhost
storage.type.mysql.username = stephb
storage.type.mysql.password = snoopy99
storage.type.mysql.database = ucentral
storage.type.mysql.port = 3306
storage.type.mysql.connectiontimeout = 60
########################################################################
########################################################################
#
# Logging: please leave as is for now.
#
########################################################################
logging.formatters.f1.class = PatternFormatter
logging.formatters.f1.pattern = %Y-%m-%d %H:%M:%S %s: [%p] %t
logging.formatters.f1.times = UTC
logging.channels.c1.class = ConsoleChannel
logging.channels.c1.formatter = f1
# This is where the logs will be written. This path MUST exist
logging.channels.c2.class = FileChannel
logging.channels.c2.path = $UCENTRALGW_ROOT/logs/log
logging.channels.c2.formatter.class = PatternFormatter
logging.channels.c2.formatter.pattern = %Y-%m-%d %H:%M:%S %s: [%p] %t
logging.channels.c2.rotation = 20 M
logging.channels.c2.archive = timestamp
logging.channels.c2.purgeCount = 20
logging.channels.c3.class = ConsoleChannel
logging.channels.c3.pattern = %s: [%p] %t
# External Channel
logging.loggers.root.channel = c1
logging.loggers.root.level = debug
# Inline Channel with PatternFormatter
# logging.loggers.l1.name = logger1
# logging.loggers.l1.channel.class = ConsoleChannel
# logging.loggers.l1.channel.pattern = %s: [%p] %t
# logging.loggers.l1.level = information
# SplitterChannel
# logging.channels.splitter.class = SplitterChannel
# logging.channels.splitter.channels = l1,l2
# logging.loggers.l2.name = logger2
# logging.loggers.l2.channel = splitter

View File

@@ -1,145 +0,0 @@
#
# uCentral protocol server for devices. This is where you point
# all your devices. You can replace the * for address by the specific
# address of one of your interfaces
#
#
# REST API access
#
ucentral.restapi.host.0.backlog = 100
ucentral.restapi.host.0.security = relaxed
ucentral.restapi.host.0.rootca = $UCENTRALSEC_ROOT/certs/restapi-ca.pem
ucentral.restapi.host.0.address = *
ucentral.restapi.host.0.port = 16001
ucentral.restapi.host.0.cert = $UCENTRALSEC_ROOT/certs/restapi-cert.pem
ucentral.restapi.host.0.key = $UCENTRALSEC_ROOT/certs/restapi-key.pem
ucentral.restapi.host.0.key.password = mypassword
ucentral.internal.restapi.host.0.backlog = 100
ucentral.internal.restapi.host.0.security = relaxed
ucentral.internal.restapi.host.0.rootca = $UCENTRALSEC_ROOT/certs/restapi-ca.pem
ucentral.internal.restapi.host.0.address = *
ucentral.internal.restapi.host.0.port = 17001
ucentral.internal.restapi.host.0.cert = $UCENTRALSEC_ROOT/certs/restapi-cert.pem
ucentral.internal.restapi.host.0.key = $UCENTRALSEC_ROOT/certs/restapi-key.pem
ucentral.internal.restapi.host.0.key.password = mypassword
#
# Generic section that all microservices must have
#
authentication.enabled = true
authentication.default.username = tip@ucentral.com
authentication.default.password = 13268b7daa751240369d125e79c873bd8dd3bef7981bdfd38ea03dbb1fbe7dcf
authentication.default.access = master
authentication.service.type = internal
ucentral.system.data = $UCENTRALSEC_ROOT/data
ucentral.system.debug = true
ucentral.system.uri.private = https://ucentralsec.wlan.local:17001
ucentral.system.uri.public = https://ucentral.wlan.local:16001
ucentral.system.commandchannel = /tmp/app.ucentralsec
ucentral.service.key = $UCENTRALSEC_ROOT/certs/restapi-key.pem
#
# Security Microservice Specific Section
#
mailer.hostname = smtp.gmail.com
mailer.username = no-reply@arilia.com
mailer.password = **************************
mailer.loginmethod = login
mailer.port = 587
#############################
# Generic information for all micro services
#############################
#
# NLB Support
#
alb.enable = true
alb.port = 16101
#
# Kafka
#
ucentral.kafka.group.id = security
ucentral.kafka.client.id = security1
ucentral.kafka.enable = true
# ucentral.kafka.brokerlist = a1.arilia.com:9092
ucentral.kafka.brokerlist = kafka:9092
ucentral.kafka.auto.commit = false
ucentral.kafka.queue.buffering.max.ms = 50
#
# This section select which form of persistence you need
# Only one selected at a time. If you select multiple, this service will die if a horrible
# death and might make your beer flat.
#
#storage.type = sqlite
storage.type = postgresql
#storage.type = mysql
#storage.type = odbc
storage.type.sqlite.db = security.db
storage.type.sqlite.idletime = 120
storage.type.sqlite.maxsessions = 128
storage.type.postgresql.maxsessions = 64
storage.type.postgresql.idletime = 60
storage.type.postgresql.host = postgresql
storage.type.postgresql.username = ucentralsec
storage.type.postgresql.password = ucentralsec
storage.type.postgresql.database = ucentralsec
storage.type.postgresql.port = 5432
storage.type.postgresql.connectiontimeout = 60
storage.type.mysql.maxsessions = 64
storage.type.mysql.idletime = 60
storage.type.mysql.host = localhost
storage.type.mysql.username = stephb
storage.type.mysql.password = snoopy99
storage.type.mysql.database = ucentral
storage.type.mysql.port = 3306
storage.type.mysql.connectiontimeout = 60
########################################################################
########################################################################
#
# Logging: please leave as is for now.
#
########################################################################
logging.formatters.f1.class = PatternFormatter
logging.formatters.f1.pattern = %Y-%m-%d %H:%M:%S %s: [%p] %t
logging.formatters.f1.times = UTC
logging.channels.c1.class = ConsoleChannel
logging.channels.c1.formatter = f1
# This is where the logs will be written. This path MUST exist
logging.channels.c2.class = FileChannel
logging.channels.c2.path = $UCENTRALSEC_ROOT/logs/log
logging.channels.c2.formatter.class = PatternFormatter
logging.channels.c2.formatter.pattern = %Y-%m-%d %H:%M:%S %s: [%p] %t
logging.channels.c2.rotation = 20 M
logging.channels.c2.archive = timestamp
logging.channels.c2.purgeCount = 20
logging.channels.c3.class = ConsoleChannel
logging.channels.c3.pattern = %s: [%p] %t
# External Channel
logging.loggers.root.channel = c1
logging.loggers.root.level = debug
# Inline Channel with PatternFormatter
# logging.loggers.l1.name = logger1
# logging.loggers.l1.channel.class = ConsoleChannel
# logging.loggers.l1.channel.pattern = %s: [%p] %t
# logging.loggers.l1.level = information
# SplitterChannel
# logging.channels.splitter.class = SplitterChannel
# logging.channels.splitter.channels = l1,l2
# logging.loggers.l2.name = logger2
# logging.loggers.l2.channel = splitter

70
docker-entrypoint.sh Executable file
View File

@@ -0,0 +1,70 @@
#!/bin/sh
set -e
if [ "$SELFSIGNED_CERTS" = 'true' ]; then
update-ca-certificates
fi
if [[ "$TEMPLATE_CONFIG" = 'true' && ! -f "$OWGW_CONFIG"/owgw.properties ]]; then
WEBSOCKET_HOST_ROOTCA=${WEBSOCKET_HOST_ROOTCA:-"\$OWGW_ROOT/certs/root.pem"} \
WEBSOCKET_HOST_ISSUER=${WEBSOCKET_HOST_ISSUER:-"\$OWGW_ROOT/certs/issuer.pem"} \
WEBSOCKET_HOST_CERT=${WEBSOCKET_HOST_CERT:-"\$OWGW_ROOT/certs/websocket-cert.pem"} \
WEBSOCKET_HOST_KEY=${WEBSOCKET_HOST_KEY:-"\$OWGW_ROOT/certs/websocket-key.pem"} \
WEBSOCKET_HOST_CLIENTCAS=${WEBSOCKET_HOST_CLIENTCAS:-"\$OWGW_ROOT/certs/clientcas.pem"} \
WEBSOCKET_HOST_CAS=${WEBSOCKET_HOST_CAS:-"\$OWGW_ROOT/certs/cas"} \
WEBSOCKET_HOST_PORT=${WEBSOCKET_HOST_PORT:-"15002"} \
WEBSOCKET_HOST_KEY_PASSWORD=${WEBSOCKET_HOST_KEY_PASSWORD:-"mypassword"} \
RESTAPI_HOST_ROOTCA=${RESTAPI_HOST_ROOTCA:-"\$OWGW_ROOT/certs/restapi-ca.pem"} \
RESTAPI_HOST_PORT=${RESTAPI_HOST_PORT:-"16002"} \
RESTAPI_HOST_CERT=${RESTAPI_HOST_CERT:-"\$OWGW_ROOT/certs/restapi-cert.pem"} \
RESTAPI_HOST_KEY=${RESTAPI_HOST_KEY:-"\$OWGW_ROOT/certs/restapi-key.pem"} \
RESTAPI_HOST_KEY_PASSWORD=${RESTAPI_HOST_KEY_PASSWORD:-"mypassword"} \
INTERNAL_RESTAPI_HOST_ROOTCA=${INTERNAL_RESTAPI_HOST_ROOTCA:-"\$OWGW_ROOT/certs/restapi-ca.pem"} \
INTERNAL_RESTAPI_HOST_PORT=${INTERNAL_RESTAPI_HOST_PORT:-"17002"} \
INTERNAL_RESTAPI_HOST_CERT=${INTERNAL_RESTAPI_HOST_CERT:-"\$OWGW_ROOT/certs/restapi-cert.pem"} \
INTERNAL_RESTAPI_HOST_KEY=${INTERNAL_RESTAPI_HOST_KEY:-"\$OWGW_ROOT/certs/restapi-key.pem"} \
INTERNAL_RESTAPI_HOST_KEY_PASSWORD=${INTERNAL_RESTAPI_HOST_KEY_PASSWORD:-"mypassword"} \
FILEUPLOADER_HOST_ROOTCA=${FILEUPLOADER_HOST_ROOTCA:-"\$OWGW_ROOT/certs/restapi-ca.pem"} \
FILEUPLOADER_HOST_NAME=${FILEUPLOADER_HOST_NAME:-"localhost"} \
FILEUPLOADER_HOST_PORT=${FILEUPLOADER_HOST_PORT:-"16003"} \
FILEUPLOADER_HOST_CERT=${FILEUPLOADER_HOST_CERT:-"\$OWGW_ROOT/certs/restapi-cert.pem"} \
FILEUPLOADER_HOST_KEY=${FILEUPLOADER_HOST_KEY:-"\$OWGW_ROOT/certs/restapi-key.pem"} \
FILEUPLOADER_HOST_KEY_PASSWORD=${FILEUPLOADER_HOST_KEY_PASSWORD:-"mypassword"} \
FILEUPLOADER_PATH=${FILEUPLOADER_PATH:-"\$OWGW_ROOT/uploads"} \
FILEUPLOADER_URI=${FILEUPLOADER_URI:-"https://localhost:16003"} \
SERVICE_KEY=${SERVICE_KEY:-"\$OWGW_ROOT/certs/restapi-key.pem"} \
SERVICE_KEY_PASSWORD=${SERVICE_KEY_PASSWORD:-"mypassword"} \
SYSTEM_DATA=${SYSTEM_DATA:-"\$OWGW_ROOT/data"} \
SYSTEM_URI_PRIVATE=${SYSTEM_URI_PRIVATE:-"https://localhost:17002"} \
SYSTEM_URI_PUBLIC=${SYSTEM_URI_PUBLIC:-"https://localhost:16002"} \
SYSTEM_URI_UI=${SYSTEM_URI_UI:-"http://localhost"} \
RTTY_ENABLED=${RTTY_ENABLED:-"false"} \
RTTY_SERVER=${RTTY_SERVER:-"localhost"} \
RTTY_PORT=${RTTY_PORT:-"5912"} \
RTTY_TOKEN=${RTTY_TOKEN:-"96181c567b4d0d98c50f127230068fa8"} \
RTTY_TIMEOUT=${RTTY_TIMEOUT:-"60"} \
RTTY_VIEWPORT=${RTTY_VIEWPORT:-"5913"} \
KAFKA_ENABLE=${KAFKA_ENABLE:-"true"} \
KAFKA_BROKERLIST=${KAFKA_BROKERLIST:-"localhost:9092"} \
STORAGE_TYPE=${STORAGE_TYPE:-"sqlite"} \
STORAGE_TYPE_POSTGRESQL_HOST=${STORAGE_TYPE_POSTGRESQL_HOST:-"localhost"} \
STORAGE_TYPE_POSTGRESQL_USERNAME=${STORAGE_TYPE_POSTGRESQL_USERNAME:-"owgw"} \
STORAGE_TYPE_POSTGRESQL_PASSWORD=${STORAGE_TYPE_POSTGRESQL_PASSWORD:-"owgw"} \
STORAGE_TYPE_POSTGRESQL_DATABASE=${STORAGE_TYPE_POSTGRESQL_DATABASE:-"owgw"} \
STORAGE_TYPE_POSTGRESQL_PORT=${STORAGE_TYPE_POSTGRESQL_PORT:-"5432"} \
STORAGE_TYPE_MYSQL_HOST=${STORAGE_TYPE_MYSQL_HOST:-"localhost"} \
STORAGE_TYPE_MYSQL_USERNAME=${STORAGE_TYPE_MYSQL_USERNAME:-"owgw"} \
STORAGE_TYPE_MYSQL_PASSWORD=${STORAGE_TYPE_MYSQL_PASSWORD:-"owgw"} \
STORAGE_TYPE_MYSQL_DATABASE=${STORAGE_TYPE_MYSQL_DATABASE:-"owgw"} \
STORAGE_TYPE_MYSQL_PORT=${STORAGE_TYPE_MYSQL_PORT:-"3306"} \
envsubst < $OWGW_CONFIG/owgw.properties.tmpl > $OWGW_CONFIG/owgw.properties
fi
if [ "$1" = '/openwifi/owgw' -a "$(id -u)" = '0' ]; then
if [ "$RUN_CHOWN" = 'true' ]; then
chown -R "$OWGW_USER": "$OWGW_ROOT" "$OWGW_CONFIG"
fi
exec su-exec "$OWGW_USER" "$@"
fi
exec "$@"

View File

@@ -26,7 +26,7 @@ then
exit 1
fi
if [[ ! -f ucentral.properties ]]
if [[ ! -f owgw.properties ]]
then
echo "Configuration file ucentral.properties is missing in the current directory"
exit 2
@@ -37,7 +37,7 @@ docker run -d -p 15002:15002 \
-p 16003:16003 \
--init \
--volume="$PWD:/ucentral-data" \
-e UCENTRAL_ROOT="/ucentral-data" \
-e UCENTRAL_CONFIG="/ucentral-data" \
-e UCENTRALGW_ROOT="/ucentral-data" \
-e UCENTRALGW_CONFIG="/ucentral-data" \
--name="ucentralgw" $DOCKER_NAME

0
helm/.gitkeep Normal file
View File

12
helm/Chart.lock Normal file
View File

@@ -0,0 +1,12 @@
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 10.9.2
- name: mysql
repository: https://charts.bitnami.com/bitnami
version: 8.8.3
- name: mariadb
repository: https://charts.bitnami.com/bitnami
version: 9.4.2
digest: sha256:1fdae7cbea906e41dccd8618ff9e2c68d0c684724ae27c79a12bb6089968df5c
generated: "2021-08-17T12:18:40.341427893+03:00"

View File

@@ -1,5 +1,18 @@
apiVersion: v1
apiVersion: v2
appVersion: "1.0"
description: A Helm chart for Kubernetes
name: ucentralgw
name: owgw
version: 0.1.0
dependencies:
- name: postgresql
repository: https://charts.bitnami.com/bitnami
version: 10.9.2
condition: postgresql.enabled
- name: mysql
repository: https://charts.bitnami.com/bitnami
version: 8.8.3
condition: mysql.enabled
- name: mariadb
repository: https://charts.bitnami.com/bitnami
version: 9.4.2
condition: mariadb.enabled

102
helm/README.md Normal file
View File

@@ -0,0 +1,102 @@
# owgw
This Helm chart helps to deploy OpenWIFI Gateway (further on refered as __Gateway__) to the Kubernetes clusters. It is mainly used in [assembly chart](https://github.com/Telecominfraproject/wlan-cloud-ucentral-deploy/tree/main/chart) as Gateway requires other services as dependencies that are considered in that Helm chart. This chart is purposed to define deployment logic close to the application code itself and define default values that could be overriden during deployment.
## TL;DR;
```bash
$ helm install .
```
## Introduction
This chart bootstraps the Gateway on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
## Installing the Chart
Currently this chart is not assembled in charts archives, so [helm-git](https://github.com/aslafy-z/helm-git) is required for remote the installation
To install the chart with the release name `my-release`:
```bash
$ helm install --name my-release git+https://github.com/Telecominfraproject/wlan-cloud-ucentralgw@helm?ref=master
```
The command deploys the Gateway on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
> **Tip**: List all releases using `helm list`
## Uninstalling the Chart
To uninstall/delete the `my-release` deployment:
```bash
$ helm delete my-release
```
The command removes all the Kubernetes components associated with the chart and deletes the release.
## Configuration
The following table lists the configurable parameters of the chart and their default values. If Default value is not listed in the table, please refer to the [Values](values.yaml) files for details.
| Parameter | Type | Description | Default |
|-----------|------|-------------|---------|
| replicaCount | number | Amount of replicas to be deployed | `1` |
| strategyType | string | Application deployment strategy | `'Recreate'` |
| nameOverride | string | Override to be used for application deployment | |
| fullnameOverride | string | Override to be used for application deployment (has priority over nameOverride) | |
| images.owgw.repository | string | Docker image repository | |
| images.owgw.tag | string | Docker image tag | `'master'` |
| images.owgw.pullPolicy | string | Docker image pull policy | `'Always'` |
| services.owgw.type | string | OpenWIFI Gateway service type | `'LoadBalancer'` |
| services.owgw.ports.websocket.servicePort | number | Websocket endpoint port to be exposed on service | `15002` |
| services.owgw.ports.websocket.targetPort | number | Websocket endpoint port to be targeted by service | `15002` |
| services.owgw.ports.websocket.protocol | string | Websocket endpoint protocol | `'TCP'` |
| services.owgw.ports.restapi.servicePort | number | REST API endpoint port to be exposed on service | `16002` |
| services.owgw.ports.restapi.targetPort | number | REST API endpoint port to be targeted by service | `16002` |
| services.owgw.ports.restapi.protocol | string | REST API endpoint protocol | `'TCP'` |
| services.owgw.ports.restapiinternal.servicePort | string | Internal REST API endpoint port to be exposed on service | `17002` |
| services.owgw.ports.restapiinternal.targetPort | number | Internal REST API endpoint port to be targeted by service | `17002` |
| services.owgw.ports.restapiinternal.protocol | string | Internal REST API endpoint protocol | `'TCP'` |
| services.owgw.ports.fileuploader.servicePort | string | Fileuploader endpoint port to be exposed on service | `16003` |
| services.owgw.ports.fileuploader.targetPort | number | Fileuploader endpoint port to be targeted by service | `16003` |
| services.owgw.ports.fileuploader.protocol | string | Fileuploader endpoint protocol | `'TCP'` |
| checks.owgw.liveness.httpGet.path | string | Liveness check path to be used | `'/'` |
| checks.owgw.liveness.httpGet.port | number | Liveness check port to be used (should be pointint to ALB endpoint) | `16102` |
| checks.owgw.readiness.httpGet.path | string | Readiness check path to be used | `'/'` |
| checks.owgw.readiness.httpGet.port | number | Readiness check port to be used (should be pointint to ALB endpoint) | `16102` |
| ingresses.restapi.enabled | boolean | Defines if REST API endpoint should be exposed via Ingress controller | `False` |
| ingresses.restapi.hosts | array | List of hosts for exposed REST API | |
| ingresses.restapi.paths | array | List of paths to be exposed for REST API | |
| ingresses.fileuploader.enabled | boolean | Defines if Fileuploader endpoint should be exposed via Ingress controller | `False` |
| ingresses.fileuploader.hosts | array | List of hosts for exposed Fileuploader | |
| ingresses.fileuploader.paths | array | List of paths for exposed Fileuploader | |
| volumes.owgw | array | Defines list of volumes to be attached to the Gateway | |
| persistence.enabled | boolean | Defines if the Gateway requires Persistent Volume (required for permanent files storage and SQLite DB if enabled) | `True` |
| persistence.accessModes | array | Defines PV access modes | |
| persistence.size | string | Defines PV size | `'10Gi'` |
| public_env_variables | hash | Defines list of environment variables to be passed to the Gateway | |
| configProperties | hash | Configuration properties that should be passed to the application in `owgw.properties`. May be passed by key in set (i.e. `configProperties."rtty\.token"`) | |
| certs | hash | Defines files (keys and certificates) that should be passed to the Gateway (PEM format is adviced to be used) (see `volumes.owgw` on where it is mounted) | |
| certsCAs | hash | Defines files with CAs that should be passed to the Gateway (see `volumes.owgw` on where it is mounted) | |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
```bash
$ helm install --name my-release \
--set replicaCount=1 \
.
```
The above command sets that only 1 instance of your app should be running
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```bash
$ helm install --name my-release -f values.yaml .
```
> **Tip**: You can use the default [values.yaml](values.yaml) as a base for customization.

View File

@@ -1,4 +1,4 @@
{{- define "ucentralgw.config" -}}
{{- define "owgw.config" -}}
{{- range $key, $value := .Values.configProperties }}
{{ $key }} = {{ $value }}
{{- end }}

View File

@@ -2,7 +2,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ucentralgw.name" -}}
{{- define "owgw.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
@@ -11,7 +11,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "ucentralgw.fullname" -}}
{{- define "owgw.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
@@ -27,6 +27,6 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "ucentralgw.chart" -}}
{{- define "owgw.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

View File

@@ -3,10 +3,10 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ucentralgw.fullname" . }}
name: {{ include "owgw.fullname" . }}
labels:
app.kubernetes.io/name: {{ include "ucentralgw.name" . }}
helm.sh/chart: {{ include "ucentralgw.chart" . }}
app.kubernetes.io/name: {{ include "owgw.name" . }}
helm.sh/chart: {{ include "owgw.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
spec:
@@ -15,28 +15,28 @@ spec:
type: {{ .Values.strategyType }}
selector:
matchLabels:
app.kubernetes.io/name: {{ include "ucentralgw.name" . }}
app.kubernetes.io/name: {{ include "owgw.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.services.ucentralgw.labels }}
{{- with .Values.services.owgw.labels }}
{{- toYaml . | nindent 6 }}
{{- end }}
template:
metadata:
annotations:
checksum/config: {{ include "ucentralgw.config" . | sha256sum }}
checksum/config: {{ include "owgw.config" . | sha256sum }}
labels:
app.kubernetes.io/name: {{ include "ucentralgw.name" . }}
app.kubernetes.io/name: {{ include "owgw.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- with .Values.services.ucentralgw.labels }}
{{- with .Values.services.owgw.labels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
containers:
- name: ucentralgw
image: "{{ .Values.images.ucentralgw.repository }}:{{ .Values.images.ucentralgw.tag }}"
imagePullPolicy: {{ .Values.images.ucentralgw.pullPolicy }}
- name: owgw
image: "{{ .Values.images.owgw.repository }}:{{ .Values.images.owgw.tag }}"
imagePullPolicy: {{ .Values.images.owgw.pullPolicy }}
env:
- name: KUBERNETES_DEPLOYED
@@ -49,19 +49,19 @@ spec:
- name: {{ $key }}
valueFrom:
secretKeyRef:
name: {{ include "ucentralgw.fullname" $root }}-env
name: {{ include "owgw.fullname" $root }}-env
key: {{ $key }}
{{- end }}
ports:
{{- range $port, $portValue := .Values.services.ucentralgw.ports }}
{{- range $port, $portValue := .Values.services.owgw.ports }}
- name: {{ $port }}
containerPort: {{ $portValue.targetPort }}
protocol: {{ $portValue.protocol }}
{{- end }}
volumeMounts:
{{- range .Values.volumes.ucentralgw }}
{{- range .Values.volumes.owgw }}
- name: {{ .name }}
mountPath: {{ .mountPath }}
{{- if .subPath }}
@@ -69,13 +69,13 @@ spec:
{{- end }}
{{- end }}
{{- if .Values.checks.ucentralgw.liveness }}
{{- if .Values.checks.owgw.liveness }}
livenessProbe:
{{- toYaml .Values.checks.ucentralgw.liveness | nindent 12 }}
{{- toYaml .Values.checks.owgw.liveness | nindent 12 }}
{{- end }}
{{- if .Values.checks.ucentralgw.readiness }}
{{- if .Values.checks.owgw.readiness }}
readinessProbe:
{{- toYaml .Values.checks.ucentralgw.readiness | nindent 12 }}
{{- toYaml .Values.checks.owgw.readiness | nindent 12 }}
{{- end }}
{{- with .Values.resources }}
@@ -83,10 +83,15 @@ spec:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
{{- end }}
imagePullSecrets:
{{- range $image, $imageValue := .Values.images }}
{{- if $imageValue.regcred }}
- name: {{ include "ucentralgw.fullname" $root }}-{{ $image }}-regcred
- name: {{ include "owgw.fullname" $root }}-{{ $image }}-regcred
{{- end }}
{{- end }}

View File

@@ -5,10 +5,10 @@
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ include "ucentralgw.fullname" $root }}-{{ $ingress }}
name: {{ include "owgw.fullname" $root }}-{{ $ingress }}
labels:
app.kubernetes.io/name: {{ include "ucentralgw.name" $root }}
helm.sh/chart: {{ include "ucentralgw.chart" $root }}
app.kubernetes.io/name: {{ include "owgw.name" $root }}
helm.sh/chart: {{ include "owgw.chart" $root }}
app.kubernetes.io/instance: {{ $root.Release.Name }}
app.kubernetes.io/managed-by: {{ $root.Release.Service }}
{{- with $ingressValue.annotations }}
@@ -37,7 +37,7 @@ spec:
{{- range $ingressValue.paths }}
- path: {{ .path }}
backend:
serviceName: {{ include "ucentralgw.fullname" $root }}-{{ .serviceName }}
serviceName: {{ include "owgw.fullname" $root }}-{{ .serviceName }}
servicePort: {{ .servicePort }}
{{- end }}
{{- end }}

View File

@@ -3,10 +3,10 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ template "ucentralgw.fullname" . }}-pvc
name: {{ template "owgw.fullname" . }}-pvc
labels:
app.kubernetes.io/name: {{ include "ucentralgw.name" . }}
helm.sh/chart: {{ include "ucentralgw.chart" . }}
app.kubernetes.io/name: {{ include "owgw.name" . }}
helm.sh/chart: {{ include "owgw.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- with .Values.persistence.annotations }}

View File

@@ -2,11 +2,11 @@
apiVersion: v1
metadata:
labels:
app.kuberentes.io/name: {{ include "ucentralgw.name" . }}
helm.sh/chart: {{ include "ucentralgw.chart" . }}
app.kuberentes.io/name: {{ include "owgw.name" . }}
helm.sh/chart: {{ include "owgw.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
name: {{ include "ucentralgw.fullname" . }}-certs-cas
name: {{ include "owgw.fullname" . }}-certs-cas
kind: Secret
type: Opaque
data:

View File

@@ -2,11 +2,11 @@
apiVersion: v1
metadata:
labels:
app.kuberentes.io/name: {{ include "ucentralgw.name" . }}
helm.sh/chart: {{ include "ucentralgw.chart" . }}
app.kuberentes.io/name: {{ include "owgw.name" . }}
helm.sh/chart: {{ include "owgw.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
name: {{ include "ucentralgw.fullname" . }}-certs
name: {{ include "owgw.fullname" . }}-certs
kind: Secret
type: Opaque
data:

View File

@@ -2,12 +2,12 @@
apiVersion: v1
metadata:
labels:
app.kuberentes.io/name: {{ include "ucentralgw.name" . }}
helm.sh/chart: {{ include "ucentralgw.chart" . }}
app.kuberentes.io/name: {{ include "owgw.name" . }}
helm.sh/chart: {{ include "owgw.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
name: {{ include "ucentralgw.fullname" . }}-config
name: {{ include "owgw.fullname" . }}-config
kind: Secret
type: Opaque
data:
ucentralgw.properties: {{ include "ucentralgw.config" . | b64enc }}
owgw.properties: {{ include "owgw.config" . | b64enc }}

View File

@@ -2,11 +2,11 @@
apiVersion: v1
metadata:
labels:
app.kuberentes.io/name: {{ include "ucentralgw.name" . }}
helm.sh/chart: {{ include "ucentralgw.chart" . }}
app.kuberentes.io/name: {{ include "owgw.name" . }}
helm.sh/chart: {{ include "owgw.chart" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
name: {{ include "ucentralgw.fullname" . }}-env
name: {{ include "owgw.fullname" . }}-env
kind: Secret
type: Opaque
data:

View File

@@ -10,11 +10,11 @@ kind: Secret
type: kubernetes.io/dockerconfigjson
metadata:
labels:
app.kuberentes.io/name: {{ include "ucentralgw.name" $root }}
helm.sh/chart: {{ include "ucentralgw.chart" $root }}
app.kuberentes.io/name: {{ include "owgw.name" $root }}
helm.sh/chart: {{ include "owgw.chart" $root }}
app.kubernetes.io/instance: {{ $root.Release.Name }}
app.kubernetes.io/managed-by: {{ $root.Release.Service }}
name: {{ include "ucentralgw.fullname" $root }}-{{ $image }}-regcred
name: {{ include "owgw.fullname" $root }}-{{ $image }}-regcred
data:
.dockerconfigjson: {{ template "imagePullSecret" $imageValue.regcred }}
{{- end }}

View File

@@ -4,14 +4,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "ucentralgw.fullname" $root }}-{{ $service }}
name: {{ include "owgw.fullname" $root }}-{{ $service }}
{{- with $serviceValue.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
app.kubernetes.io/name: {{ include "ucentralgw.name" $root }}
helm.sh/chart: {{ include "ucentralgw.chart" $root }}
app.kubernetes.io/name: {{ include "owgw.name" $root }}
helm.sh/chart: {{ include "owgw.chart" $root }}
app.kubernetes.io/instance: {{ $root.Release.Name }}
app.kubernetes.io/managed-by: {{ $root.Release.Service }}
@@ -39,7 +39,7 @@ spec:
{{- end }}
{{- end }}
selector:
app.kubernetes.io/name: {{ include "ucentralgw.name" $root }}
app.kubernetes.io/name: {{ include "owgw.name" $root }}
app.kubernetes.io/instance: {{ $root.Release.Name }}
{{- with $serviceValue.labels }}
{{- toYaml . | nindent 4 }}

View File

@@ -6,9 +6,9 @@ nameOverride: ""
fullnameOverride: ""
images:
ucentralgw:
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/ucentralgw
tag: master
owgw:
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owgw
tag: v2.2.0-RC1
pullPolicy: Always
# regcred:
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
@@ -16,7 +16,7 @@ images:
# password: password
services:
ucentralgw:
owgw:
type: LoadBalancer
ports:
websocket:
@@ -37,7 +37,7 @@ services:
protocol: TCP
checks:
ucentralgw:
owgw:
liveness:
httpGet:
path: /
@@ -57,7 +57,7 @@ ingresses:
- restapi.chart-example.local
paths:
- path: /
serviceName: ucentralgw
serviceName: owgw
servicePort: restapi
fileuploader:
enabled: false
@@ -68,34 +68,34 @@ ingresses:
- fileuploader.chart-example.local
paths:
- path: /
serviceName: ucentralgw
serviceName: owgw
servicePort: fileuploader
volumes:
ucentralgw:
owgw:
- name: config
mountPath: /ucentralgw-data/ucentralgw.properties
subPath: ucentralgw.properties
mountPath: /owgw-data/owgw.properties
subPath: owgw.properties
# Template below will be rendered in template
volumeDefinition: |
secret:
secretName: {{ include "ucentralgw.fullname" . }}-config
secretName: {{ include "owgw.fullname" . }}-config
- name: certs
mountPath: /ucentralgw-data/certs
mountPath: /owgw-data/certs
volumeDefinition: |
secret:
secretName: {{ include "ucentralgw.fullname" . }}-certs
secretName: {{ include "owgw.fullname" . }}-certs
- name: certs-cas
mountPath: /ucentralgw-data/certs/cas
mountPath: /owgw-data/certs/cas
volumeDefinition: |
secret:
secretName: {{ include "ucentralgw.fullname" . }}-certs-cas
secretName: {{ include "owgw.fullname" . }}-certs-cas
# Change this if you want to use another volume type
- name: persist
mountPath: /ucentralgw-data/persist
mountPath: /owgw-data/persist
volumeDefinition: |
persistentVolumeClaim:
claimName: {{ template "ucentralgw.fullname" . }}-pvc
claimName: {{ template "owgw.fullname" . }}-pvc
resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
@@ -109,6 +109,9 @@ resources: {}
# cpu: 100m
# memory: 128Mi
securityContext:
fsGroup: 101
nodeSelector: {}
tolerations: []
@@ -125,8 +128,8 @@ persistence:
# Application
public_env_variables:
UCENTRALGW_ROOT: /ucentralgw-data
UCENTRALGW_CONFIG: /ucentralgw-data
OWGW_ROOT: /owgw-data
OWGW_CONFIG: /owgw-data
secret_env_variables: {}
@@ -134,54 +137,54 @@ configProperties:
# -> Public part
# Websocket
ucentral.websocket.host.0.backlog: 500
ucentral.websocket.host.0.rootca: $UCENTRALGW_ROOT/certs/root.pem
ucentral.websocket.host.0.issuer: $UCENTRALGW_ROOT/certs/issuer.pem
ucentral.websocket.host.0.cert: $UCENTRALGW_ROOT/certs/websocket-cert.pem
ucentral.websocket.host.0.key: $UCENTRALGW_ROOT/certs/websocket-key.pem
ucentral.websocket.host.0.clientcas: $UCENTRALGW_ROOT/certs/clientcas.pem
ucentral.websocket.host.0.cas: $UCENTRALGW_ROOT/certs/cas
ucentral.websocket.host.0.rootca: $OWGW_ROOT/certs/root.pem
ucentral.websocket.host.0.issuer: $OWGW_ROOT/certs/issuer.pem
ucentral.websocket.host.0.cert: $OWGW_ROOT/certs/websocket-cert.pem
ucentral.websocket.host.0.key: $OWGW_ROOT/certs/websocket-key.pem
ucentral.websocket.host.0.clientcas: $OWGW_ROOT/certs/clientcas.pem
ucentral.websocket.host.0.cas: $OWGW_ROOT/certs/cas
ucentral.websocket.host.0.address: "*"
ucentral.websocket.host.0.port: 15002
ucentral.websocket.host.0.security: strict
ucentral.websocket.maxreactors: 20
# REST API
ucentral.restapi.host.0.backlog: 100
ucentral.restapi.host.0.security: relaxed
ucentral.restapi.host.0.rootca: $UCENTRALGW_ROOT/certs/restapi-ca.pem
ucentral.restapi.host.0.address: "*"
ucentral.restapi.host.0.port: 16002
ucentral.restapi.host.0.cert: $UCENTRALGW_ROOT/certs/restapi-cert.pem
ucentral.restapi.host.0.key: $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.internal.restapi.host.0.backlog: 100
ucentral.internal.restapi.host.0.security: relaxed
ucentral.internal.restapi.host.0.rootca: $UCENTRALGW_ROOT/certs/restapi-ca.pem
ucentral.internal.restapi.host.0.address: "*"
ucentral.internal.restapi.host.0.port: 17002
ucentral.internal.restapi.host.0.cert: $UCENTRALGW_ROOT/certs/restapi-cert.pem
ucentral.internal.restapi.host.0.key: $UCENTRALGW_ROOT/certs/restapi-key.pem
openwifi.restapi.host.0.backlog: 100
openwifi.restapi.host.0.security: relaxed
openwifi.restapi.host.0.rootca: $OWGW_ROOT/certs/restapi-ca.pem
openwifi.restapi.host.0.address: "*"
openwifi.restapi.host.0.port: 16002
openwifi.restapi.host.0.cert: $OWGW_ROOT/certs/restapi-cert.pem
openwifi.restapi.host.0.key: $OWGW_ROOT/certs/restapi-key.pem
openwifi.internal.restapi.host.0.backlog: 100
openwifi.internal.restapi.host.0.security: relaxed
openwifi.internal.restapi.host.0.rootca: $OWGW_ROOT/certs/restapi-ca.pem
openwifi.internal.restapi.host.0.address: "*"
openwifi.internal.restapi.host.0.port: 17002
openwifi.internal.restapi.host.0.cert: $OWGW_ROOT/certs/restapi-cert.pem
openwifi.internal.restapi.host.0.key: $OWGW_ROOT/certs/restapi-key.pem
# File uploader
ucentral.fileuploader.host.0.backlog: 100
ucentral.fileuploader.host.0.rootca: $UCENTRALGW_ROOT/certs/restapi-ca.pem
ucentral.fileuploader.host.0.security: relaxed
ucentral.fileuploader.host.0.address: "*"
ucentral.fileuploader.host.0.name: localhost
ucentral.fileuploader.host.0.port: 16003
ucentral.fileuploader.host.0.cert: $UCENTRALGW_ROOT/certs/restapi-cert.pem
ucentral.fileuploader.host.0.key: $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.fileuploader.path: $UCENTRALGW_ROOT/uploads
ucentral.fileuploader.maxsize: 10000
openwifi.fileuploader.host.0.backlog: 100
openwifi.fileuploader.host.0.rootca: $OWGW_ROOT/certs/restapi-ca.pem
openwifi.fileuploader.host.0.security: relaxed
openwifi.fileuploader.host.0.address: "*"
openwifi.fileuploader.host.0.name: localhost
openwifi.fileuploader.host.0.port: 16003
openwifi.fileuploader.host.0.cert: $OWGW_ROOT/certs/restapi-cert.pem
openwifi.fileuploader.host.0.key: $OWGW_ROOT/certs/restapi-key.pem
openwifi.fileuploader.path: $OWGW_ROOT/uploads
openwifi.fileuploader.maxsize: 10000
# Auto provisioning
ucentral.autoprovisioning: "true"
ucentral.devicetypes.0: AP:linksys_ea8300,edgecore_eap101,linksys_e8450-ubi
ucentral.devicetypes.1: SWITCH:edgecore_ecs4100-12ph
ucentral.devicetypes.2: IOT:esp32
openwifi.autoprovisioning: "true"
openwifi.devicetypes.0: AP:linksys_ea8300,edgecore_eap101,linksys_e8450-ubi
openwifi.devicetypes.1: SWITCH:edgecore_ecs4100-12ph
openwifi.devicetypes.2: IOT:esp32
oui.download.uri: https://linuxnet.ca/ieee/oui.txt
firmware.autoupdate.policy.default: auto
# Callback
ucentral.callback.enable: "false"
ucentral.callback.0.local: localhost:16001
ucentral.callback.0.remote: localhost:15055
ucentral.callback.0.topics: ucentralfws
openwifi.callback.enable: "false"
openwifi.callback.0.local: localhost:16001
openwifi.callback.0.remote: localhost:15055
openwifi.callback.0.topics: owfws
# rtty
rtty.enabled: "true"
rtty.server: localhost
@@ -192,12 +195,12 @@ configProperties:
alb.enable: "true"
alb.port: 16102
# Kafka
ucentral.kafka.enable: "false"
ucentral.kafka.group.id: gateway
ucentral.kafka.client.id: gateway1
ucentral.kafka.brokerlist: localhost:9092
ucentral.kafka.auto.commit: false
ucentral.kafka.queue.buffering.max.ms: 50
openwifi.kafka.enable: "false"
openwifi.kafka.group.id: gateway
openwifi.kafka.client.id: gateway1
openwifi.kafka.brokerlist: localhost:9092
openwifi.kafka.auto.commit: false
openwifi.kafka.queue.buffering.max.ms: 50
# Storage
storage.type: sqlite # (sqlite|postgresql|mysql|odbc)
## SQLite
@@ -208,31 +211,31 @@ configProperties:
storage.type.postgresql.maxsessions: 64
storage.type.postgresql.idletime: 60
storage.type.postgresql.host: localhost
storage.type.postgresql.database: ucentral
storage.type.postgresql.database: owgw
storage.type.postgresql.port: 5432
storage.type.postgresql.connectiontimeout: 60
## MySQL
storage.type.mysql.maxsessions: 64
storage.type.mysql.idletime: 60
storage.type.mysql.host: localhost
storage.type.mysql.database: ucentral
storage.type.mysql.database: owgw
storage.type.mysql.port: 3306
storage.type.mysql.connectiontimeout: 60
# System
ucentral.service.key: $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.system.data: $UCENTRALGW_ROOT/persist
ucentral.system.debug: "true"
ucentral.system.uri.private: https://localhost:17002
ucentral.system.uri.public: https://localhost:16002
ucentral.system.commandchannel: /tmp/app_ucentralgw
openwifi.service.key: $OWGW_ROOT/certs/restapi-key.pem
openwifi.system.data: $OWGW_ROOT/persist
openwifi.system.debug: "true"
openwifi.system.uri.private: https://localhost:17002
openwifi.system.uri.public: https://localhost:16002
openwifi.system.commandchannel: /tmp/app_owgw
# Logging
logging.formatters.f1.class: PatternFormatter
logging.formatters.f1.pattern: "%s: [%p] %t"
logging.formatters.f1.pattern: "%Y-%m-%d %H:%M:%S %s: [%p] %t"
logging.formatters.f1.times: UTC
logging.channels.c1.class: ConsoleChannel
logging.channels.c1.formatter: f1
logging.channels.c2.class: FileChannel
logging.channels.c2.path: /dev/stdout
logging.channels.c2.path: /tmp/log_owgw
logging.channels.c2.formatter.class: PatternFormatter
logging.channels.c2.formatter.pattern: "%Y-%m-%d %H:%M:%S %s: [%p] %t"
logging.channels.c2.rotation: "20 M"
@@ -240,21 +243,21 @@ configProperties:
logging.channels.c2.purgeCount: 20
logging.channels.c3.class: ConsoleChannel
logging.channels.c3.pattern: "%s: [%p] %t"
logging.loggers.root.channel: c2
logging.loggers.root.channel: c1
logging.loggers.root.level: debug
# -> Secret part
# Websocket
ucentral.websocket.host.0.key.password: mypassword
# REST API
ucentral.restapi.host.0.key.password: mypassword
ucentral.internal.restapi.host.0.key.password: mypassword
openwifi.restapi.host.0.key.password: mypassword
openwifi.internal.restapi.host.0.key.password: mypassword
# File uploader
ucentral.fileuploader.host.0.key.password: mypassword
openwifi.fileuploader.host.0.key.password: mypassword
# Callback
ucentral.callback.id: qblat6dfDHxQAZ6yMe6MrypBpgRDhQrhUtTOovOXAKAWU8qOvjjKKiUai4t9hGjA
ucentral.callback.0.localkey: t2dEOc88OIxVDb94mw7SLcLocgnCzZzzFoQ4JJv3OCU9UO6Ou5ds5Dh4CfBnHgrk
ucentral.callback.0.remotekey: t2dEOc88OIxVDb94mw7SLcLocgnCzZzzFoQ4JJv3OCU9UO6Ou5ds5Dh4CfBnHgrk
openwifi.callback.id: qblat6dfDHxQAZ6yMe6MrypBpgRDhQrhUtTOovOXAKAWU8qOvjjKKiUai4t9hGjA
openwifi.callback.0.localkey: t2dEOc88OIxVDb94mw7SLcLocgnCzZzzFoQ4JJv3OCU9UO6Ou5ds5Dh4CfBnHgrk
openwifi.callback.0.remotekey: t2dEOc88OIxVDb94mw7SLcLocgnCzZzzFoQ4JJv3OCU9UO6Ou5ds5Dh4CfBnHgrk
# rtty
rtty.token: 96181c567b4d0d98c50f127230068fa8
# Storage
@@ -425,3 +428,64 @@ certsCAs:
L+/DtiR5fDVMNdBSGU89UNTi0wHY9+RFuNlIuvZC+x/swF0V9R5mN+ywquTPtDLA
5IOM7ItsRmen6u3qu+JXros54e4juQ==
-----END CERTIFICATE-----
# PostgreSQL (https://github.com/bitnami/charts/tree/master/bitnami/postgresql)
postgresql:
enabled: false
image:
registry: docker.io
repository: bitnami/postgresql
tag: 11.13.0-debian-10-r0
postgresqlPostgresPassword: "rootPassword"
postgresqlUsername: stephb
postgresqlPassword: snoopy99
postgresqlDatabase: owgw
persistence:
enabled: true
storageClass: ""
size: 8Gi
# MySQL (https://github.com/bitnami/charts/tree/master/bitnami/mysql)
mysql:
enabled: false
image:
registry: docker.io
repository: bitnami/mysql
tag: 8.0.26-debian-10-r10
auth:
rootPassword: rootPassword
database: owgw
username: stephb
password: snoopy99
primary:
persistence:
enabled: true
storageClass: ""
size: 8Gi
# MariaDB (https://github.com/bitnami/charts/tree/master/bitnami/mariadb)
mariadb:
enabled: false
image:
registry: docker.io
repository: bitnami/mariadb
tag: 10.5.12-debian-10-r0
auth:
rootPassword: rootPassword
database: owgw
username: stephb
password: snoopy99
primary:
persistence:
enabled: true
storageClass: ""
size: 8Gi

View File

@@ -2,7 +2,7 @@ openapi: 3.0.1
info:
title: uCentral gateway API
description: A process to manage configuration for devices.
version: 0.0.8
version: 2.0.0
license:
name: BSD3
url: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
@@ -91,6 +91,9 @@ components:
location:
type: string
format: uuid
venue:
type: string
format: uuid
serialNumber:
type: string
deviceType:
@@ -180,6 +183,12 @@ components:
rxBytes:
type: integer
format: int64
associations_2G:
type: integer
format: int64
associations_5G:
type: integer
format: int64
devicePassword:
type: string
lastContact:
@@ -248,6 +257,12 @@ components:
format: int64
firmware:
type: string
associations_2G:
type: integer
format: int64
associations_5G:
type: integer
format: int64
verifiedCertificate:
type: string
enum:
@@ -581,6 +596,76 @@ components:
items:
$ref: '#/components/schemas/CommandInfo'
DeviceDashboard:
type: object
properties:
snapshot:
type: integer
format: int64
numberOfDevices:
type: integer
format: int64
commands:
$ref: '#/components/schemas/TagIntPairList'
upTimes:
$ref: '#/components/schemas/TagIntPairList'
memoryUsed:
$ref: '#/components/schemas/TagIntPairList'
load1:
$ref: '#/components/schemas/TagIntPairList'
load5:
$ref: '#/components/schemas/TagIntPairList'
load15:
$ref: '#/components/schemas/TagIntPairList'
vendors:
$ref: '#/components/schemas/TagIntPairList'
status:
$ref: '#/components/schemas/TagIntPairList'
type:
$ref: '#/components/schemas/TagIntPairList'
deviceType:
$ref: '#/components/schemas/TagIntPairList'
healths:
$ref: '#/components/schemas/TagIntPairList'
certificates:
$ref: '#/components/schemas/TagIntPairList'
lastContact:
$ref: '#/components/schemas/TagIntPairList'
associations:
$ref: '#/components/schemas/TagIntPairList'
TelemetryStreamRequest:
type: object
properties:
serialNumber:
type: string
interval:
type: integer
example:
0 - means to stop streaming, values 1-120 in seconds.
types:
type: array
items:
type: string
uuid:
type: string
example:
only valid when terminating a stream
TelemetryStreamResponse:
type: object
properties:
serialNumber:
type: string
uuid:
type: string
format: uuid
uri:
type: string
format: uri
example:
wss://host.domain:port/endpoint
#########################################################################################
##
## These are endpoints that all services in the uCentral stack must provide
@@ -616,6 +701,23 @@ components:
items:
$ref: '#/components/schemas/TagValuePair'
TagIntPair:
type: object
properties:
tag:
type: string
value:
type: integer
format: int64
TagIntPairList:
type: object
properties:
tagList:
type: array
items:
$ref: '#/components/schemas/TagIntPair'
SystemCommandDetails:
type: object
properties:
@@ -649,6 +751,107 @@ components:
note:
type: string
SystemInfoResults:
type: object
properties:
version:
type: string
uptime:
type: integer
format: integer64
start:
type: integer
format: integer64
os:
type: string
processors:
type: integer
hostname:
type: string
certificates:
type: array
items:
type: object
properties:
filename:
type: string
expires:
type: integer
format: int64
SystemCommandSetLogLevel:
type: object
properties:
command:
type: string
enum:
- setloglevel
subsystems:
type: array
items:
$ref: '#/components/schemas/TagValuePair'
SystemCommandReload:
type: object
properties:
command:
type: string
enum:
- reload
subsystems:
type: array
items:
type: string
example: these are the SubSystems names retrieve with the GetSubSystemsNamesResult.
SystemCommandGetLogLevels:
type: object
properties:
command:
type: string
enum:
- getloglevels
SystemGetLogLevelsResult:
type: object
properties:
taglist:
type: array
items:
$ref: '#/components/schemas/TagValuePair'
SystemCommandGetLogLevelNames:
type: object
properties:
command:
type: string
enum:
- getloglevelnames
SystemCommandGetSubsystemNames:
type: object
properties:
command:
type: string
enum:
- getsubsystemnames
SystemCommandGetLogLevelNamesResult:
type: object
properties:
list:
type: array
items:
type: string
SystemGetSubSystemNemesResult:
type: object
properties:
taglist:
type: array
items:
$ref: '#/components/schemas/TagValuePair'
#########################################################################################
##
## End of uCentral system wide values
@@ -805,6 +1008,7 @@ paths:
name: countOnly
schema:
type: boolean
example: countOnly=true
- in: query
description: Return extra information with the device information
name: deviceWithStatus
@@ -903,7 +1107,7 @@ paths:
format: int64
responses:
200:
204:
description: Successfully deleted commands for the device.
content:
application/json:
@@ -954,7 +1158,7 @@ paths:
format: uuid
required: true
responses:
200:
204:
description: Delete command success
content:
application/json:
@@ -1049,7 +1253,7 @@ paths:
type: string
required: true
responses:
200:
204:
$ref: '#/components/responses/Success'
403:
$ref: '#/components/responses/Unauthorized'
@@ -1118,6 +1322,11 @@ paths:
schema:
type: string
required: true
- in: query
name: validateOnly
schema:
type: boolean
required: false
requestBody:
description: Information used to create the new device
content:
@@ -1177,7 +1386,7 @@ paths:
type: string
required: true
responses:
200:
204:
$ref: '#/components/responses/Success'
403:
$ref: '#/components/responses/Unauthorized'
@@ -1272,7 +1481,7 @@ paths:
format: int64
responses:
200:
204:
description: Successfully deleted logs for the device.
content:
application/json:
@@ -1369,7 +1578,7 @@ paths:
required: false
responses:
200:
204:
description: Successfully deleted health checks for the device.
content:
application/json:
@@ -1416,7 +1625,7 @@ paths:
type: string
required: true
responses:
200:
204:
description: List of logs for this device
content:
application/json:
@@ -1521,7 +1730,7 @@ paths:
required: false
responses:
200:
204:
description: Array of statistics for this device
content:
application/json:
@@ -1790,7 +1999,7 @@ paths:
404:
$ref: '#/components/responses/NotFound'
/device/{serialNumber}/eventrequest:
/device/{serialNumber}/eventqueue:
post:
tags:
- Commands
@@ -1816,6 +2025,32 @@ paths:
404:
$ref: '#/components/responses/NotFound'
/device/{serialNumber}/telemetry:
post:
tags:
- Commands
summary: Request a telemetry stream
operationId: eventTelemetryStreamRequest
parameters:
- in: path
name: serialNumber
schema:
type: string
required: true
requestBody:
description: Message request details
content:
application/json:
schema:
$ref: '#/components/schemas/TelemetryStreamRequest'
responses:
200:
$ref: '#/components/schemas/TelemetryStreamResponse'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
/ouis:
get:
tags:
@@ -1909,7 +2144,7 @@ paths:
type: string
required: true
responses:
200:
204:
$ref: '#/components/responses/Success'
403:
$ref: '#/components/responses/Unauthorized'
@@ -1986,19 +2221,32 @@ paths:
type: string
required: true
responses:
200:
204:
$ref: '#/components/responses/Success'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
/deviceDashboard:
get:
tags:
- Dashboards
summary: Get the last version of the dashboard
operationId: getDeviceDashboard
responses:
200:
$ref: '#/components/schemas/DeviceDashboard'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
#########################################################################################
##
## These are endpoints that all services in the uCentral stack must provide
##
#########################################################################################
/system:
post:
tags:
@@ -2010,65 +2258,50 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/SystemCommandDetails'
oneOf:
- $ref: '#/components/schemas/SystemCommandSetLogLevel'
- $ref: '#/components/schemas/SystemCommandReload'
- $ref: '#/components/schemas/SystemCommandGetLogLevels'
- $ref: '#/components/schemas/SystemCommandGetLogLevelNames'
- $ref: '#/components/schemas/SystemCommandGetSubsystemNames'
responses:
200:
description: Successfull command execution
content:
application/json:
schema:
$ref: '#/components/schemas/SystemCommandResults'
oneOf:
- $ref: '#/components/schemas/SystemGetLogLevelsResult'
- $ref: '#/components/schemas/SystemCommandGetLogLevelNamesResult'
- $ref: '#/components/schemas/SystemGetSubSystemNemesResult'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
/callbackChannel:
post:
get:
tags:
- Callback
summary: Generic callback hook
operationId: postCallback
- System Commands
summary: Retrieve different values from the running service.
operationId: getSystemCommand
parameters:
- in: query
name: subscribe
schema:
type: boolean
required: false
- in: query
name: uri
description: Get a value
name: command
schema:
type: string
format: uri
- in: query
name: key
schema:
type: string
- in: query
name: topics
schema:
type: string
- in: query
name: id
schema:
type: string
- in: query
name: topic
schema:
type: string
requestBody:
description: A generic JSONDocument, may be empty too {}
enum:
- info
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/AnyPayload'
responses:
200:
$ref: '#/components/responses/Success'
description: Successfull command execution
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/SystemInfoResults'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'

View File

@@ -4,12 +4,12 @@
# address of one of your interfaces
#
ucentral.websocket.host.0.backlog = 500
ucentral.websocket.host.0.rootca = $UCENTRALGW_ROOT/certs/root.pem
ucentral.websocket.host.0.issuer = $UCENTRALGW_ROOT/certs/issuer.pem
ucentral.websocket.host.0.cert = $UCENTRALGW_ROOT/certs/websocket-cert.pem
ucentral.websocket.host.0.key = $UCENTRALGW_ROOT/certs/websocket-key.pem
ucentral.websocket.host.0.clientcas = $UCENTRALGW_ROOT/certs/clientcas.pem
ucentral.websocket.host.0.cas = $UCENTRALGW_ROOT/certs/cas
ucentral.websocket.host.0.rootca = $OWGW_ROOT/certs/root.pem
ucentral.websocket.host.0.issuer = $OWGW_ROOT/certs/issuer.pem
ucentral.websocket.host.0.cert = $OWGW_ROOT/certs/websocket-cert.pem
ucentral.websocket.host.0.key = $OWGW_ROOT/certs/websocket-key.pem
ucentral.websocket.host.0.clientcas = $OWGW_ROOT/certs/clientcas.pem
ucentral.websocket.host.0.cas = $OWGW_ROOT/certs/cas
ucentral.websocket.host.0.address = *
ucentral.websocket.host.0.port = 15002
ucentral.websocket.host.0.security = strict
@@ -19,59 +19,61 @@ ucentral.websocket.maxreactors = 20
#
# REST API access
#
ucentral.restapi.host.0.backlog = 100
ucentral.restapi.host.0.security = relaxed
ucentral.restapi.host.0.rootca = $UCENTRALGW_ROOT/certs/restapi-ca.pem
ucentral.restapi.host.0.address = *
ucentral.restapi.host.0.port = 16002
ucentral.restapi.host.0.cert = $UCENTRALGW_ROOT/certs/restapi-cert.pem
ucentral.restapi.host.0.key = $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.restapi.host.0.key.password = mypassword
openwifi.restapi.host.0.backlog = 100
openwifi.restapi.host.0.security = relaxed
openwifi.restapi.host.0.rootca = $OWGW_ROOT/certs/restapi-ca.pem
openwifi.restapi.host.0.address = *
openwifi.restapi.host.0.port = 16002
openwifi.restapi.host.0.cert = $OWGW_ROOT/certs/restapi-cert.pem
openwifi.restapi.host.0.key = $OWGW_ROOT/certs/restapi-key.pem
openwifi.restapi.host.0.key.password = mypassword
ucentral.internal.restapi.host.0.backlog = 100
ucentral.internal.restapi.host.0.security = relaxed
ucentral.internal.restapi.host.0.rootca = $UCENTRALGW_ROOT/certs/restapi-ca.pem
ucentral.internal.restapi.host.0.address = *
ucentral.internal.restapi.host.0.port = 17002
ucentral.internal.restapi.host.0.cert = $UCENTRALGW_ROOT/certs/restapi-cert.pem
ucentral.internal.restapi.host.0.key = $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.internal.restapi.host.0.key.password = mypassword
openwifi.internal.restapi.host.0.backlog = 100
openwifi.internal.restapi.host.0.security = relaxed
openwifi.internal.restapi.host.0.rootca = $OWGW_ROOT/certs/restapi-ca.pem
openwifi.internal.restapi.host.0.address = *
openwifi.internal.restapi.host.0.port = 17002
openwifi.internal.restapi.host.0.cert = $OWGW_ROOT/certs/restapi-cert.pem
openwifi.internal.restapi.host.0.key = $OWGW_ROOT/certs/restapi-key.pem
openwifi.internal.restapi.host.0.key.password = mypassword
#
# Used to upload files to the service.
# You should replace the 'name' vaalue with the IP address of your gateway or an FQDN
# that your devices can reach
#
ucentral.fileuploader.host.0.backlog = 100
ucentral.fileuploader.host.0.rootca = $UCENTRALGW_ROOT/certs/restapi-ca.pem
ucentral.fileuploader.host.0.security = relaxed
ucentral.fileuploader.host.0.address = *
ucentral.fileuploader.host.0.name = ucentral.dpaas.arilia.com
ucentral.fileuploader.host.0.port = 16003
ucentral.fileuploader.host.0.cert = $UCENTRALGW_ROOT/certs/restapi-cert.pem
ucentral.fileuploader.host.0.key = $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.fileuploader.host.0.key.password = mypassword
ucentral.fileuploader.path = $UCENTRALGW_ROOT/uploads
ucentral.fileuploader.maxsize = 10000
openwifi.fileuploader.host.0.backlog = 100
openwifi.fileuploader.host.0.rootca = $OWGW_ROOT/certs/restapi-ca.pem
openwifi.fileuploader.host.0.security = relaxed
openwifi.fileuploader.host.0.address = *
openwifi.fileuploader.host.0.name = ucentral.dpaas.arilia.com
openwifi.fileuploader.host.0.port = 16003
openwifi.fileuploader.host.0.cert = $OWGW_ROOT/certs/restapi-cert.pem
openwifi.fileuploader.host.0.key = $OWGW_ROOT/certs/restapi-key.pem
openwifi.fileuploader.host.0.key.password = mypassword
openwifi.fileuploader.path = $OWGW_ROOT/uploads
openwifi.fileuploader.maxsize = 10000
openwifi.fileuploader.uri = https://ucentral.dpaas.arilia.com:16003
#
# Generic section that all microservices must have
#
ucentral.service.key = $UCENTRALGW_ROOT/certs/restapi-key.pem
ucentral.system.data = $UCENTRALGW_ROOT/data
ucentral.system.debug = true
ucentral.system.uri.private = https://localhost:17002
ucentral.system.uri.public = https://local.dpaas.arilia.com:16002
ucentral.system.uri.ui = https://ucentral-ui.arilia.com
ucentral.system.commandchannel = /tmp/app.ucentralgw
openwifi.service.key = $OWGW_ROOT/certs/restapi-key.pem
openwifi.service.key.password = mypassword
openwifi.system.data = $OWGW_ROOT/data
openwifi.system.debug = true
openwifi.system.uri.private = https://localhost:17002
openwifi.system.uri.public = https://ucentral.dpaas.arilia.com:16002
openwifi.system.uri.ui = https://ucentral-ui.arilia.com
openwifi.system.commandchannel = /tmp/app.ucentralgw
#
# Gateway Microservice Specific Section
#
ucentral.autoprovisioning = true
ucentral.devicetypes.0 = AP:linksys_ea8300,edgecore_eap101,linksys_e8450-ubi
ucentral.devicetypes.1 = SWITCH:edgecore_ecs4100-12ph
ucentral.devicetypes.2 = IOT:esp32
openwifi.autoprovisioning = true
openwifi.devicetypes.0 = AP:linksys_ea8300,edgecore_eap101,linksys_e8450-ubi
openwifi.devicetypes.1 = SWITCH:edgecore_ecs4100-12ph
openwifi.devicetypes.2 = IOT:esp32
oui.download.uri = https://linuxnet.ca/ieee/oui.txt
firmware.autoupdate.policy.default = auto
@@ -97,13 +99,12 @@ alb.port = 16102
#
# Kafka
#
ucentral.kafka.group.id = gateway
ucentral.kafka.client.id = gateway1
ucentral.kafka.enable = true
# ucentral.kafka.brokerlist = a1.arilia.com:9092
ucentral.kafka.brokerlist = debfarm1-node-c.arilia.com:9092
ucentral.kafka.auto.commit = false
ucentral.kafka.queue.buffering.max.ms = 50
openwifi.kafka.group.id = gateway
openwifi.kafka.client.id = gateway1
openwifi.kafka.enable = true
openwifi.kafka.brokerlist = a1.arilia.com:9092
openwifi.kafka.auto.commit = false
openwifi.kafka.queue.buffering.max.ms = 50
#
# This section select which form of persistence you need
@@ -163,7 +164,7 @@ logging.channels.c1.formatter = f1
# This is where the logs will be written. This path MUST exist
logging.channels.c2.class = FileChannel
logging.channels.c2.path = $UCENTRALGW_ROOT/logs/log
logging.channels.c2.path = $OWGW_ROOT/logs/log
logging.channels.c2.formatter.class = PatternFormatter
logging.channels.c2.formatter.pattern = %Y-%m-%d %H:%M:%S %s: [%p] %t
logging.channels.c2.rotation = 20 M

189
owgw.properties.tmpl Normal file
View File

@@ -0,0 +1,189 @@
#
# uCentral protocol server for devices. This is where you point
# all your devices. You can replace the * for address by the specific
# address of one of your interfaces
#
ucentral.websocket.host.0.backlog = 500
ucentral.websocket.host.0.rootca = ${WEBSOCKET_HOST_ROOTCA}
ucentral.websocket.host.0.issuer = ${WEBSOCKET_HOST_ISSUER}
ucentral.websocket.host.0.cert = ${WEBSOCKET_HOST_CERT}
ucentral.websocket.host.0.key = ${WEBSOCKET_HOST_KEY}
ucentral.websocket.host.0.clientcas = ${WEBSOCKET_HOST_CLIENTCAS}
ucentral.websocket.host.0.cas = ${WEBSOCKET_HOST_CAS}
ucentral.websocket.host.0.address = *
ucentral.websocket.host.0.port = ${WEBSOCKET_HOST_PORT}
ucentral.websocket.host.0.security = strict
ucentral.websocket.host.0.key.password = ${WEBSOCKET_HOST_KEY_PASSWORD}
ucentral.websocket.maxreactors = 20
#
# REST API access
#
openwifi.restapi.host.0.backlog = 100
openwifi.restapi.host.0.security = relaxed
openwifi.restapi.host.0.rootca = ${RESTAPI_HOST_ROOTCA}
openwifi.restapi.host.0.address = *
openwifi.restapi.host.0.port = ${RESTAPI_HOST_PORT}
openwifi.restapi.host.0.cert = ${RESTAPI_HOST_CERT}
openwifi.restapi.host.0.key = ${RESTAPI_HOST_KEY}
openwifi.restapi.host.0.key.password = ${RESTAPI_HOST_KEY_PASSWORD}
openwifi.internal.restapi.host.0.backlog = 100
openwifi.internal.restapi.host.0.security = relaxed
openwifi.internal.restapi.host.0.rootca = ${INTERNAL_RESTAPI_HOST_ROOTCA}
openwifi.internal.restapi.host.0.address = *
openwifi.internal.restapi.host.0.port = ${INTERNAL_RESTAPI_HOST_PORT}
openwifi.internal.restapi.host.0.cert = ${INTERNAL_RESTAPI_HOST_CERT}
openwifi.internal.restapi.host.0.key = ${INTERNAL_RESTAPI_HOST_KEY}
openwifi.internal.restapi.host.0.key.password = ${INTERNAL_RESTAPI_HOST_KEY_PASSWORD}
#
# Used to upload files to the service.
# You should replace the 'name' vaalue with the IP address of your gateway or an FQDN
# that your devices can reach
#
openwifi.fileuploader.host.0.backlog = 100
openwifi.fileuploader.host.0.rootca = ${FILEUPLOADER_HOST_ROOTCA}
openwifi.fileuploader.host.0.security = relaxed
openwifi.fileuploader.host.0.address = *
openwifi.fileuploader.host.0.name = ${FILEUPLOADER_HOST_NAME}
openwifi.fileuploader.host.0.port = ${FILEUPLOADER_HOST_PORT}
openwifi.fileuploader.host.0.cert = ${FILEUPLOADER_HOST_CERT}
openwifi.fileuploader.host.0.key = ${FILEUPLOADER_HOST_KEY}
openwifi.fileuploader.host.0.key.password = ${FILEUPLOADER_HOST_KEY_PASSWORD}
openwifi.fileuploader.path = ${FILEUPLOADER_PATH}
openwifi.fileuploader.uri = ${FILEUPLOADER_URI}
openwifi.fileuploader.maxsize = 10000
#
# Generic section that all microservices must have
#
openwifi.service.key = ${SERVICE_KEY}
openwifi.service.key.password = ${SERVICE_KEY_PASSWORD}
openwifi.system.data = ${SYSTEM_DATA}
openwifi.system.debug = true
openwifi.system.uri.private = ${SYSTEM_URI_PRIVATE}
openwifi.system.uri.public = ${SYSTEM_URI_PUBLIC}
openwifi.system.uri.ui = ${SYSTEM_URI_UI}
openwifi.system.commandchannel = /tmp/app.ucentralgw
#
# Gateway Microservice Specific Section
#
openwifi.autoprovisioning = true
openwifi.devicetypes.0 = AP:linksys_ea8300,edgecore_eap101,linksys_e8450-ubi
openwifi.devicetypes.1 = SWITCH:edgecore_ecs4100-12ph
openwifi.devicetypes.2 = IOT:esp32
oui.download.uri = https://linuxnet.ca/ieee/oui.txt
firmware.autoupdate.policy.default = auto
#
# rtty
#
rtty.enabled = ${RTTY_ENABLED}
rtty.server = ${RTTY_SERVER}
rtty.port = ${RTTY_PORT}
rtty.token = ${RTTY_TOKEN}
rtty.timeout = ${RTTY_TIMEOUT}
rtty.viewport = ${RTTY_VIEWPORT}
#############################
# Generic information for all micro services
#############################
#
# NLB Support
#
alb.enable = true
alb.port = 16102
#
# Kafka
#
openwifi.kafka.group.id = gateway
openwifi.kafka.client.id = gateway1
openwifi.kafka.enable = ${KAFKA_ENABLE}
openwifi.kafka.brokerlist = ${KAFKA_BROKERLIST}
openwifi.kafka.auto.commit = false
openwifi.kafka.queue.buffering.max.ms = 50
#
# This section select which form of persistence you need
# Only one selected at a time. If you select multiple, this service will die if a horrible
# death and might make your beer flat.
#
storage.type = ${STORAGE_TYPE}
storage.type.sqlite.db = devices.db
storage.type.sqlite.idletime = 120
storage.type.sqlite.maxsessions = 128
storage.type.postgresql.maxsessions = 64
storage.type.postgresql.idletime = 60
storage.type.postgresql.host = ${STORAGE_TYPE_POSTGRESQL_HOST}
storage.type.postgresql.username = ${STORAGE_TYPE_POSTGRESQL_USERNAME}
storage.type.postgresql.password = ${STORAGE_TYPE_POSTGRESQL_PASSWORD}
storage.type.postgresql.database = ${STORAGE_TYPE_POSTGRESQL_DATABASE}
storage.type.postgresql.port = ${STORAGE_TYPE_POSTGRESQL_PORT}
storage.type.postgresql.connectiontimeout = 60
storage.type.mysql.maxsessions = 64
storage.type.mysql.idletime = 60
storage.type.mysql.host = ${STORAGE_TYPE_MYSQL_HOST}
storage.type.mysql.username = ${STORAGE_TYPE_MYSQL_USERNAME}
storage.type.mysql.password = ${STORAGE_TYPE_MYSQL_PASSWORD}
storage.type.mysql.database = ${STORAGE_TYPE_MYSQL_DATABASE}
storage.type.mysql.port = ${STORAGE_TYPE_MYSQL_PORT}
storage.type.mysql.connectiontimeout = 60
archiver.enabled = true
archiver.schedule = 03:00
archiver.db.0.name = healthchecks
archiver.db.0.keep = 7
archiver.db.1.name = statistics
archiver.db.1.keep = 7
archiver.db.2.name = devicelogs
archiver.db.2.keep = 7
archiver.db.3.name = commandlist
archiver.db.3.keep = 7
########################################################################
########################################################################
#
# Logging: please leave as is for now.
#
########################################################################
logging.formatters.f1.class = PatternFormatter
logging.formatters.f1.pattern = %Y-%m-%d %H:%M:%S %s: [%p] %t
logging.formatters.f1.times = UTC
logging.channels.c1.class = ConsoleChannel
logging.channels.c1.formatter = f1
# This is where the logs will be written. This path MUST exist
logging.channels.c2.class = FileChannel
logging.channels.c2.path = $UCENTRALGW_ROOT/logs/log
logging.channels.c2.formatter.class = PatternFormatter
logging.channels.c2.formatter.pattern = %Y-%m-%d %H:%M:%S %s: [%p] %t
logging.channels.c2.rotation = 20 M
logging.channels.c2.archive = timestamp
logging.channels.c2.purgeCount = 20
logging.channels.c3.class = ConsoleChannel
logging.channels.c3.pattern = %s: [%p] %t
# External Channel
logging.loggers.root.channel = c1
logging.loggers.root.level = debug
# Inline Channel with PatternFormatter
# logging.loggers.l1.name = logger1
# logging.loggers.l1.channel.class = ConsoleChannel
# logging.loggers.l1.channel.pattern = %s: [%p] %t
# logging.loggers.l1.level = information
# SplitterChannel
# logging.channels.splitter.class = SplitterChannel
# logging.channels.splitter.channels = l1,l2
# logging.loggers.l2.name = logger2
# logging.loggers.l2.channel = splitter

22
owgw.service Normal file
View File

@@ -0,0 +1,22 @@
[Unit]
Description=OpenWiFi Gateway Service
After=network-online.target docker.service
Wants=network-online.target
[Service]
Type=simple
Environment="OWGW_ROOT=/home/admin/dev/wlan-cloud-ucentralgw"
ExecStart=/home/admin/dev/wlan-cloud-ucentralgw/cmake-build/owgw
WorkingDirectory=/home/admin/dev/wlan-cloud-ucentralgw
# ExecReload=/bin/kill -s HUP $MAINPID
User=admin
# TimeoutSec=0
RestartSec=2
Restart=always
StartLimitBurst=3
# KillMode=process
LimitNOFILE=500000
LimitNPROC=500000
[Install]
WantedBy=multi-user.target

View File

@@ -1,4 +1,4 @@
#!/bin/bash
export UCENTRALGW_CONFIG=`pwd`
export UCENTRALGW_ROOT=`pwd`
export OWGW_CONFIG=`pwd`
export OWGW_ROOT=`pwd`

View File

@@ -1,5 +1,9 @@
//
// Created by stephane bourque on 2021-06-04.
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#ifndef UCENTRALGW_ALBHEALTHCHECKSERVER_H
@@ -20,18 +24,18 @@
#include "Daemon.h"
#include "SubSystemServer.h"
namespace uCentral {
namespace OpenWifi {
class ALBRequestHandler: public Poco::Net::HTTPRequestHandler
/// Return a HTML document with the current date and time.
{
public:
ALBRequestHandler(Poco::Logger & L)
explicit ALBRequestHandler(Poco::Logger & L)
: Logger_(L)
{
}
void handleRequest(Poco::Net::HTTPServerRequest& Request, Poco::Net::HTTPServerResponse& Response)
void handleRequest(Poco::Net::HTTPServerRequest& Request, Poco::Net::HTTPServerResponse& Response) override
{
Logger_.information(Poco::format("ALB-REQUEST(%s): New ALB request.",Request.clientAddress().toString()));
Response.setChunkedTransferEncoding(true);
@@ -83,7 +87,7 @@ namespace uCentral {
return instance_;
}
int Start() {
int Start() override {
if(Daemon()->ConfigGetBool("alb.enable",false)) {
Port_ = (int)Daemon()->ConfigGetInt("alb.port",15015);
Socket_ = std::make_unique<Poco::Net::ServerSocket>(Port_);
@@ -95,7 +99,7 @@ namespace uCentral {
return 0;
}
void Stop() {
void Stop() override {
if(Server_)
Server_->stop();
}

View File

@@ -1,6 +1,11 @@
//
// Created by stephane bourque on 2021-06-30.
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#include <utility>
#include "AuthClient.h"
@@ -8,7 +13,7 @@
#include "Daemon.h"
#include "OpenAPIRequest.h"
namespace uCentral {
namespace OpenWifi {
class AuthClient * AuthClient::instance_ = nullptr;
int AuthClient::Start() {
@@ -20,7 +25,7 @@ namespace uCentral {
}
void AuthClient::RemovedCachedToken(const std::string &Token) {
SubMutexGuard G(Mutex_);
std::lock_guard G(Mutex_);
UserCache_.erase(Token);
}
@@ -29,7 +34,36 @@ namespace uCentral {
}
bool AuthClient::IsAuthorized(Poco::Net::HTTPServerRequest & Request, std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo ) {
SubMutexGuard G(Mutex_);
std::lock_guard G(Mutex_);
auto User = UserCache_.find(SessionToken);
if(User != UserCache_.end() && !IsTokenExpired(User->second.webtoken)) {
UInfo = User->second;
return true;
} else {
Types::StringPairVec QueryData;
QueryData.push_back(std::make_pair("token",SessionToken));
OpenAPIRequestGet Req( uSERVICE_SECURITY,
"/api/v1/validateToken",
QueryData,
5000);
Poco::JSON::Object::Ptr Response;
if(Req.Do(Response)==Poco::Net::HTTPResponse::HTTP_OK) {
if(Response->has("tokenInfo") && Response->has("userInfo")) {
SecurityObjects::UserInfoAndPolicy P;
P.from_json(Response);
UserCache_[SessionToken] = P;
UInfo = P;
}
return true;
}
}
return false;
}
bool AuthClient::IsTokenAuthorized(const std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo) {
std::lock_guard G(Mutex_);
auto User = UserCache_.find(SessionToken);
if(User != UserCache_.end() && !IsTokenExpired(User->second.webtoken)) {

View File

@@ -13,9 +13,9 @@
#include "RESTAPI_SecurityObjects.h"
#include "SubSystemServer.h"
namespace uCentral {
namespace OpenWifi {
class AuthClient : public SubSystemServer {
class AuthClient : public SubSystemServer {
public:
explicit AuthClient() noexcept:
SubSystemServer("Authentication", "AUTH-CLNT", "authentication")
@@ -31,12 +31,12 @@ namespace uCentral {
int Start() override;
void Stop() override;
bool IsAuthorized(Poco::Net::HTTPServerRequest & Request, std::string &SessionToken, SecurityObjects::UserInfoAndPolicy & UInfo );
bool IsAuthorized(Poco::Net::HTTPServerRequest & Request, std::string &SessionToken, OpenWifi::SecurityObjects::UserInfoAndPolicy & UInfo );
void RemovedCachedToken(const std::string &Token);
bool IsTokenAuthorized(const std::string &Token, SecurityObjects::UserInfoAndPolicy & UInfo);
private:
static AuthClient *instance_;
SecurityObjects::UserInfoCache UserCache_;
OpenWifi::SecurityObjects::UserInfoCache UserCache_;
};
inline AuthClient * AuthClient() { return AuthClient::instance(); }

View File

@@ -1,170 +0,0 @@
//
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#include "CallbackManager.h"
#include "Daemon.h"
#include "Poco/Net/HTTPClientSession.h"
#include "Poco/Net/HTTPSClientSession.h"
#include "Poco/Net/HTTPRequest.h"
#include "Poco/Net/HTTPResponse.h"
#include "Poco/URI.h"
namespace uCentral {
class CallbackManager *CallbackManager::instance_ = nullptr;
CallbackManager::CallbackManager() noexcept:
SubSystemServer("CallbackManager", "CBACK-MGR", "ucentral.callback")
{
}
int CallbackManager::Start() {
Logger_.notice("Starting...");
Mgr_.start(*this);
return 0;
}
bool CallbackManager::InitHosts() {
// get all the hosts we are registering with and register ourselves...
if(Daemon()->ConfigGetString("ucentral.callback.enable","false") == "false") {
Logger_.information("CALLBACK system disabled.");
return false;
}
MyIDCallbackId_ = Daemon()->ConfigGetString("ucentral.callback.id","");
if(MyIDCallbackId_.empty()) {
Logger_.information("CALLBACK system disabled. No CallbackID present in ucentral.callback.id");
return false;
}
// now get all the hosts we need to register with...
auto Index = 0 ;
while(true) {
std::string root = "ucentral.callback." + std::to_string(Index);
auto Local = Daemon()->ConfigGetString(root + ".local","");
auto Remote = Daemon()->ConfigGetString(root + ".remote","");
auto LocalKey = Daemon()->ConfigGetString(root + ".localkey","");
auto RemoteKey = Daemon()->ConfigGetString(root + ".localkey","");
auto Topics = Daemon()->ConfigGetString(root + ".topics","");
if(Local.empty() || Remote.empty() || LocalKey.empty() || Topics.empty() || RemoteKey.empty())
break;
CallbackHost H{
.Local = "https://" + Local + "/api/v1/callbackChannel",
.LocalKey = LocalKey,
.Remote = "https://" + Remote + "/api/v1/callbackChannel",
.RemoteKey = RemoteKey,
.Topics = Topics,
.LastContact = 0,
.NextContact = 0,
.Registered = false
};
Hosts_.push_back(H);
Index++;
}
return true;
}
bool DoRequest(Poco::Net::HTTPSClientSession& Session, Poco::Net::HTTPRequest& Request, Poco::Net::HTTPResponse& Response)
{
std::string Content{R"lit({ "comment" : "registration from uCentralGW" })lit"};
std::stringstream Body(Content);
Request.setContentType("application/json");
Request.setContentLength(Content.length());
std::ostream& OS = Session.sendRequest(Request);
Poco::StreamCopier::copyStream(Body, OS);
Session.receiveResponse(Response);
return (Response.getStatus() == Poco::Net::HTTPResponse::HTTP_OK);
}
bool CallbackManager::RegisterHosts() {
if(MyIDCallbackId_.empty())
return false;
for(auto &i:Hosts_) {
if(!i.Registered || (time(nullptr)-i.LastContact)>300) {
Poco::URI Uri(i.Remote);
Uri.addQueryParameter("subscribe", "true");
Uri.addQueryParameter("uri", i.Local);
Uri.addQueryParameter("topics", i.Topics);
Uri.addQueryParameter("key", i.LocalKey);
Uri.addQueryParameter("id", MyIDCallbackId_);
Poco::Net::HTTPSClientSession Session(Uri.getHost(), Uri.getPort());
Poco::Net::HTTPRequest Request(Poco::Net::HTTPRequest::HTTP_POST,
Uri.getPathAndQuery(),
Poco::Net::HTTPMessage::HTTP_1_1);
Request.add("X-API-KEY", i.RemoteKey);
Poco::Net::HTTPResponse Response;
i.LastContact = time(nullptr);
i.Registered = DoRequest(Session, Request, Response);
}
}
return true;
}
void CallbackManager::run() {
Running_ = true;
uint64_t LastContact = time(nullptr);
InitHosts();
RegisterHosts();
while(Running_) {
if((time(nullptr) - LastContact) >300) {
RegisterHosts();
LastContact = time(nullptr);
}
if(Calls_.empty()) {
Poco::Thread::sleep(2000);
} else {
CallBackMessage E;
{
SubMutexGuard Guard(Mutex_);
E = Calls_.front();
}
std::cout << "Call: " << E.Message << " JSON:" << E.JSONDoc << std::endl;
{
SubMutexGuard Guard(Mutex_);
Calls_.pop();
}
}
}
}
void CallbackManager::Stop() {
SubMutexGuard Guard(Mutex_);
Logger_.notice("Stopping...");
Running_ = false ;
Mgr_.join();
}
bool CallbackManager::AddMessage(const CallBackMessage &Msg) {
SubMutexGuard Guard(Mutex_);
Calls_.push(Msg);
return true;
}
} // end of namespace

View File

@@ -1,65 +0,0 @@
//
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#ifndef UCENTRALGW_CALLBACKMANAGER_H
#define UCENTRALGW_CALLBACKMANAGER_H
#include <queue>
#include "SubSystemServer.h"
namespace uCentral {
class CallbackManager : public SubSystemServer, Poco::Runnable {
public:
struct CallBackMessage {
std::string Message;
std::string JSONDoc;
};
struct CallbackHost {
std::string Local;
std::string LocalKey;
std::string Remote;
std::string RemoteKey;
std::string Topics;
uint64_t LastContact;
uint64_t NextContact;
bool Registered;
};
static CallbackManager *instance() {
if (instance_ == nullptr) {
instance_ = new CallbackManager;
}
return instance_;
}
void run() override;
int Start() override;
void Stop() override;
bool AddMessage(const CallBackMessage &Msg);
bool InitHosts();
bool RegisterHosts();
private:
static CallbackManager *instance_;
Poco::Thread Mgr_;
std::atomic_bool Running_ = false;
std::queue<CallBackMessage> Calls_;
std::string MyIDCallbackId_;
std::vector<CallbackHost> Hosts_;
CallbackManager() noexcept;
};
inline CallbackManager * CallbackManager() { return CallbackManager::instance(); }
} // end of namespace
#endif // UCENTRALGW_CALLBACKMANAGER_H

View File

@@ -14,7 +14,7 @@
#include "Poco/JSON/Parser.h"
#include "Poco/File.h"
namespace uCentral::Config {
namespace OpenWifi::Config {
static std::string DefaultConfiguration;
@@ -232,7 +232,7 @@ namespace uCentral::Config {
}
catch ( const Poco::Exception & E )
{
uCentral::Daemon::instance()->logger().warning(Poco::format("%s: Failed with: %s", std::string(__func__) , E.displayText()));
Daemon::instance()->logger().warning(Poco::format("%s: Failed with: %s", std::string(__func__) , E.displayText()));
}
}

View File

@@ -12,7 +12,7 @@
#include <string>
#include "Poco/JSON/Object.h"
namespace uCentral::Config {
namespace OpenWifi::Config {
class Config {
public:

View File

@@ -1,164 +0,0 @@
//
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#include "CommandChannel.h"
#include "AuthClient.h"
#include "CommandManager.h"
#include "Daemon.h"
#include "FileUploader.h"
#include "RESTAPI_server.h"
#include "StorageService.h"
#include "WebSocketServer.h"
#include <boost/algorithm/string.hpp>
namespace uCentral {
class CommandChannel * CommandChannel::instance_ = nullptr;
std::string CommandChannel::ProcessCommand(const std::string &Command) {
std::vector<std::string> Tokens{};
std::string Result{"OK"};
try {
size_t pos, old_pos = 0 ;
Logger_.notice(Poco::format("COMMAND: %s",Command));
while((pos = Command.find(' ', old_pos)) != std::string::npos) {
Tokens.push_back(Command.substr(old_pos,pos-old_pos));
old_pos = pos + 1 ;
}
Tokens.push_back(Command.substr(old_pos));
boost::algorithm::to_lower(Tokens[0]);
boost::algorithm::to_lower(Tokens[1]);
if(Tokens[0]=="set") {
if(Tokens[1]=="loglevel") {
if(!Daemon()->SetSubsystemLogLevel(Tokens[3],Tokens[2]))
Result = "ERROR: Invalid: set logLevel subsystem name:" + Tokens[3];
}
} else if(Tokens[0]=="get") {
if(Tokens[1]=="loglevel") {
std::cout << "LogLevels:" << std::endl;
std::cout << " Auth: " << AuthClient()->Logger().getLevel() << std::endl;
std::cout << " uFileUploader: " << FileUploader()->Logger().getLevel() << std::endl;
std::cout << " WebSocket: " << WebSocketServer()->Logger().getLevel() << std::endl;
std::cout << " Storage: " << Storage()->Logger().getLevel() << std::endl;
std::cout << " RESTAPI: " << RESTAPI_server()->Logger().getLevel() << std::endl;
std::cout << " CommandManager: " << Logger_.getLevel() << std::endl;
std::cout << " DeviceRegistry: " << DeviceRegistry()->Logger().getLevel() << std::endl;
} else if (Tokens[1]=="stats") {
} else {
Result = "ERROR: Invalid: get command:" + Tokens[1];
}
} else if(Tokens[0]=="restart") {
Logger_.information("RESTART...");
} else if(Tokens[0]=="stop") {
Logger_.information("STOP...");
} else if(Tokens[0]=="stats") {
Logger_.information("STATS...");
} else {
Result = "ERROR: Invalid command: " + Tokens[0];
}
Logger_.notice(Poco::format("COMMAND-RESULT: %s",Result));
}
catch ( const Poco::Exception & E) {
Logger_.warning(Poco::format("COMMAND: Poco exception %s in performing command.",E.displayText()));
}
catch ( const std::exception & E) {
Logger_.warning(Poco::format("COMMAND: std::exception %s in performing command.",std::string(E.what())));
}
return Result;
}
/// This class handles all client connections.
class UnixSocketServerConnection: public Poco::Net::TCPServerConnection
{
public:
explicit UnixSocketServerConnection(const Poco::Net::StreamSocket & S, Poco::Logger & Logger):
TCPServerConnection(S),
Logger_(Logger)
{
}
void run() override
{
try
{
std::string Message;
std::vector<char> buffer(1024);
int n = 1;
while (n > 0)
{
n = socket().receiveBytes(&buffer[0], (int)buffer.size());
buffer[n] = '\0';
Message += &buffer[0];
Logger_.information(Poco::format("COMMAND-CHANNEL: %s",Message));
if(buffer.size() > n && !Message.empty())
{
CommandChannel()->ProcessCommand(Message);
Message.clear();
}
}
}
catch (const Poco::Exception & E)
{
Logger_.log(E);
}
}
private:
Poco::Logger & Logger_;
};
class UnixSocketServerConnectionFactory: public Poco::Net::TCPServerConnectionFactory
{
public:
explicit UnixSocketServerConnectionFactory() :
Logger_(CommandChannel()->Logger())
{
}
Poco::Net::TCPServerConnection* createConnection(const Poco::Net::StreamSocket& socket) override
{
return new UnixSocketServerConnection(socket,Logger_);
}
private:
Poco::Logger & Logger_;
};
CommandChannel::CommandChannel() noexcept:
SubSystemServer("CommandChannel", "COMMAND-CHANNEL", "commandchannel")
{
}
void CommandChannel::Stop() {
Logger_.notice("Stopping...");
Srv_->stop();
}
int CommandChannel::Start() {
Poco::File F(Daemon()->ConfigPath("ucentral.system.commandchannel","/tmp/app.ucentralgw"));
try {
if (F.exists())
F.remove();
} catch (const Poco::Exception &E ) {
}
SocketFile_ = std::make_unique<Poco::File>(F);
UnixSocket_ = std::make_unique<Poco::Net::SocketAddress>(Poco::Net::SocketAddress::UNIX_LOCAL, SocketFile_->path());
Svs_ = std::make_unique<Poco::Net::ServerSocket>(*UnixSocket_);
Srv_ = std::make_unique<Poco::Net::TCPServer>(new UnixSocketServerConnectionFactory, *Svs_);
Srv_->start();
Logger_.notice("Starting...");
return 0;
}
}

View File

@@ -1,51 +0,0 @@
//
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#ifndef UCENTRALGW_COMMANDCHANNEL_H
#define UCENTRALGW_COMMANDCHANNEL_H
#include "SubSystemServer.h"
#include "Poco/File.h"
#include "Poco/Net/Socket.h"
#include "Poco/Net/SocketAddress.h"
#include "Poco/Net/TCPServer.h"
#include "Poco/Net/TCPServerConnection.h"
#include "Poco/Net/TCPServerConnectionFactory.h"
#include "Poco/Net/StreamSocket.h"
#include "Poco/Net/ServerSocket.h"
namespace uCentral {
class CommandChannel : public SubSystemServer {
public:
static CommandChannel *instance() {
if (instance_ == nullptr) {
instance_ = new CommandChannel;
}
return instance_;
}
int Start() override;
void Stop() override;
std::string ProcessCommand(const std::string &Command);
private:
static CommandChannel * instance_;
std::unique_ptr<Poco::File> SocketFile_;
std::unique_ptr<Poco::Net::SocketAddress> UnixSocket_;
std::unique_ptr<Poco::Net::ServerSocket> Svs_;
std::unique_ptr<Poco::Net::TCPServer> Srv_;
CommandChannel() noexcept;
};
inline CommandChannel * CommandChannel() { return CommandChannel::instance(); }
} //namespace
#endif // UCENTRALGW_COMMANDCHANNEL_H

View File

@@ -18,31 +18,38 @@
#include "Poco/JSON/Parser.h"
#define DBG std::cout << __LINE__ << " " __FILE__ << std::endl;
namespace uCentral {
namespace OpenWifi {
class CommandManager * CommandManager::instance_ = nullptr;
CommandManager::CommandManager() noexcept:
SubSystemServer("CommandManager", "CMD_MGR", "command.manager")
{
}
void CommandManager::run() {
Running_ = true;
while(Running_)
{
Poco::Thread::trySleep(10000);
Poco::Thread::trySleep(30000);
if(!Running_)
break;
std::vector<GWObjects::CommandDetails> Commands;
if(Storage()->GetReadyToExecuteCommands(0,1000,Commands))
std::vector<GWObjects::CommandDetails> Commands;
if(Storage()->GetReadyToExecuteCommands(1,200,Commands))
{
for(auto & Cmd: Commands)
{
if(!SendCommand(Cmd)) {
if(!Running_)
break;
uint64_t RPC_Id;
Poco::JSON::Parser P;
auto Params = P.parse(Cmd.Details).extract<Poco::JSON::Object::Ptr>();
if(SendCommand( Cmd.SerialNumber,
Cmd.Command,
*Params,
Cmd.UUID,
RPC_Id)) {
Storage()->SetCommandExecuted(Cmd.UUID);
Logger_.information(Poco::format("Sent command '%s' to '%s'",Cmd.Command,Cmd.SerialNumber));
} else {
Logger_.information(Poco::format("Failed to send command '%s' to %s",Cmd.Command,Cmd.SerialNumber));
}
}
@@ -70,107 +77,85 @@ namespace uCentral {
}
void CommandManager::Janitor() {
SubMutexGuard G(SubMutex);
std::lock_guard G(Mutex_);
uint64_t Now = time(nullptr);
for(auto i = Age_.begin(); i!= Age_.end();)
if((Now-i->first)>300)
Age_.erase(i++);
Logger_.information("Janitor starting.");
for(auto i=OutStandingRequests_.begin();i!=OutStandingRequests_.end();) {
if((Now-i->second.Submitted)>120)
i = OutStandingRequests_.erase(i);
else
++i;
}
Logger_.information("Janitor finished.");
}
bool CommandManager::SendCommand(const std::string &SerialNumber,
bool CommandManager::GetCommand(uint64_t Id, const std::string &SerialNumber, CommandTag &T) {
std::lock_guard G(Mutex_);
CommandTagIndex TI{.Id=Id,.SerialNumber=SerialNumber};
auto Hint=OutStandingRequests_.find(TI);
if(Hint==OutStandingRequests_.end() || Hint->second.Completed==0)
return false;
T = Hint->second;
OutStandingRequests_.erase(Hint);
return true;
}
bool CommandManager::SendCommand( const std::string &SerialNumber,
const std::string &Method,
const Poco::JSON::Object &Params,
std::shared_ptr<std::promise<Poco::JSON::Object::Ptr>> Promise,
const std::string &UUID) {
SubMutexGuard G(SubMutex);
const std::string &UUID,
uint64_t & Id,
bool oneway_rpc) {
std::stringstream ToSend;
std::unique_lock G(Mutex_);
if(oneway_rpc)
Id = 1;
else
Id = ++Id_;
Poco::JSON::Object CompleteRPC;
CompleteRPC.set(uCentralProtocol::JSONRPC, uCentralProtocol::JSONRPC_VERSION);
CompleteRPC.set(uCentralProtocol::ID, Id_);
CompleteRPC.set(uCentralProtocol::METHOD, Method );
CompleteRPC.set(uCentralProtocol::ID, Id);
CompleteRPC.set(uCentralProtocol::METHOD, Method);
CompleteRPC.set(uCentralProtocol::PARAMS, Params);
std::stringstream ToSend;
Poco::JSON::Stringifier::stringify(CompleteRPC, ToSend);
std::cout << "Count: " << Promise.use_count() << std::endl;
OutStandingRequests_[Id_] = std::make_pair(std::move(Promise),UUID);
Age_[Id_] = time(nullptr);
Id_++;
Logger_.information(
Poco::format("(%s): Sending command '%s', ID: %lu", SerialNumber, Method, Id));
CommandTagIndex Idx{.Id = Id, .SerialNumber = SerialNumber};
CommandTag Tag;
Tag.UUID = UUID;
Tag.Submitted = std::time(nullptr);
Tag.Completed = 0;
Tag.Result = Poco::makeShared<Poco::JSON::Object>();
OutStandingRequests_[Idx] = Tag;
G.unlock();
return DeviceRegistry()->SendFrame(SerialNumber, ToSend.str());
}
bool CommandManager::SendCommand(GWObjects::CommandDetails & Command) {
SubMutexGuard G(SubMutex);
Logger_.debug(Poco::format("Sending command to %s",Command.SerialNumber));
try {
Poco::JSON::Object Obj;
Obj.set(uCentralProtocol::JSONRPC,uCentralProtocol::JSONRPC_VERSION);
Obj.set(uCentralProtocol::ID,Id_);
Obj.set(uCentralProtocol::METHOD, Command.Custom ? uCentralProtocol::PERFORM : Command.Command );
bool FullCommand = true;
if(Command.Command==uCentralProtocol::REQUEST)
FullCommand = false;
// the params section was composed earlier... just include it here
Poco::JSON::Parser parser;
auto ParsedMessage = parser.parse(Command.Details);
const auto & ParamsObj = ParsedMessage.extract<Poco::JSON::Object::Ptr>();
Obj.set(uCentralProtocol::PARAMS,ParamsObj);
std::stringstream ToSend;
Poco::JSON::Stringifier::stringify(Obj,ToSend);
if(DeviceRegistry()->SendFrame(Command.SerialNumber, ToSend.str())) {
Storage()->SetCommandExecuted(Command.UUID);
OutStandingRequests_[Id_] = std::make_pair(nullptr,Command.UUID);
Age_[Id_] = time(nullptr);
return true;
} else {
}
Id_++;
}
catch( const Poco::Exception & E )
{
Logger_.warning(Poco::format("COMMAND(%s): Exception while sending a command.",Command.SerialNumber));
}
return false;
}
void CommandManager::PostCommandResult(const std::string &SerialNumber, Poco::JSON::Object::Ptr Obj) {
if(!Obj->has(uCentralProtocol::ID)){
Logger_.error("Invalid RPC response.");
Logger_.error(Poco::format("(%s): Invalid RPC response.",SerialNumber));
return;
}
SubMutexGuard G(SubMutex);
uint64_t ID = Obj->get(uCentralProtocol::ID);
auto RPC = OutStandingRequests_.find(ID);
Age_.erase(ID);
if(RPC != OutStandingRequests_.end()) {
if(RPC->second.first.use_count() > 1) {
try {
RPC->second.first->set_value(std::move(Obj));
} catch (...) {
Logger_.error(Poco::format("COMPLETING-RPC(%Lu): future was lost", ID));
Storage()->CommandCompleted(RPC->second.second, Obj, true);
if(ID<2) {
Logger_.error(Poco::format("(%s): Ignoring RPC response.",SerialNumber));
return;
}
std::unique_lock G(Mutex_);
auto Idx = CommandTagIndex{.Id = ID, .SerialNumber = SerialNumber};
auto RPC = OutStandingRequests_.find(Idx);
if (RPC == OutStandingRequests_.end()) {
Logger_.warning(Poco::format("(%s): Outdated RPC %lu", SerialNumber, ID));
return;
}
else {
Storage()->CommandCompleted(RPC->second.second, Obj, true);
}
OutStandingRequests_.erase(RPC);
} else {
Logger_.warning(Poco::format("OUTDATED-RPC(%lu): Nothing waiting for this RPC.",ID));
}
RPC->second.Completed = std::time(nullptr);
RPC->second.Result = Obj;
Logger_.information(Poco::format("(%s): Received RPC answer %lu", SerialNumber, ID));
G.unlock();
Storage()->CommandCompleted(RPC->second.UUID, Obj, true);
}
} // namespace

View File

@@ -22,7 +22,33 @@
#include "RESTAPI_GWobjects.h"
#include "SubSystemServer.h"
namespace uCentral {
namespace OpenWifi {
struct CommandTagIndex {
uint64_t Id=0;
std::string SerialNumber;
};
inline bool operator <(const CommandTagIndex& lhs, const CommandTagIndex& rhs) {
if(lhs.Id<rhs.Id)
return true;
if(lhs.Id>rhs.Id)
return false;
return lhs.SerialNumber<rhs.SerialNumber;
}
inline bool operator ==(const CommandTagIndex& lhs, const CommandTagIndex& rhs) {
if(lhs.Id == rhs.Id && lhs.SerialNumber == rhs.SerialNumber)
return true;
return false;
}
struct CommandTag {
std::string UUID;
Poco::JSON::Object::Ptr Result;
uint64_t Submitted=0;
uint64_t Completed=0;
};
class CommandManager : public SubSystemServer, Poco::Runnable {
public:
@@ -33,32 +59,33 @@ namespace uCentral {
bool SendCommand( const std::string &SerialNumber,
const std::string &Method,
const Poco::JSON::Object &Params,
std::shared_ptr<std::promise<Poco::JSON::Object::Ptr>> Promise,
const std::string &UUID);
bool SendCommand( const std::string & SerialNumber,
const std::string & Method,
const Poco::JSON::Object &Params,
const std::string & UUID);
bool SendCommand(GWObjects::CommandDetails & Command);
const std::string &UUID,
uint64_t & Id,
bool oneway_rpc=false);
void Janitor();
void run() override;
bool GetCommand(uint64_t Id, const std::string & SerialNumber, CommandTag &T);
static CommandManager *instance() {
if (instance_ == nullptr) {
instance_ = new CommandManager;
}
return instance_;
}
inline bool Running() const { return Running_; }
private:
static CommandManager * instance_;
std::atomic_bool Running_ = false;
Poco::Thread ManagerThread;
uint64_t Id_=1;
std::map< uint64_t , std::pair< std::shared_ptr<std::promise<Poco::JSON::Object::Ptr>>, std::string> > OutStandingRequests_;
std::map< uint64_t , uint64_t > Age_;
uint64_t Id_=2; // do not start @1. We ignore ID=1 & 0 is illegal..
std::map<CommandTagIndex,CommandTag> OutStandingRequests_;
CommandManager() noexcept;
CommandManager() noexcept:
SubSystemServer("CommandManager", "CMD-MGR", "command.manager")
{
}
};
inline CommandManager * CommandManager() { return CommandManager::instance(); }

View File

@@ -0,0 +1,9 @@
//
// Created by stephane bourque on 2021-09-21.
//
#include "ConfigurationCache.h"
namespace OpenWifi {
class ConfigurationCache * ConfigurationCache::instance_ = nullptr;
}

44
src/ConfigurationCache.h Normal file
View File

@@ -0,0 +1,44 @@
//
// Created by stephane bourque on 2021-09-21.
//
#ifndef OWGW_CONFIGURATIONCACHE_H
#define OWGW_CONFIGURATIONCACHE_H
#include <map>
#include <string>
#include <mutex>
namespace OpenWifi {
class ConfigurationCache {
public:
static ConfigurationCache &instance() {
if(instance_== nullptr)
instance_ = new ConfigurationCache;
return *instance_;
}
inline uint64_t CurrentConfig(const std::string &SerialNumber) {
std::lock_guard G(Mutex_);
const auto Hint = Cache_.find(SerialNumber);
if(Hint==end(Cache_))
return 0;
return Hint->second;
}
void Add(const std::string &SerialNumber, uint64_t Id) {
std::lock_guard G(Mutex_);
Cache_[SerialNumber]=Id;
}
private:
static ConfigurationCache *instance_;
std::mutex Mutex_;
std::map<std::string,uint64_t> Cache_;
};
inline uint64_t GetCurrentConfigurationID(const std::string &S) { return ConfigurationCache::instance().CurrentConfig(S); }
inline void SetCurrentConfigurationID(const std::string &S, uint64_t ID) { ConfigurationCache::instance().Add(S,ID); }
}
#endif // OWGW_CONFIGURATIONCACHE_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,70 @@
//
// Created by stephane bourque on 2021-09-14.
//
#ifndef OWPROV_CONFIGURATIONVALIDATOR_H
#define OWPROV_CONFIGURATIONVALIDATOR_H
#include <nlohmann/json-schema.hpp>
#include "Poco/Logger.h"
#include "SubSystemServer.h"
using nlohmann::json;
using nlohmann::json_schema::json_validator;
namespace OpenWifi {
class ConfigurationValidator : public SubSystemServer {
public:
static ConfigurationValidator *instance() {
if(instance_== nullptr)
instance_ = new ConfigurationValidator;
return instance_;
}
bool Validate(const std::string &C);
static void my_format_checker(const std::string &format, const std::string &value)
{
/*
"format": "uc-mac"
"format": "uc-timeout",
"format": "uc-cidr4",
"format": "uc-cidr6",
"uc-format": "cidr",
"format": "fqdn",
"format": "uc-host",
"format": "uri"
"format": "hostname"
"format": "uc-base64"
if (format == "something") {
return;
if (!check_value_for_something(value))
throw std::invalid_argument("value is not a good something");
} else
throw std::logic_error("Don't know how to validate " + format);
*/
}
int Start() override;
void Stop() override;
void reinitialize(Poco::Util::Application &self) override;
private:
static ConfigurationValidator * instance_;
bool Initialized_=false;
bool Working_=false;
void Init();
std::unique_ptr<json_validator> Validator_=std::make_unique<json_validator>(nullptr, my_format_checker);
ConfigurationValidator():
SubSystemServer("configvalidator", "CFG-VALIDATOR", "config.validator") {
}
};
inline ConfigurationValidator * ConfigurationValidator() { return ConfigurationValidator::instance(); }
inline bool ValidateUCentralConfiguration(const std::string &C) { return ConfigurationValidator::instance()->Validate(C); }
}
#endif //OWPROV_CONFIGURATIONVALIDATOR_H

View File

@@ -14,8 +14,6 @@
#include "Daemon.h"
#include "CallbackManager.h"
#include "CommandChannel.h"
#include "CommandManager.h"
#include "DeviceRegistry.h"
#include "FileUploader.h"
@@ -29,8 +27,11 @@
#include "RESTAPI_InternalServer.h"
#include "AuthClient.h"
#include "StorageArchiver.h"
#include "SerialNumberCache.h"
#include "TelemetryStream.h"
#include "ConfigurationValidator.h"
namespace uCentral {
namespace OpenWifi {
class Daemon *Daemon::instance_ = nullptr;
class Daemon *Daemon::instance() {
@@ -42,6 +43,8 @@ namespace uCentral {
vDAEMON_BUS_TIMER,
Types::SubSystemVec{
Storage(),
SerialNumberCache(),
ConfigurationValidator(),
AuthClient(),
DeviceRegistry(),
RESTAPI_server(),
@@ -50,9 +53,8 @@ namespace uCentral {
CommandManager(),
FileUploader(),
OUIServer(),
CommandChannel(),
CallbackManager(),
StorageArchiver(),
TelemetryStream()
});
}
return instance_;
@@ -61,19 +63,19 @@ namespace uCentral {
void Daemon::initialize(Poco::Util::Application &self) {
MicroService::initialize(*this);
Config::Config::Init();
AutoProvisioning_ = config().getBool("ucentral.autoprovisioning",false);
AutoProvisioning_ = config().getBool("openwifi.autoprovisioning",false);
// DeviceTypeIdentifications_
Types::StringVec Keys;
config().keys("ucentral.devicetypes",Keys);
config().keys("openwifi.devicetypes",Keys);
for(const auto & i:Keys)
{
std::string Line = config().getString("ucentral.devicetypes."+i);
std::string Line = config().getString("openwifi.devicetypes."+i);
auto P1 = Line.find_first_of(':');
auto Type = Line.substr(0, P1);
auto List = Line.substr(P1+1);
Types::StringVec Tokens = uCentral::Utils::Split(List);
Types::StringVec Tokens = Utils::Split(List);
auto Entry = DeviceTypeIdentifications_.find(Type);
if(DeviceTypeIdentifications_.end() == Entry) {
@@ -98,7 +100,7 @@ namespace uCentral {
int main(int argc, char **argv) {
try {
auto App = uCentral::Daemon::instance();
auto App = OpenWifi::Daemon::instance();
auto ExitCode = App->run(argc, argv);
delete App;

View File

@@ -25,35 +25,40 @@
#include "Poco/Crypto/CipherFactory.h"
#include "Poco/Crypto/Cipher.h"
#include "Dashboard.h"
#include "MicroService.h"
#include "uCentralTypes.h"
#include "OpenWifiTypes.h"
namespace uCentral {
namespace OpenWifi {
static const char * vDAEMON_PROPERTIES_FILENAME = "ucentralgw.properties";
static const char * vDAEMON_ROOT_ENV_VAR = "UCENTRALGW_ROOT";
static const char * vDAEMON_CONFIG_ENV_VAR = "UCENTRALGW_CONFIG";
static const char * vDAEMON_PROPERTIES_FILENAME = "owgw.properties";
static const char * vDAEMON_ROOT_ENV_VAR = "OWGW_ROOT";
static const char * vDAEMON_CONFIG_ENV_VAR = "OWGW_CONFIG";
static const char * vDAEMON_APP_NAME = uSERVICE_GATEWAY.c_str();
static const uint64_t vDAEMON_BUS_TIMER = 10000;
class Daemon : public MicroService {
public:
explicit Daemon(std::string PropFile,
std::string RootEnv,
std::string ConfigEnv,
std::string AppName,
explicit Daemon(const std::string & PropFile,
const std::string & RootEnv,
const std::string & ConfigEnv,
const std::string & AppName,
uint64_t BusTimer,
Types::SubSystemVec SubSystems) :
const Types::SubSystemVec & SubSystems) :
MicroService( PropFile, RootEnv, ConfigEnv, AppName, BusTimer, SubSystems) {};
bool AutoProvisioning() const { return AutoProvisioning_ ; }
[[nodiscard]] std::string IdentifyDevice(const std::string & Compatible) const;
void initialize(Poco::Util::Application &self);
void initialize(Poco::Util::Application &self) override;
static Daemon *instance();
inline DeviceDashboard & GetDashboard() { return DB_; }
Poco::Logger & Log() { return Poco::Logger::get(AppName()); }
private:
static Daemon *instance_;
bool AutoProvisioning_ = false;
Types::StringMapStringSet DeviceTypeIdentifications_;
DeviceDashboard DB_;
};
inline Daemon * Daemon() { return Daemon::instance(); }

20
src/Dashboard.cpp Normal file
View File

@@ -0,0 +1,20 @@
//
// Created by stephane bourque on 2021-07-21.
//
#include "Dashboard.h"
#include "DeviceRegistry.h"
#include "StorageService.h"
namespace OpenWifi {
void DeviceDashboard::Create() {
uint64_t Now = std::time(nullptr);
if(LastRun_==0 || (Now-LastRun_)>120) {
DB_.reset();
Storage()->AnalyzeCommands(DB_.commands);
Storage()->AnalyzeDevices(DB_);
LastRun_ = Now;
}
}
}

24
src/Dashboard.h Normal file
View File

@@ -0,0 +1,24 @@
//
// Created by stephane bourque on 2021-07-21.
//
#ifndef UCENTRALGW_DASHBOARD_H
#define UCENTRALGW_DASHBOARD_H
#include "OpenWifiTypes.h"
#include "RESTAPI_GWobjects.h"
namespace OpenWifi {
class DeviceDashboard {
public:
DeviceDashboard() { DB_.reset(); }
void Create();
[[nodiscard]] const GWObjects::Dashboard & Report() const { return DB_;}
private:
GWObjects::Dashboard DB_;
uint64_t LastRun_=0;
inline void Reset() { DB_.reset(); }
};
}
#endif // UCENTRALGW_DASHBOARD_H

View File

@@ -12,8 +12,11 @@
#include "WebSocketServer.h"
#include "DeviceRegistry.h"
#include "OUIServer.h"
#include "Poco/JSON/Object.h"
#include "Poco/JSON/Parser.h"
namespace uCentral {
namespace OpenWifi {
class DeviceRegistry *DeviceRegistry::instance_ = nullptr;
DeviceRegistry::DeviceRegistry() noexcept:
@@ -21,29 +24,29 @@ namespace uCentral {
}
int DeviceRegistry::Start() {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
Logger_.notice("Starting ");
return 0;
}
void DeviceRegistry::Stop() {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
Logger_.notice("Stopping ");
}
bool DeviceRegistry::GetStatistics(const std::string &SerialNumber, std::string & Statistics) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
if(Device != Devices_.end()) {
if(Device == Devices_.end())
return false;
Statistics = Device->second->LastStats;
return true;
}
return false;
}
void DeviceRegistry::SetStatistics(const std::string &SerialNumber, const std::string &Statistics) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
@@ -55,22 +58,18 @@ namespace uCentral {
}
bool DeviceRegistry::GetState(const std::string &SerialNumber, GWObjects::ConnectionState & State) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
if(Device != Devices_.end())
{
if(Device == Devices_.end())
return false;
State = Device->second->Conn_;
return true;
}
return false;
}
void DeviceRegistry::SetState(const std::string & SerialNumber, GWObjects::ConnectionState & State) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
if(Device != Devices_.end())
{
Device->second->Conn_.LastContact = time(nullptr);
@@ -78,8 +77,8 @@ namespace uCentral {
}
}
bool DeviceRegistry::GetHealthcheck(const std::string &SerialNumber, std::string & CheckData) {
SubMutexGuard Guard(Mutex_);
bool DeviceRegistry::GetHealthcheck(const std::string &SerialNumber, GWObjects::HealthCheck & CheckData) {
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
if(Device != Devices_.end()) {
@@ -89,8 +88,8 @@ namespace uCentral {
return false;
}
void DeviceRegistry::SetHealthcheck(const std::string &SerialNumber, const std::string &CheckData) {
SubMutexGuard Guard(Mutex_);
void DeviceRegistry::SetHealthcheck(const std::string &SerialNumber, const GWObjects::HealthCheck & CheckData) {
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
@@ -102,7 +101,7 @@ namespace uCentral {
GWObjects::ConnectionState * DeviceRegistry::Register(const std::string & SerialNumber, WSConnection *Ptr)
{
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
if( Device == Devices_.end()) {
@@ -133,7 +132,7 @@ namespace uCentral {
}
bool DeviceRegistry::Connected(const std::string & SerialNumber) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
@@ -144,7 +143,7 @@ namespace uCentral {
}
void DeviceRegistry::UnRegister(const std::string & SerialNumber, WSConnection *Ptr) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
@@ -152,51 +151,124 @@ namespace uCentral {
Device->second->Conn_.Address = "";
Device->second->WSConn_ = nullptr;
Device->second->Conn_.Connected = false;
Device->second->Conn_.LastContact = time(nullptr);
Device->second->Conn_.VerifiedCertificate = GWObjects::NO_CERTIFICATE;
}
}
bool DeviceRegistry::SendFrame(const std::string & SerialNumber, const std::string & Payload) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
if(Device!=Devices_.end() && Device->second->WSConn_!= nullptr) {
auto *WSConn =
static_cast<WSConnection *>(Device->second->WSConn_);
return WSConn->Send(Payload);
return Device->second->WSConn_->Send(Payload);
}
return false;
}
void DeviceRegistry::SetPendingUUID(const std::string & SerialNumber, uint64_t PendingUUID) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
auto Device = Devices_.find(SerialNumber);
if(Device!=Devices_.end()) {
Device->second->Conn_.PendingUUID = PendingUUID;
}
}
/* bool Service::SendCommand(uCentral::Objects::CommandDetails & Cmd)
{
SubMutexGuard Guard(Mutex_);
std::string ComputeCertificateTag( GWObjects::CertificateValidation V) {
switch(V) {
case GWObjects::NO_CERTIFICATE: return "no certificate";
case GWObjects::VALID_CERTIFICATE: return "non TIP certificate";
case GWObjects::MISMATCH_SERIAL: return "serial mismatch";
case GWObjects::VERIFIED: return "verified";
}
return "unknown";
}
auto Device = Devices_.find(Cmd.SerialNumber);
const uint64_t SECONDS_MONTH = 30*24*60*60;
const uint64_t SECONDS_WEEK = 7*24*60*60;
const uint64_t SECONDS_DAY = 1*24*60*60;
const uint64_t SECONDS_HOUR = 1*24*60*60;
try {
if (Device != Devices_.end()) {
if (Device->second->Conn_.Connected) {
if (Device->second->WSConn_ != nullptr) {
auto *WSConn = static_cast<uCentral::WebSocket::WSConnection *>(Device->second->WSConn_);
WSConn->SendCommand(Cmd);
return true;
std::string ComputeUpLastContactTag(uint64_t T1) {
uint64_t T = T1 - std::time(nullptr);
if( T>SECONDS_MONTH) return ">month";
if( T>SECONDS_WEEK) return ">week";
if( T>SECONDS_DAY) return ">day";
if( T>SECONDS_HOUR) return ">hour";
return "now";
}
std::string ComputeSanityTag(uint64_t T) {
if( T==100) return "100%";
if( T>90) return ">90%";
if( T>60) return ">60%";
return "<60%";
}
std::string ComputeUpTimeTag(uint64_t T) {
if( T>SECONDS_MONTH) return ">month";
if( T>SECONDS_WEEK) return ">week";
if( T>SECONDS_DAY) return ">day";
if( T>SECONDS_HOUR) return ">hour";
return "now";
}
std::string ComputeLoadTag(uint64_t T) {
float V=100.0*((float)T/65536.0);
if(V<5.0) return "< 5%";
if(V<25.0) return "< 25%";
if(V<50.0) return "< 50%";
if(V<75.0) return "< 75%";
return ">75%";
}
std::string ComputeFreeMemoryTag(uint64_t Free, uint64_t Total) {
float V = 100.0 * ((float)Free/(float(Total)));
if(V<5.0) return "< 5%";
if(V<25.0) return "< 25%";
if(V<50.0) return "< 50%";
if(V<75.0) return "< 75%";
return ">75%";
}
bool DeviceRegistry::AnalyzeRegistry(GWObjects::Dashboard &D) {
std::lock_guard Guard(Mutex_);
for(auto const &[SerialNumber,Connection]:Devices_) {
Types::UpdateCountedMap(D.status, Connection->Conn_.Connected ? "connected" : "not connected");
Types::UpdateCountedMap(D.vendors, OUIServer()->GetManufacturer(SerialNumber));
Types::UpdateCountedMap(D.certificates, ComputeCertificateTag(Connection->Conn_.VerifiedCertificate));
Types::UpdateCountedMap(D.lastContact, ComputeUpLastContactTag(Connection->Conn_.LastContact));
Types::UpdateCountedMap(D.healths, ComputeSanityTag(Connection->LastHealthcheck.Sanity));
Types::UpdateCountedMap(D.deviceType, Connection->Conn_.Compatible);
if(!Connection->LastStats.empty()) {
Poco::JSON::Parser P;
auto RawObject = P.parse(Connection->LastStats).extract<Poco::JSON::Object::Ptr>();
if(RawObject->has("unit")) {
auto Unit = RawObject->getObject("unit");
if (Unit->has("uptime")) {
Types::UpdateCountedMap(D.upTimes, ComputeUpTimeTag(Unit->get("uptime")));
}
if (Unit->has("memory")) {
auto Memory = Unit->getObject("memory");
uint64_t Free = Memory->get("free");
uint64_t Total = Memory->get("total");
Types::UpdateCountedMap(D.memoryUsed, ComputeFreeMemoryTag(Free, Total));
}
if (Unit->has("load")) {
auto Load = Unit->getArray("load");
Types::UpdateCountedMap(D.load1,
ComputeLoadTag(Load->getElement<uint64_t>(0)));
Types::UpdateCountedMap(D.load5,
ComputeLoadTag(Load->getElement<uint64_t>(1)));
Types::UpdateCountedMap(D.load15,
ComputeLoadTag(Load->getElement<uint64_t>(2)));
}
}
}
} catch(...) {
Logger_.error(Poco::format("COMMAND(%s): Cannot send command %s.",Cmd.SerialNumber, Cmd.Command));
}
return false;
}
*/
} // namespace

View File

@@ -16,7 +16,7 @@
// class uCentral::WebSocket::WSConnection;
namespace uCentral {
namespace OpenWifi {
class WSConnection;
class DeviceRegistry : public SubSystemServer {
@@ -25,7 +25,7 @@ namespace uCentral {
WSConnection *WSConn_;
GWObjects::ConnectionState Conn_;
std::string LastStats;
std::string LastHealthcheck;
GWObjects::HealthCheck LastHealthcheck;
};
static DeviceRegistry *instance() {
@@ -41,8 +41,8 @@ namespace uCentral {
void SetStatistics(const std::string &SerialNumber, const std::string &stats);
bool GetState(const std::string & SerialNumber, GWObjects::ConnectionState & State);
void SetState(const std::string & SerialNumber, GWObjects::ConnectionState & State);
bool GetHealthcheck(const std::string &SerialNumber, std::string & Statistics);
void SetHealthcheck(const std::string &SerialNumber, const std::string &stats);
bool GetHealthcheck(const std::string &SerialNumber, GWObjects::HealthCheck & CheckData);
void SetHealthcheck(const std::string &SerialNumber, const GWObjects::HealthCheck &H);
GWObjects::ConnectionState * Register(const std::string & SerialNumber, WSConnection *);
void UnRegister(const std::string & SerialNumber, WSConnection *);
bool SendCommand(GWObjects::CommandDetails & Command);
@@ -50,6 +50,8 @@ namespace uCentral {
bool SendFrame(const std::string & SerialNumber, const std::string & Payload);
void SetPendingUUID(const std::string & SerialNumber, uint64_t PendingUUID);
bool AnalyzeRegistry(GWObjects::Dashboard &D);
private:
static DeviceRegistry *instance_;
std::map<std::string,std::unique_ptr<ConnectionEntry>> Devices_;

View File

@@ -26,30 +26,31 @@
#include "Utils.h"
namespace uCentral {
namespace OpenWifi {
class FileUploader *FileUploader::instance_ = nullptr;
FileUploader::FileUploader() noexcept:
SubSystemServer("FileUploader", "FILE-UPLOAD", "ucentral.fileuploader")
{
SubMutexGuard Guard(Mutex_);
}
static const std::string URI_BASE{"/v1/upload/"};
int FileUploader::Start() {
Logger_.notice("Starting.");
Poco::File UploadsDir(Daemon()->ConfigPath("openwifi.fileuploader.path","/tmp"));
Path_ = UploadsDir.path();
if(!UploadsDir.exists()) {
try {
UploadsDir.createDirectory();
} catch (const Poco::Exception &E) {
Logger_.log(E);
Path_ = "/tmp";
}
}
for(const auto & Svr: ConfigServersList_) {
std::string l{"Starting: " +
Svr.Address() + ":" + std::to_string(Svr.Port()) +
" key:" + Svr.KeyFile() +
" cert:" + Svr.CertFile()};
Logger_.information(l);
Path_ = Daemon()->ConfigPath("ucentral.fileuploader.path","/tmp");
auto Sock{Svr.CreateSecureSocket(Logger_)};
Svr.LogCert(Logger_);
@@ -61,24 +62,40 @@ namespace uCentral {
Params->setMaxQueued(100);
if(FullName_.empty()) {
FullName_ = "https://" + Svr.Name() + ":" + std::to_string(Svr.Port()) + URI_BASE;
std::string TmpName = Daemon()->ConfigGetString("openwifi.fileuploader.uri","");
if(TmpName.empty()) {
FullName_ =
"https://" + Svr.Name() + ":" + std::to_string(Svr.Port()) + URI_BASE;
} else {
FullName_ = TmpName + URI_BASE ;
}
Logger_.information(Poco::format("Uploader URI base is '%s'", FullName_));
}
auto NewServer = std::make_unique<Poco::Net::HTTPServer>(new FileUpLoaderRequestHandlerFactory(Logger_), Pool_, Sock, Params);
NewServer->start();
Servers_.push_back(std::move(NewServer));
}
MaxSize_ = 1000 * Daemon()->ConfigGetInt("openwifi.fileuploader.maxsize", 10000);
return 0;
}
void FileUploader::reinitialize(Poco::Util::Application &self) {
Daemon()->LoadConfigurationFile();
Logger_.information("Reinitializing.");
Stop();
Start();
}
const std::string & FileUploader::FullName() {
return FullName_;
}
// if you pass in an empty UUID, it will just clean the list and not add it.
bool FileUploader::AddUUID( const std::string & UUID) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
uint64_t Now = time(nullptr) ;
@@ -97,20 +114,20 @@ namespace uCentral {
}
bool FileUploader::ValidRequest(const std::string &UUID) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
return OutStandingUploads_.find(UUID)!=OutStandingUploads_.end();
}
void FileUploader::RemoveRequest(const std::string &UUID) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
OutStandingUploads_.erase(UUID);
}
class MyPartHandler: public Poco::Net::PartHandler
class FileUploaderPartHandler: public Poco::Net::PartHandler
{
public:
MyPartHandler(std::string UUID, Poco::Logger & Logger):
FileUploaderPartHandler(std::string UUID, Poco::Logger & Logger):
UUID_(std::move(UUID)),
Logger_(Logger)
{
@@ -118,42 +135,54 @@ namespace uCentral {
void handlePart(const Poco::Net::MessageHeader& Header, std::istream& Stream) override
{
FileType_ = Header.get("Content-Type", "(unspecified)");
if (Header.has("Content-Disposition"))
{
try {
Name_ = "(unnamed)";
if (Header.has("Content-Disposition")) {
std::string Disposition;
Poco::Net::NameValueCollection Parameters;
Poco::Net::MessageHeader::splitParameters(Header["Content-Disposition"], Disposition, Parameters);
Name_ = Parameters.get("name", "(unnamed)");
Poco::Net::MessageHeader::splitParameters(Header["Content-Disposition"],
Disposition, Parameters);
Name_ = Parameters.get("filename", "(unnamed)");
}
std::string FinalFileName = FileUploader()->Path() + "/" + UUID_;
Logger_.information(Poco::format("FILE-UPLOADER: uploading trace for %s", FinalFileName));
Poco::CountingInputStream InputStream(Stream);
std::string TmpFileName = FileUploader()->Path() + "/" + UUID_ + ".upload.start" ;
std::string FinalFileName = FileUploader()->Path() + "/" + UUID_ ;
Logger_.information(Poco::format("FILE-UPLOADER: uploading %s",TmpFileName));
std::ofstream OutputStream(TmpFileName, std::ofstream::out);
std::ofstream OutputStream(FinalFileName, std::ofstream::out);
Poco::StreamCopier::copyStream(InputStream, OutputStream);
Length_ = InputStream.chars();
rename(TmpFileName.c_str(),FinalFileName.c_str());
Poco::File TmpFile(FinalFileName);
Length_ = TmpFile.getSize();
if (Length_ < FileUploader()->MaxSize()) {
Good_=true;
} else {
TmpFile.remove();
Error_ = "File is too large.";
}
return;
} catch (const Poco::Exception &E ) {
Logger_.log(E);
Error_ = std::string("Upload caused an internal error: ") + E.what() ;
}
}
[[nodiscard]] uint64_t Length() const { return Length_; }
[[nodiscard]] const std::string& Name() const { return Name_; }
[[nodiscard]] const std::string& ContentType() const { return FileType_; }
[[nodiscard]] bool Good() const { return Good_; }
std::string & Error() { return Error_; }
private:
uint64_t Length_=0;
std::string FileType_;
bool Good_=false;
std::string Name_;
std::string UUID_;
std::string Error_;
Poco::Logger & Logger_;
};
class FormRequestHandler: public Poco::Net::HTTPRequestHandler
/// Return a HTML document with the current date and time.
{
public:
explicit FormRequestHandler(std::string UUID, Poco::Logger & L):
@@ -165,62 +194,27 @@ namespace uCentral {
void handleRequest(Poco::Net::HTTPServerRequest& Request, Poco::Net::HTTPServerResponse& Response) override
{
try {
MyPartHandler partHandler(UUID_,Logger_);
FileUploaderPartHandler partHandler(UUID_,Logger_);
Poco::Net::HTMLForm form(Request, Request.stream(), partHandler);
Response.setChunkedTransferEncoding(true);
Response.setContentType("text/html");
std::ostream &ResponseStream = Response.send();
ResponseStream <<
"<html>\n"
"<head>\n"
"<title>POCO Form Server Sample</title>\n"
"</head>\n"
"<body>\n"
"<h1>POCO Form Server Sample</h1>\n"
"<h2>GET Form</h2>\n"
"<form method=\"GET\" action=\"/form\">\n"
"<input type=\"text\" name=\"text\" size=\"31\">\n"
"<input type=\"submit\" value=\"GET\">\n"
"</form>\n"
"<h2>POST Form</h2>\n"
"<form method=\"POST\" action=\"/form\">\n"
"<input type=\"text\" name=\"text\" size=\"31\">\n"
"<input type=\"submit\" value=\"POST\">\n"
"</form>\n"
"<h2>File Upload</h2>\n"
"<form method=\"POST\" action=\"/form\" enctype=\"multipart/form-data\">\n"
"<input type=\"file\" name=\"file\" size=\"31\"> \n"
"<input type=\"submit\" value=\"Upload\">\n"
"</form>\n";
ResponseStream << "<h2>Request</h2><p>\n";
ResponseStream << "Method: " << Request.getMethod() << "<br>\n";
ResponseStream << "URI: " << Request.getURI() << "<br>\n";
for (auto & i:Request) {
ResponseStream << i.first << ": " << i.second << "<br>\n";
}
ResponseStream << "</p>";
if (!form.empty()) {
ResponseStream << "<h2>Form</h2><p>\n";
for (const auto & i:form)
ResponseStream << i.first << ": " << i.second << "<br>\n";
ResponseStream << "</p>";
}
if (!partHandler.Name().empty()) {
ResponseStream << "<h2>Upload</h2><p>\n";
ResponseStream << "Name: " << partHandler.Name() << "<br>\n";
ResponseStream << "Type: " << partHandler.ContentType() << "<br>\n";
ResponseStream << "Size: " << partHandler.Length() << "<br>\n";
ResponseStream << "</p>";
}
ResponseStream << "</body>\n";
Response.setContentType("application/json");
Poco::JSON::Object Answer;
if (partHandler.Good()) {
Answer.set("filename", UUID_);
Answer.set("error", 0);
Storage()->AttachFileToCommand(UUID_);
} else {
Answer.set("filename", UUID_);
Answer.set("error", 13);
Answer.set("errorText", partHandler.Error() );
Storage()->CancelWaitFile(UUID_, partHandler.Error() );
}
std::ostream &ResponseStream = Response.send();
Poco::JSON::Stringifier::stringify(Answer, ResponseStream);
return;
}
catch( const Poco::Exception & E )
{
@@ -237,7 +231,7 @@ namespace uCentral {
Poco::Net::HTTPRequestHandler *FileUpLoaderRequestHandlerFactory::createRequestHandler(const Poco::Net::HTTPServerRequest & Request) {
Logger_.debug(Poco::format("REQUEST(%s): %s %s", uCentral::Utils::FormatIPv6(Request.clientAddress().toString()), Request.getMethod(), Request.getURI()));
Logger_.debug(Poco::format("REQUEST(%s): %s %s", Utils::FormatIPv6(Request.clientAddress().toString()), Request.getMethod(), Request.getURI()));
// The UUID should be after the /v1/upload/ part...
auto UUIDLocation = Request.getURI().find_first_of(URI_BASE);
@@ -263,6 +257,7 @@ namespace uCentral {
Logger_.notice("Stopping ");
for( const auto & svr : Servers_ )
svr->stop();
Servers_.clear();
}
} // Namespace

View File

@@ -15,13 +15,15 @@
#include "Poco/Net/HTTPRequestHandler.h"
#include "Poco/Net/HTTPRequestHandlerFactory.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "RESTAPI_handler.h"
namespace uCentral {
namespace OpenWifi {
class FileUploader : public SubSystemServer {
public:
int Start() override;
void Stop() override;
void reinitialize(Poco::Util::Application &self) override;
const std::string & FullName();
bool AddUUID( const std::string & UUID);
bool ValidRequest(const std::string & UUID);
@@ -35,6 +37,8 @@ namespace uCentral {
return instance_;
}
[[nodiscard]] inline uint64_t MaxSize() const { return MaxSize_; }
private:
static FileUploader *instance_;
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> Servers_;
@@ -42,8 +46,12 @@ namespace uCentral {
std::string FullName_;
std::map<std::string,uint64_t> OutStandingUploads_;
std::string Path_;
uint64_t MaxSize_=10000000;
FileUploader() noexcept;
explicit FileUploader() noexcept:
SubSystemServer("FileUploader", "FILE-UPLOAD", "openwifi.fileuploader")
{
}
};
class FileUpLoaderRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory {

View File

@@ -12,18 +12,18 @@
#include "Daemon.h"
#include "Utils.h"
namespace uCentral {
namespace OpenWifi {
class KafkaManager *KafkaManager::instance_ = nullptr;
KafkaManager::KafkaManager() noexcept:
SubSystemServer("KafkaManager", "KAFKA-SVR", "ucentral.kafka")
SubSystemServer("KafkaManager", "KAFKA-SVR", "openwifi.kafka")
{
}
void KafkaManager::initialize(Poco::Util::Application & self) {
SubSystemServer::initialize(self);
KafkaEnabled_ = Daemon()->ConfigGetBool("ucentral.kafka.enable",false);
KafkaEnabled_ = Daemon()->ConfigGetBool("openwifi.kafka.enable",false);
}
#ifdef SMALL_BUILD
@@ -55,20 +55,20 @@ namespace uCentral {
void KafkaManager::ProducerThr() {
cppkafka::Configuration Config({
{ "client.id", Daemon()->ConfigGetString("ucentral.kafka.client.id") },
{ "metadata.broker.list", Daemon()->ConfigGetString("ucentral.kafka.brokerlist") }
{ "client.id", Daemon()->ConfigGetString("openwifi.kafka.client.id") },
{ "metadata.broker.list", Daemon()->ConfigGetString("openwifi.kafka.brokerlist") }
});
SystemInfoWrapper_ = R"lit({ "system" : { "id" : )lit" +
std::to_string(Daemon()->ID()) +
R"lit( , "host" : ")lit" + Daemon()->PrivateEndPoint() +
R"lit(" } , "payload" : ")lit" ;
R"lit(" } , "payload" : )lit" ;
cppkafka::Producer Producer(Config);
ProducerRunning_ = true;
while(ProducerRunning_) {
std::this_thread::sleep_for(std::chrono::milliseconds(200));
try
{
SubMutexGuard G(ProducerMutex_);
std::lock_guard G(ProducerMutex_);
auto Num=0;
while (!Queue_.empty()) {
const auto M = Queue_.front();
@@ -87,12 +87,19 @@ namespace uCentral {
}
}
void KafkaManager::PartitionAssignment(const cppkafka::TopicPartitionList& partitions) {
Logger_.information(Poco::format("Partition assigned: %Lu...",(uint64_t )partitions.front().get_partition()));
}
void KafkaManager::PartitionRevocation(const cppkafka::TopicPartitionList& partitions) {
Logger_.information(Poco::format("Partition revocation: %Lu...",(uint64_t )partitions.front().get_partition()));
}
void KafkaManager::ConsumerThr() {
cppkafka::Configuration Config({
{ "client.id", Daemon()->ConfigGetString("ucentral.kafka.client.id") },
{ "metadata.broker.list", Daemon()->ConfigGetString("ucentral.kafka.brokerlist") },
{ "group.id", Daemon()->ConfigGetString("ucentral.kafka.group.id") },
{ "enable.auto.commit", Daemon()->ConfigGetBool("ucentral.kafka.auto.commit",false) },
{ "client.id", Daemon()->ConfigGetString("openwifi.kafka.client.id") },
{ "metadata.broker.list", Daemon()->ConfigGetString("openwifi.kafka.brokerlist") },
{ "group.id", Daemon()->ConfigGetString("openwifi.kafka.group.id") },
{ "enable.auto.commit", Daemon()->ConfigGetBool("openwifi.kafka.auto.commit",false) },
{ "auto.offset.reset", "latest" } ,
{ "enable.partition.eof", false }
});
@@ -105,13 +112,22 @@ namespace uCentral {
Config.set_default_topic_configuration(topic_config);
cppkafka::Consumer Consumer(Config);
Consumer.set_assignment_callback([this](const cppkafka::TopicPartitionList& partitions) {
Logger_.information(Poco::format("Partition assigned: %Lu...",(uint64_t )partitions.front().get_partition()));
Consumer.set_assignment_callback([this](cppkafka::TopicPartitionList& partitions) {
if(!partitions.empty()) {
Logger_.information(Poco::format("Partition assigned: %Lu...",
(uint64_t)partitions.front().get_partition()));
}
});
Consumer.set_revocation_callback([this](const cppkafka::TopicPartitionList& partitions) {
Logger_.information(Poco::format("Partition revocation: %Lu...",(uint64_t )partitions.front().get_partition()));
if(!partitions.empty()) {
Logger_.information(Poco::format("Partition revocation: %Lu...",
(uint64_t)partitions.front().get_partition()));
}
});
bool AutoCommit = Daemon()->ConfigGetBool("openwifi.kafka.auto.commit",false);
auto BatchSize = Daemon()->ConfigGetInt("openwifi.kafka.consumer.batchsize",20);
Types::StringVec Topics;
for(const auto &i:Notifiers_)
Topics.push_back(i.first);
@@ -121,17 +137,18 @@ namespace uCentral {
ConsumerRunning_ = true;
while(ConsumerRunning_) {
try {
cppkafka::Message Msg = Consumer.poll(std::chrono::milliseconds(200));
std::vector<cppkafka::Message> MsgVec = Consumer.poll_batch(BatchSize, std::chrono::milliseconds(200));
for(auto const &Msg:MsgVec) {
if (!Msg)
continue;
if (Msg.get_error()) {
if (!Msg.is_eof()) {
Logger_.error(Poco::format("Error: %s", Msg.get_error().to_string()));
}
Consumer.commit(Msg);
}if(!AutoCommit)
Consumer.async_commit(Msg);
continue;
}
SubMutexGuard G(ConsumerMutex_);
std::lock_guard G(ConsumerMutex_);
auto It = Notifiers_.find(Msg.get_topic());
if (It != Notifiers_.end()) {
Types::TopicNotifyFunctionList &FL = It->second;
@@ -142,7 +159,9 @@ namespace uCentral {
T.detach();
}
}
Consumer.commit(Msg);
if (!AutoCommit)
Consumer.async_commit(Msg);
}
} catch (const cppkafka::HandleException &E) {
Logger_.warning(Poco::format("Caught a Kafka exception (consumer): %s",std::string{E.what()}));
} catch (const Poco::Exception &E) {
@@ -155,9 +174,9 @@ namespace uCentral {
return std::move( SystemInfoWrapper_ + PayLoad + "}");
}
void KafkaManager::PostMessage(std::string topic, std::string key, std::string PayLoad, bool WrapMessage ) {
void KafkaManager::PostMessage(const std::string &topic, const std::string & key, const std::string &PayLoad, bool WrapMessage ) {
if(KafkaEnabled_) {
SubMutexGuard G(Mutex_);
std::lock_guard G(Mutex_);
KMessage M{
.Topic = topic,
.Key = key,
@@ -168,7 +187,7 @@ namespace uCentral {
int KafkaManager::RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F) {
if(KafkaEnabled_) {
SubMutexGuard G(Mutex_);
std::lock_guard G(Mutex_);
auto It = Notifiers_.find(Topic);
if(It == Notifiers_.end()) {
Types::TopicNotifyFunctionList L;
@@ -185,7 +204,7 @@ namespace uCentral {
void KafkaManager::UnregisterTopicWatcher(const std::string &Topic, int Id) {
if(KafkaEnabled_) {
SubMutexGuard G(Mutex_);
std::lock_guard G(Mutex_);
auto It = Notifiers_.find(Topic);
if(It != Notifiers_.end()) {
Types::TopicNotifyFunctionList & L = It->second;

View File

@@ -13,11 +13,11 @@
#include <thread>
#include "SubSystemServer.h"
#include "uCentralTypes.h"
#include "OpenWifiTypes.h"
#include "cppkafka/cppkafka.h"
namespace uCentral {
namespace OpenWifi {
class KafkaManager : public SubSystemServer {
public:
@@ -41,17 +41,19 @@ namespace uCentral {
int Start() override;
void Stop() override;
void PostMessage(std::string topic, std::string key, std::string payload, bool WrapMessage = true);
void PostMessage(const std::string &topic, const std::string & key, const std::string &payload, bool WrapMessage = true);
[[nodiscard]] std::string WrapSystemId(const std::string & PayLoad);
[[nodiscard]] bool Enabled() { return KafkaEnabled_; }
int RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction & F);
void UnregisterTopicWatcher(const std::string &Topic, int FunctionId);
void WakeUp();
void PartitionAssignment(const cppkafka::TopicPartitionList& partitions);
void PartitionRevocation(const cppkafka::TopicPartitionList& partitions);
private:
static KafkaManager *instance_;
SubMutex ProducerMutex_;
SubMutex ConsumerMutex_;
std::mutex ProducerMutex_;
std::mutex ConsumerMutex_;
bool KafkaEnabled_ = false;
std::atomic_bool ProducerRunning_ = false;
std::atomic_bool ConsumerRunning_ = false;

View File

@@ -5,7 +5,7 @@
#ifndef UCENTRALGW_KAFKA_TOPICS_H
#define UCENTRALGW_KAFKA_TOPICS_H
namespace uCentral::KafkaTopics {
namespace OpenWifi::KafkaTopics {
static const std::string HEALTHCHECK{"healthcheck"};
static const std::string STATE{"state"};
static const std::string CONNECTION{"connection"};
@@ -13,6 +13,7 @@ namespace uCentral::KafkaTopics {
static const std::string ALERTS{"alerts"};
static const std::string COMMAND{"command"};
static const std::string SERVICE_EVENTS{"service_events"};
static const std::string DEVICE_EVENT_QUEUE{"device_event_queue"};
namespace ServiceEvents {
static const std::string EVENT_JOIN{"join"};

View File

@@ -1,6 +1,11 @@
//
// Created by stephane bourque on 2021-06-22.
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#include <cstdlib>
#include <boost/algorithm/string.hpp>
@@ -34,7 +39,7 @@
#include "AuthClient.h"
#endif
namespace uCentral {
namespace OpenWifi {
void MyErrorHandler::exception(const Poco::Exception & E) {
Poco::Thread * CurrentThread = Poco::Thread::current();
@@ -57,7 +62,7 @@ namespace uCentral {
}
void MicroService::BusMessageReceived(const std::string &Key, const std::string & Message) {
SubMutexGuard G(InfraMutex_);
std::lock_guard G(InfraMutex_);
try {
Poco::JSON::Parser P;
auto Object = P.parse(Message).extract<Poco::JSON::Object::Ptr>();
@@ -112,13 +117,23 @@ namespace uCentral {
} else {
logger().error("Bad bus message.");
}
auto i=Services_.begin();
auto Now = (uint64_t )std::time(nullptr);
for(;i!=Services_.end();) {
if((Now - i->second.LastUpdate)>60) {
i = Services_.erase(i);
} else
++i;
}
} catch (const Poco::Exception &E) {
logger().log(E);
}
}
MicroServiceMetaVec MicroService::GetServices(const std::string & Type) {
SubMutexGuard G(InfraMutex_);
std::lock_guard G(InfraMutex_);
auto T = Poco::toLower(Type);
MicroServiceMetaVec Res;
@@ -130,7 +145,7 @@ namespace uCentral {
}
MicroServiceMetaVec MicroService::GetServices() {
SubMutexGuard G(InfraMutex_);
std::lock_guard G(InfraMutex_);
MicroServiceMetaVec Res;
for(const auto &[Id,ServiceRec]:Services_) {
@@ -139,21 +154,7 @@ namespace uCentral {
return Res;
}
void MicroService::initialize(Poco::Util::Application &self) {
std::string V{APP_VERSION};
std::string B{BUILD_NUMBER};
Version_ = V + "(" + B + ")";
// add the default services
SubSystems_.push_back(KafkaManager());
SubSystems_.push_back(ALBHealthCheckServer());
Poco::Net::initializeSSL();
Poco::Net::HTTPStreamFactory::registerFactory();
Poco::Net::HTTPSStreamFactory::registerFactory();
Poco::Net::FTPStreamFactory::registerFactory();
Poco::Net::FTPSStreamFactory::registerFactory();
void MicroService::LoadConfigurationFile() {
std::string Location = Poco::Environment::get(DAEMON_CONFIG_ENV_VAR,".");
Poco::Path ConfigFile;
@@ -167,9 +168,42 @@ namespace uCentral {
std::exit(Poco::Util::Application::EXIT_CONFIG);
}
static const char * LogFilePathKey = "logging.channels.c2.path";
loadConfiguration(ConfigFile.toString());
}
void MicroService::Reload() {
LoadConfigurationFile();
LoadMyConfig();
}
void MicroService::LoadMyConfig() {
std::string KeyFile = ConfigPath("openwifi.service.key");
std::string KeyFilePassword = ConfigPath("openwifi.service.key.password" , "" );
AppKey_ = Poco::SharedPtr<Poco::Crypto::RSAKey>(new Poco::Crypto::RSAKey("", KeyFile, KeyFilePassword));
Cipher_ = CipherFactory_.createCipher(*AppKey_);
ID_ = Utils::GetSystemId();
if(!DebugMode_)
DebugMode_ = ConfigGetBool("openwifi.system.debug",false);
MyPrivateEndPoint_ = ConfigGetString("openwifi.system.uri.private");
MyPublicEndPoint_ = ConfigGetString("openwifi.system.uri.public");
UIURI_ = ConfigGetString("openwifi.system.uri.ui");
MyHash_ = CreateHash(MyPublicEndPoint_);
}
void MicroService::initialize(Poco::Util::Application &self) {
// add the default services
SubSystems_.push_back(KafkaManager());
SubSystems_.push_back(ALBHealthCheckServer());
Poco::Net::initializeSSL();
Poco::Net::HTTPStreamFactory::registerFactory();
Poco::Net::HTTPSStreamFactory::registerFactory();
Poco::Net::FTPStreamFactory::registerFactory();
Poco::Net::FTPSStreamFactory::registerFactory();
LoadConfigurationFile();
static const char * LogFilePathKey = "logging.channels.c2.path";
if(LogDir_.empty()) {
std::string OriginalLogFileValue = ConfigPath(LogFilePathKey);
@@ -177,7 +211,8 @@ namespace uCentral {
} else {
config().setString(LogFilePathKey, LogDir_);
}
Poco::File DataDir(ConfigPath("ucentral.system.data"));
Poco::File DataDir(ConfigPath("openwifi.system.data"));
DataDir_ = DataDir.path();
if(!DataDir.exists()) {
try {
@@ -186,16 +221,9 @@ namespace uCentral {
logger().log(E);
}
}
std::string KeyFile = ConfigPath("ucentral.service.key");
AppKey_ = Poco::SharedPtr<Poco::Crypto::RSAKey>(new Poco::Crypto::RSAKey("", KeyFile, ""));
Cipher_ = CipherFactory_.createCipher(*AppKey_);
ID_ = Utils::GetSystemId();
if(!DebugMode_)
DebugMode_ = ConfigGetBool("ucentral.system.debug",false);
MyPrivateEndPoint_ = ConfigGetString("ucentral.system.uri.private");
MyPublicEndPoint_ = ConfigGetString("ucentral.system.uri.public");
UIURI_ = ConfigGetString("ucentral.system.uri.ui");
MyHash_ = CreateHash(MyPublicEndPoint_);
LoadMyConfig();
InitializeSubSystemServers();
ServerApplication::initialize(self);
@@ -330,14 +358,23 @@ namespace uCentral {
return false;
}
void MicroService::Reload(const std::string &Sub) {
for (auto i : SubSystems_) {
if (Poco::toLower(Sub) == Poco::toLower(i->Name())) {
i->reinitialize(Poco::Util::Application::instance());
return;
}
}
}
Types::StringVec MicroService::GetSubSystems() const {
Types::StringVec Result;
for(auto i:SubSystems_)
Result.push_back(i->Name());
Result.push_back(Poco::toLower(i->Name()));
return Result;
}
Types::StringPairVec MicroService::GetLogLevels() const {
Types::StringPairVec MicroService::GetLogLevels() {
Types::StringPairVec Result;
for(auto &i:SubSystems_) {
@@ -347,7 +384,7 @@ namespace uCentral {
return Result;
}
const Types::StringVec & MicroService::GetLogLevelNames() const {
const Types::StringVec & MicroService::GetLogLevelNames() {
static Types::StringVec LevelNames{"none", "fatal", "critical", "error", "warning", "notice", "information", "debug", "trace" };
return LevelNames;
}
@@ -421,7 +458,7 @@ namespace uCentral {
Poco::Thread::trySleep((unsigned long)Daemon()->DaemonBusTimer());
if(!Running_)
break;
auto Msg = Daemon()->MakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE);
Msg = Daemon()->MakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE);
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS,Daemon()->PrivateEndPoint(),Msg, false);
}
Msg = Daemon()->MakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_LEAVE);

View File

@@ -1,5 +1,9 @@
//
// Created by stephane bourque on 2021-06-22.
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#ifndef UCENTRALGW_MICROSERVICE_H
@@ -24,14 +28,17 @@
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Process.h"
#include "uCentralTypes.h"
#include "OpenWifiTypes.h"
#include "SubSystemServer.h"
namespace uCentral {
namespace OpenWifi {
static const std::string uSERVICE_SECURITY{"ucentralsec"};
static const std::string uSERVICE_GATEWAY{"ucentralgw"};
static const std::string uSERVICE_FIRMWARE{ "ucentralfws"};
static const std::string uSERVICE_SECURITY{"owsec"};
static const std::string uSERVICE_GATEWAY{"owgw"};
static const std::string uSERVICE_FIRMWARE{ "owfms"};
static const std::string uSERVICE_TOPOLOGY{ "owtopo"};
static const std::string uSERVICE_PROVISIONING{ "owprov"};
static const std::string uSERVICE_OWLS{ "owls"};
class MyErrorHandler : public Poco::ErrorHandler {
public:
@@ -79,7 +86,8 @@ namespace uCentral {
DAEMON_CONFIG_ENV_VAR(std::move(ConfigVar)),
DAEMON_APP_NAME(std::move(AppName)),
DAEMON_BUS_TIMER(BusTimer),
SubSystems_(std::move(Subsystems)) {}
SubSystems_(std::move(Subsystems)) {
}
int main(const ArgVec &args) override;
void initialize(Application &self) override;
@@ -105,8 +113,8 @@ namespace uCentral {
[[nodiscard]] bool Debug() const { return DebugMode_; }
[[nodiscard]] uint64_t ID() const { return ID_; }
[[nodiscard]] Types::StringVec GetSubSystems() const;
[[nodiscard]] Types::StringPairVec GetLogLevels() const;
[[nodiscard]] const Types::StringVec & GetLogLevelNames() const;
[[nodiscard]] Types::StringPairVec GetLogLevels() ;
[[nodiscard]] static const Types::StringVec & GetLogLevelNames();
[[nodiscard]] std::string ConfigGetString(const std::string &Key,const std::string & Default);
[[nodiscard]] std::string ConfigGetString(const std::string &Key);
[[nodiscard]] std::string ConfigPath(const std::string &Key,const std::string & Default);
@@ -123,18 +131,26 @@ namespace uCentral {
[[nodiscard]] std::string PrivateEndPoint() const { return MyPrivateEndPoint_; };
[[nodiscard]] std::string PublicEndPoint() const { return MyPublicEndPoint_; };
[[nodiscard]] std::string MakeSystemEventMessage( const std::string & Type ) const ;
[[nodiscard]] const Types::SubSystemVec & GetFullSubSystems() { return SubSystems_; }
inline uint64_t DaemonBusTimer() const { return DAEMON_BUS_TIMER; };
void BusMessageReceived( const std::string & Key, const std::string & Message);
[[nodiscard]] MicroServiceMetaVec GetServices(const std::string & type);
[[nodiscard]] MicroServiceMetaVec GetServices();
[[nodiscard]] bool IsValidAPIKEY(const Poco::Net::HTTPServerRequest &Request);
[[nodiscard]] const std::string & AppName() { return DAEMON_APP_NAME; }
void SavePID();
inline uint64_t GetPID() { return Poco::Process::id(); };
[[nodiscard]] inline const std::string GetPublicAPIEndPoint() const { return MyPublicEndPoint_ + "/api/v1"; };
static void SavePID();
static inline uint64_t GetPID() { return Poco::Process::id(); };
[[nodiscard]] inline const std::string GetPublicAPIEndPoint() { return MyPublicEndPoint_ + "/api/v1"; };
[[nodiscard]] inline const std::string & GetUIURI() const { return UIURI_;};
void Reload(const std::string &Name); // reload a subsystem
void Reload(); // reload the daemon itself
void LoadMyConfig();
void LoadConfigurationFile();
private:
bool HelpRequested_ = false;
std::string LogDir_;
@@ -153,9 +169,9 @@ namespace uCentral {
std::string MyPrivateEndPoint_;
std::string MyPublicEndPoint_;
std::string UIURI_;
std::string Version_;
std::string Version_{std::string(APP_VERSION) + "("+ BUILD_NUMBER + ")"};
BusEventManager BusEventManager_;
SubMutex InfraMutex_;
std::mutex InfraMutex_;
std::string DAEMON_PROPERTIES_FILENAME;
std::string DAEMON_ROOT_ENV_VAR;

819
src/NewWebSocketServer.cpp Normal file
View File

@@ -0,0 +1,819 @@
//
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#include <cerrno>
#include "Poco/Net/IPAddress.h"
#include "Poco/Net/SSLException.h"
#include "Poco/Net/HTTPServerSession.h"
#include "Poco/Net/HTTPHeaderStream.h"
#include "Poco/Net/HTTPServerRequestImpl.h"
#include "Poco/JSON/Array.h"
#include "Poco/zlib.h"
#include "CommandManager.h"
#include "Daemon.h"
#include "KafkaManager.h"
#include "Kafka_topics.h"
#include "StorageService.h"
#include "Utils.h"
#include "WebSocketServer.h"
#include "uCentralProtocol.h"
#include "TelemetryStream.h"
namespace OpenWifi {
class WebSocketServer *WebSocketServer::instance_ = nullptr;
bool WebSocketServer::ValidateCertificate(const std::string & ConnectionId, const Poco::Crypto::X509Certificate & Certificate) {
if(IsCertOk()) {
Logger_.debug(Poco::format("CERTIFICATE(%s): issuer='%s' cn='%s'", ConnectionId, Certificate.issuerName(),Certificate.commonName()));
if(!Certificate.issuedBy(*IssuerCert_)) {
Logger_.debug(Poco::format("CERTIFICATE(%s): issuer mismatch. Local='%s' Incoming='%s'", ConnectionId, IssuerCert_->issuerName(), Certificate.issuerName()));
return false;
}
return true;
}
return false;
}
int WebSocketServer::Start() {
std::cout << __LINE__ << std::endl;
ReactorPool_.Start();
std::cout << __LINE__ << std::endl;
Poco::Net::Context::Params P;
P.verificationMode = Poco::Net::Context::VERIFY_STRICT;
P.certificateFile = Daemon()->ConfigPath("ucentral.websocket.host.0.cert");
P.privateKeyFile = Daemon()->ConfigPath("ucentral.websocket.host.0.key");
P.loadDefaultCAs = true ;
P.caLocation = Daemon()->ConfigPath("ucentral.websocket.host.0.cas");
P.verificationDepth = 9 ;
P.cipherList = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
P.dhUse2048Bits = true;
std::cout << __LINE__ << std::endl;
Poco::Net::IPAddress Addr(Poco::Net::IPAddress::wildcard(Poco::Net::Socket::supportsIPv6() ? Poco::Net::AddressFamily::IPv6 : Poco::Net::AddressFamily::IPv4));
std::cout << __LINE__ << std::endl;
Poco::Net::SocketAddress SockAddr(Addr, 15002);
std::cout << __LINE__ << std::endl;
auto Context = Poco::AutoPtr<Poco::Net::Context>(new Poco::Net::Context(Poco::Net::Context::TLS_SERVER_USE, P));
std::cout << __LINE__ << std::endl;
auto Params = new Poco::Net::HTTPServerParams;
std::cout << __LINE__ << std::endl;
Params->setMaxThreads(50);
Params->setMaxQueued(200);
Params->setKeepAlive(true);
std::cout << __LINE__ << std::endl;
auto Sock = Poco::Net::SecureServerSocket(SockAddr, 200, Context);
std::cout << __LINE__ << std::endl;
auto NewServer = std::make_unique<Poco::Net::HTTPServer>(new WebSocketRequestHandlerFactory(ReactorPool_,Logger_), Pool_, Sock, Params);
std::cout << __LINE__ << std::endl;
NewServer->start();
std::cout << __LINE__ << std::endl;
WebServers_.push_back(std::move(NewServer));
return 0;
}
void WebSocketServer::Stop() {
Logger_.notice("Stopping reactors...");
Logger_.information("Stopping ");
for( const auto & svr : WebServers_ )
svr->stop();
ReactorPool_.Stop();
}
void WSConnection::LogException(const Poco::Exception &E) {
Logger_.information(Poco::format("EXCEPTION(%s): %s",CId_,E.displayText()));
}
void WSConnection::CompleteStartup() {
std::lock_guard Guard(Mutex_);
try {
Socket_ = *WS_;
std::cout << __LINE__ << std::endl;
auto SS = dynamic_cast<Poco::Net::SecureStreamSocketImpl *>(WS_->impl());
std::cout << __LINE__ << std::endl;
SS->completeHandshake();
std::cout << __LINE__ << std::endl;
CId_ = Utils::FormatIPv6(SS->peerAddress().toString());
std::cout << __LINE__ << std::endl;
if (!SS->secure()) {
Logger_.error(Poco::format("%s: Connection is NOT secure.", CId_));
} else {
Logger_.debug(Poco::format("%s: Connection is secure.", CId_));
}
std::cout << __LINE__ << std::endl;
if (SS->havePeerCertificate()) {
// Get the cert info...
CertValidation_ = GWObjects::VALID_CERTIFICATE;
try {
Poco::Crypto::X509Certificate PeerCert(SS->peerCertificate());
if (WebSocketServer()->ValidateCertificate(CId_, PeerCert)) {
CN_ = Poco::trim(Poco::toLower(PeerCert.commonName()));
CertValidation_ = GWObjects::MISMATCH_SERIAL;
Logger_.debug(Poco::format("%s: Valid certificate: CN=%s", CId_, CN_));
} else {
Logger_.debug(Poco::format("%s: Certificate is not valid", CId_));
}
} catch (const Poco::Exception &E) {
LogException(E);
}
std::cout << __LINE__ << std::endl;
} else {
Logger_.error(Poco::format("%s: No certificates available..", CId_));
}
std::cout << __LINE__ << std::endl;
WS_->setMaxPayloadSize(BufSize);
auto TS = Poco::Timespan(240,0);
WS_->setReceiveTimeout(TS);
WS_->setNoDelay(true);
WS_->setKeepAlive(true);
Reactor_.addEventHandler(*WS_,
Poco::NObserver<WSConnection, Poco::Net::ReadableNotification>(
*this, &WSConnection::OnSocketReadable));
Reactor_.addEventHandler(*WS_,
Poco::NObserver<WSConnection, Poco::Net::ShutdownNotification>(
*this, &WSConnection::OnSocketShutdown));
Reactor_.addEventHandler(*WS_,
Poco::NObserver<WSConnection, Poco::Net::ErrorNotification>(
*this, &WSConnection::OnSocketError));
Registered_ = true;
Logger_.information(Poco::format("CONNECTION(%s): completed.",CId_));
std::cout << __LINE__ << std::endl;
return;
} catch (const Poco::Exception &E ) {
Logger_.error("Exception caught during device connection. Device will have to retry.");
}
delete this;
}
WSConnection::WSConnection(Poco::SharedPtr<Poco::Net::WebSocket> WS, Poco::Net::SocketReactor& Reactor, Poco::Logger &Logger):
WS_(WS), Reactor_(Reactor), Logger_(WebSocketServer()->Logger())
{
std::cout << __LINE__ << std::endl;
std::thread T([this](){ this->CompleteStartup();});
std::cout << __LINE__ << std::endl;
T.detach();
std::cout << __LINE__ << std::endl;
}
WSConnection::~WSConnection() {
DeviceRegistry()->UnRegister(SerialNumber_,this);
if(Registered_ && WS_)
{
Reactor_.removeEventHandler(*WS_,
Poco::NObserver<WSConnection,
Poco::Net::ReadableNotification>(*this,&WSConnection::OnSocketReadable));
Reactor_.removeEventHandler(*WS_,
Poco::NObserver<WSConnection,
Poco::Net::ShutdownNotification>(*this,&WSConnection::OnSocketShutdown));
Reactor_.removeEventHandler(*WS_,
Poco::NObserver<WSConnection,
Poco::Net::ErrorNotification>(*this,&WSConnection::OnSocketError));
(*WS_).close();
Socket_.shutdown();
} else if(WS_) {
(*WS_).close();
Socket_.shutdown();
}
if(KafkaManager()->Enabled() && !SerialNumber_.empty()) {
Poco::JSON::Object Disconnect;
Poco::JSON::Object Details;
Details.set(uCentralProtocol::SERIALNUMBER, SerialNumber_);
Details.set(uCentralProtocol::TIMESTAMP,std::time(nullptr));
Disconnect.set(uCentralProtocol::DISCONNECTION,Details);
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
Stringify.condense(Disconnect,OS);
KafkaManager()->PostMessage(KafkaTopics::CONNECTION, SerialNumber_, OS.str());
}
}
bool WSConnection::LookForUpgrade(uint64_t UUID) {
// A UUID of zero means ignore updates for that connection.
if(UUID==0)
return false;
std::string NewConfig;
uint64_t NewConfigUUID = 0 ;
if (Storage()->ExistingConfiguration(SerialNumber_,UUID, NewConfig, NewConfigUUID)) {
// Device is already using the latest configuration.
if(UUID == NewConfigUUID)
return false;
// if the new config is already pending,
if(NewConfigUUID == Conn_->PendingUUID)
return false;
Conn_->PendingUUID = NewConfigUUID;
Poco::JSON::Parser Parser( new Poco::JSON::ParseHandler);
auto ParsedConfig = Parser.parse(NewConfig).extract<Poco::JSON::Object::Ptr>();
ParsedConfig->set(uCentralProtocol::UUID,NewConfigUUID);
// create the command stub...
GWObjects::CommandDetails Cmd;
Cmd.SerialNumber = SerialNumber_;
Cmd.UUID = Daemon()->CreateUUID();
Cmd.SubmittedBy = uCentralProtocol::SUBMITTED_BY_SYSTEM;
Cmd.Status = uCentralProtocol::PENDING;
Cmd.Command = uCentralProtocol::CONFIGURE;
Poco::JSON::Object Params;
Params.set(uCentralProtocol::SERIAL, SerialNumber_);
Params.set(uCentralProtocol::UUID, NewConfigUUID);
Params.set(uCentralProtocol::WHEN, 0);
Params.set(uCentralProtocol::CONFIG, ParsedConfig);
std::string Log = Poco::format("CFG-UPGRADE(%s):, Current ID: %Lu, newer configuration %Lu.", SerialNumber_, UUID, NewConfigUUID);
Storage()->AddLog(SerialNumber_, Conn_->UUID, Log);
Logger_.debug(Log);
uint64_t RPC_Id;
CommandManager()->SendCommand(SerialNumber_ , Cmd.Command, Params, Cmd.UUID, RPC_Id);
Storage()->AddCommand(SerialNumber_, Cmd, Storage::COMMAND_EXECUTED);
return true;
}
return false;
}
bool WSConnection::ExtractCompressedData(const std::string & CompressedData, std::string & UnCompressedData)
{
std::vector<uint8_t> OB = Utils::base64decode(CompressedData);
unsigned long MaxSize=OB.size()*10;
std::vector<char> UncompressedBuffer(MaxSize);
unsigned long FinalSize = MaxSize;
if(uncompress((Bytef *)&UncompressedBuffer[0], & FinalSize, (Bytef *)&OB[0],OB.size())==Z_OK) {
UncompressedBuffer[FinalSize] = 0;
UnCompressedData = &UncompressedBuffer[0];
return true;
}
return false;
}
void WSConnection::ProcessJSONRPCResult(Poco::JSON::Object::Ptr & Doc) {
CommandManager()->PostCommandResult(SerialNumber_, Doc);
}
void WSConnection::ProcessJSONRPCEvent(Poco::JSON::Object::Ptr & Doc) {
auto Method = Doc->get(uCentralProtocol::METHOD).toString();
auto EventType = uCentralProtocol::EventFromString(Method);
if(EventType == uCentralProtocol::ET_UNKNOWN) {
Logger_.error(Poco::format("ILLEGAL-PROTOCOL(%s): Unknown message type '%s'",Method));
Errors_++;
return;
}
if(!Doc->isObject(uCentralProtocol::PARAMS))
{
Logger_.warning(Poco::format("MISSING-PARAMS(%s): params must be an object.",CId_));
Errors_++;
return;
}
// expand params if necessary
auto ParamsObj = Doc->get(uCentralProtocol::PARAMS).extract<Poco::JSON::Object::Ptr>();
if(ParamsObj->has(uCentralProtocol::COMPRESS_64))
{
std::string UncompressedData;
if(ExtractCompressedData(ParamsObj->get(uCentralProtocol::COMPRESS_64).toString(),UncompressedData)) {
Logger_.debug(Poco::format("EVENT(%s): Found compressed payload expanded to '%s'.",CId_, UncompressedData));
Poco::JSON::Parser Parser;
ParamsObj = Parser.parse(UncompressedData).extract<Poco::JSON::Object::Ptr>();
} else {
Logger_.warning(Poco::format("INVALID-COMPRESSED-DATA(%s): Compressed cannot be uncompressed - content must be corrupt..",CId_));
Errors_++;
return;
}
}
if(!ParamsObj->has(uCentralProtocol::SERIAL))
{
Logger_.warning(Poco::format("MISSING-PARAMS(%s): Serial number is missing in message.",CId_));
return;
}
auto Serial = Poco::trim(Poco::toLower(ParamsObj->get(uCentralProtocol::SERIAL).toString()));
if(!Utils::ValidSerialNumber(Serial)) {
Poco::Exception E(Poco::format("ILLEGAL-DEVICE-NAME(%s): device name is illegal and not allowed to connect.",Serial), EACCES);
E.rethrow();
}
if(Storage()->IsBlackListed(Serial)) {
Poco::Exception E(Poco::format("BLACKLIST(%s): device is blacklisted and not allowed to connect.",Serial), EACCES);
E.rethrow();
}
if(Conn_!= nullptr)
Conn_->LastContact = std::time(nullptr);
switch(EventType) {
case uCentralProtocol::ET_CONNECT: {
if( ParamsObj->has(uCentralProtocol::UUID) &&
ParamsObj->has(uCentralProtocol::FIRMWARE) &&
ParamsObj->has(uCentralProtocol::CAPABILITIES)) {
uint64_t UUID = ParamsObj->get(uCentralProtocol::UUID);
auto Firmware = ParamsObj->get(uCentralProtocol::FIRMWARE).toString();
auto Capabilities = ParamsObj->get(uCentralProtocol::CAPABILITIES).toString();
Conn_ = DeviceRegistry()->Register(Serial, this);
SerialNumber_ = Serial;
Conn_->SerialNumber = Serial;
Conn_->UUID = UUID;
Conn_->Firmware = Firmware;
Conn_->PendingUUID = 0;
Conn_->LastContact = std::time(nullptr);
Conn_->Address = Utils::FormatIPv6(WS_->peerAddress().toString());
CId_ = SerialNumber_ + "@" + CId_ ;
// We need to verify the certificate if we have one
if(!CN_.empty() && Utils::SerialNumberMatch(CN_,SerialNumber_)) {
CertValidation_ = GWObjects::VERIFIED;
Logger_.information(Poco::format("CONNECT(%s): Fully validated and authenticated device..", CId_));
} else {
if(CN_.empty())
Logger_.information(Poco::format("CONNECT(%s): Not authenticated or validated.", CId_));
else
Logger_.information(Poco::format("CONNECT(%s): Authenticated but not validated. Serial='%s' CN='%s'", CId_, Serial, CN_));
}
Conn_->VerifiedCertificate = CertValidation_;
if (Daemon()->AutoProvisioning() && !Storage()->DeviceExists(SerialNumber_)) {
Storage()->CreateDefaultDevice(SerialNumber_, Capabilities, Firmware, Compatible_);
} else if (Storage()->DeviceExists(SerialNumber_)) {
Storage()->UpdateDeviceCapabilities(SerialNumber_, Capabilities, Compatible_);
if(!Firmware.empty()) {
Storage()->SetConnectInfo(SerialNumber_, Firmware );
}
}
Conn_->Compatible = Compatible_;
StatsProcessor_ = std::make_unique<StateProcessor>(Conn_);
StatsProcessor_->Initialize(Serial);
LookForUpgrade(UUID);
if(KafkaManager()->Enabled()) {
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
Stringify.condense(ParamsObj,OS);
KafkaManager()->PostMessage(KafkaTopics::CONNECTION, SerialNumber_, OS.str());
}
} else {
Logger_.warning(Poco::format("CONNECT(%s): Missing one of uuid, firmware, or capabilities",CId_));
return;
}
}
break;
case uCentralProtocol::ET_STATE: {
if (ParamsObj->has(uCentralProtocol::UUID) && ParamsObj->has(uCentralProtocol::STATE)) {
uint64_t UUID = ParamsObj->get(uCentralProtocol::UUID);
auto State = ParamsObj->get(uCentralProtocol::STATE).toString();
std::string request_uuid;
if (ParamsObj->has(uCentralProtocol::REQUEST_UUID))
request_uuid = ParamsObj->get(uCentralProtocol::REQUEST_UUID).toString();
if (request_uuid.empty())
Logger_.debug(Poco::format("STATE(%s): UUID=%Lu Updating.", CId_, UUID));
else
Logger_.debug(Poco::format("STATE(%s): UUID=%Lu Updating for CMD=%s.", CId_,
UUID, request_uuid));
Conn_->UUID = UUID;
Storage()->AddStatisticsData(Serial, UUID, State);
DeviceRegistry()->SetStatistics(Serial, State);
if (!request_uuid.empty()) {
Storage()->SetCommandResult(request_uuid, State);
}
if (StatsProcessor_)
StatsProcessor_->Add(State);
if(KafkaManager()->Enabled()) {
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
Stringify.condense(ParamsObj,OS);
KafkaManager()->PostMessage(KafkaTopics::STATE, SerialNumber_, OS.str());
}
} else {
Logger_.warning(Poco::format(
"STATE(%s): Invalid request. Missing serial, uuid, or state", CId_));
}
}
break;
case uCentralProtocol::ET_HEALTHCHECK: {
if (ParamsObj->has(uCentralProtocol::UUID) && ParamsObj->has(uCentralProtocol::SANITY) && ParamsObj->has(uCentralProtocol::DATA)) {
uint64_t UUID = ParamsObj->get(uCentralProtocol::UUID);
auto Sanity = ParamsObj->get(uCentralProtocol::SANITY);
auto CheckData = ParamsObj->get(uCentralProtocol::DATA).toString();
if (CheckData.empty())
CheckData = uCentralProtocol::EMPTY_JSON_DOC;
std::string request_uuid;
if (ParamsObj->has(uCentralProtocol::REQUEST_UUID))
request_uuid = ParamsObj->get(uCentralProtocol::REQUEST_UUID).toString();
if (request_uuid.empty())
Logger_.debug(
Poco::format("HEALTHCHECK(%s): UUID=%Lu Updating.", CId_, UUID));
else
Logger_.debug(Poco::format("HEALTHCHECK(%s): UUID=%Lu Updating for CMD=%s.",
CId_, UUID, request_uuid));
Conn_->UUID = UUID;
GWObjects::HealthCheck Check;
Check.Recorded = std::time(nullptr);
Check.UUID = UUID;
Check.Data = CheckData;
Check.Sanity = Sanity;
Storage()->AddHealthCheckData(Serial, Check);
if (!request_uuid.empty()) {
Storage()->SetCommandResult(request_uuid, CheckData);
}
DeviceRegistry()->SetHealthcheck(Serial, Check);
if(KafkaManager()->Enabled()) {
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
ParamsObj->set("timestamp",std::time(nullptr));
Stringify.condense(ParamsObj,OS);
KafkaManager()->PostMessage(KafkaTopics::HEALTHCHECK, SerialNumber_, OS.str());
}
} else {
Logger_.warning(Poco::format("HEALTHCHECK(%s): Missing parameter", CId_));
return;
}
}
break;
case uCentralProtocol::ET_LOG: {
if (ParamsObj->has(uCentralProtocol::LOG) && ParamsObj->has(uCentralProtocol::SEVERITY)) {
Logger_.debug(Poco::format("LOG(%s): new entry.", CId_));
auto Log = ParamsObj->get(uCentralProtocol::LOG).toString();
auto Severity = ParamsObj->get(uCentralProtocol::SEVERITY);
std::string DataStr = uCentralProtocol::EMPTY_JSON_DOC;
if (ParamsObj->has(uCentralProtocol::DATA)) {
auto DataObj = ParamsObj->get(uCentralProtocol::DATA);
if (DataObj.isStruct())
DataStr = DataObj.toString();
}
GWObjects::DeviceLog DeviceLog{.Log = Log,
.Data = DataStr,
.Severity = Severity,
.Recorded = (uint64_t)time(nullptr),
.LogType = 0,
.UUID = Conn_->UUID};
Storage()->AddLog(Serial, DeviceLog);
} else {
Logger_.warning(Poco::format("LOG(%s): Missing parameters.", CId_));
return;
}
}
break;
case uCentralProtocol::ET_CRASHLOG: {
if (ParamsObj->has(uCentralProtocol::UUID) && ParamsObj->has(uCentralProtocol::LOGLINES)) {
Logger_.debug(Poco::format("CRASH-LOG(%s): new entry.", CId_));
auto LogLines = ParamsObj->get(uCentralProtocol::LOGLINES);
std::string LogText;
if (LogLines.isArray()) {
auto LogLinesArray = LogLines.extract<Poco::JSON::Array::Ptr>();
for (const auto &i : *LogLinesArray)
LogText += i.toString() + "\r\n";
}
GWObjects::DeviceLog DeviceLog{
.Log = LogText,
.Data = "",
.Severity = GWObjects::DeviceLog::LOG_EMERG,
.Recorded = (uint64_t)time(nullptr),
.LogType = 1,
.UUID = Conn_->UUID};
Storage()->AddLog(Serial, DeviceLog, true);
} else {
Logger_.warning(Poco::format("LOG(%s): Missing parameters.", CId_));
return;
}
}
break;
case uCentralProtocol::ET_PING: {
if (ParamsObj->has(uCentralProtocol::UUID)) {
uint64_t UUID = ParamsObj->get(uCentralProtocol::UUID);
Logger_.debug(Poco::format("PING(%s): Current config is %Lu", CId_, UUID));
} else {
Logger_.warning(Poco::format("PING(%s): Missing parameter.", CId_));
}
}
break;
case uCentralProtocol::ET_CFGPENDING: {
if (ParamsObj->has(uCentralProtocol::UUID) && ParamsObj->has(uCentralProtocol::ACTIVE)) {
uint64_t UUID = ParamsObj->get(uCentralProtocol::UUID);
uint64_t Active = ParamsObj->get(uCentralProtocol::ACTIVE);
Logger_.debug(Poco::format("CFG-PENDING(%s): Active: %Lu Target: %Lu", CId_,
Active, UUID));
} else {
Logger_.warning(Poco::format("CFG-PENDING(%s): Missing some parameters", CId_));
}
}
break;
case uCentralProtocol::ET_RECOVERY: {
if (ParamsObj->has(uCentralProtocol::SERIAL) && ParamsObj->has(uCentralProtocol::FIRMWARE) &&
ParamsObj->has(uCentralProtocol::UUID) && ParamsObj->has(uCentralProtocol::REBOOT) &&
ParamsObj->has(uCentralProtocol::LOGLINES)) {
auto LogLines = ParamsObj->get(uCentralProtocol::LOGLINES);
std::string LogText;
if (LogLines.isArray()) {
auto LogLinesArray = LogLines.extract<Poco::JSON::Array::Ptr>();
for (const auto &i : *LogLinesArray)
LogText += i.toString() + "\r\n";
}
} else {
Logger_.error(Poco::format(
"RECOVERY(%s): Recovery missing one of firmware, uuid, loglines, reboot",
Serial));
}
}
break;
case uCentralProtocol::ET_DEVICEUPDATE: {
if (ParamsObj->has("currentPassword")) {
auto Password = ParamsObj->get("currentPassword").toString();
Storage()->SetDevicePassword(Serial, Password);
Logger_.error(Poco::format(
"DEVICEUPDATE(%s): Device is updating its login password.", Serial));
}
}
break;
case uCentralProtocol::ET_TELEMETRY: {
std::cout << "Telemetry date..." << std::endl;
if(ParamsObj->has("data")) {
auto Payload = ParamsObj->get("data").toString();
TelemetryStream()->UpdateEndPoint(SerialNumber_, Payload);
}
}
break;
// this will never be called but some compilers will complain if we do not have a case for
// every single values of an enum
case uCentralProtocol::ET_UNKNOWN: {
Logger_.error(Poco::format("ILLEGAL-EVENT(%s): Event '%s' unknown", CId_, Method));
Errors_++;
}
}
}
void WSConnection::OnSocketShutdown(const Poco::AutoPtr<Poco::Net::ShutdownNotification>& pNf) {
std::lock_guard Guard(Mutex_);
Logger_.information(Poco::format("SOCKET-SHUTDOWN(%s): Closing.",CId_));
delete this;
}
void WSConnection::OnSocketError(const Poco::AutoPtr<Poco::Net::ErrorNotification>& pNf) {
std::lock_guard Guard(Mutex_);
Logger_.information(Poco::format("SOCKET-ERROR(%s): Closing.",CId_));
delete this;
}
void WSConnection::OnSocketReadable(const Poco::AutoPtr<Poco::Net::ReadableNotification>& pNf) {
std::lock_guard Guard(Mutex_);
try
{
ProcessIncomingFrame();
}
catch (const Poco::Exception & E)
{
Logger_.log(E);
delete this;
}
catch (const std::exception & E) {
std::string W = E.what();
Logger_.information(Poco::format("std::exception caught: %s. Connection terminated with %s",W,CId_));
delete this;
}
catch ( ... ) {
Logger_.information(Poco::format("Unknown exception for %s. Connection terminated.",CId_));
delete this;
}
}
std::string asString(Poco::Buffer<char> & buf ) {
if(buf.sizeBytes()>0) {
buf.append(0);
return buf.begin();
}
return "";
}
void WSConnection::ProcessIncomingFrame() {
bool MustDisconnect=false;
Poco::Buffer<char> IncomingFrame(0);
try {
int Op,flags;
int IncomingSize;
IncomingSize = WS_->receiveFrame(IncomingFrame,flags);
Op = flags & Poco::Net::WebSocket::FRAME_OP_BITMASK;
// std::cout << "ID:" << CId_ << " Size=" << IncomingSize << " Flags=" << flags << " Op=" << Op << std::endl;
if (IncomingSize == 0 && flags == 0 && Op == 0) {
Logger_.information(Poco::format("DISCONNECT(%s): device has disconnected.", CId_));
MustDisconnect = true;
} else {
switch (Op) {
case Poco::Net::WebSocket::FRAME_OP_PING: {
Logger_.debug(Poco::format("WS-PING(%s): received. PONG sent back.", CId_));
WS_->sendFrame("", 0,
(int)Poco::Net::WebSocket::FRAME_OP_PONG |
(int)Poco::Net::WebSocket::FRAME_FLAG_FIN);
if (KafkaManager()->Enabled() && Conn_) {
Poco::JSON::Object PingObject;
Poco::JSON::Object PingDetails;
PingDetails.set(uCentralProtocol::FIRMWARE, Conn_->Firmware);
PingDetails.set(uCentralProtocol::SERIALNUMBER, SerialNumber_);
PingDetails.set(uCentralProtocol::COMPATIBLE, Compatible_);
PingObject.set(uCentralProtocol::PING,PingDetails);
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
Stringify.condense(PingObject, OS);
KafkaManager()->PostMessage(KafkaTopics::CONNECTION, SerialNumber_,
OS.str());
}
}
break;
case Poco::Net::WebSocket::FRAME_OP_PONG: {
Logger_.debug(Poco::format("PONG(%s): received and ignored.",CId_));
}
break;
case Poco::Net::WebSocket::FRAME_OP_TEXT: {
std::string IncomingMessageStr = asString(IncomingFrame);
Logger_.debug(Poco::format("FRAME(%s): Frame received (length=%d, flags=0x%x). Msg=%s",
CId_, IncomingSize, unsigned(flags),IncomingMessageStr));
Poco::JSON::Parser parser;
auto ParsedMessage = parser.parse(IncomingMessageStr);
auto IncomingJSON = ParsedMessage.extract<Poco::JSON::Object::Ptr>();
if (IncomingJSON->has(uCentralProtocol::JSONRPC)) {
if(IncomingJSON->has(uCentralProtocol::METHOD) &&
IncomingJSON->has(uCentralProtocol::PARAMS)) {
ProcessJSONRPCEvent(IncomingJSON);
} else if (IncomingJSON->has(uCentralProtocol::RESULT) &&
IncomingJSON->has(uCentralProtocol::ID)) {
Logger_.debug(Poco::format("RPC-RESULT(%s): payload: %s",CId_,IncomingMessageStr));
ProcessJSONRPCResult(IncomingJSON);
} else {
Logger_.warning(Poco::format(
"INVALID-PAYLOAD(%s): Payload is not JSON-RPC 2.0: %s", CId_,
IncomingMessageStr));
}
} else {
Logger_.error(Poco::format("FRAME(%s): illegal transaction header, missing 'jsonrpc'",CId_));
Errors_++;
}
}
break;
case Poco::Net::WebSocket::FRAME_OP_CLOSE: {
Logger_.warning(Poco::format("CLOSE(%s): Device is closing its connection.",CId_));
MustDisconnect = true;
}
break;
default: {
Logger_.warning(Poco::format("UNKNOWN(%s): unknownWS Frame operation: %s",CId_, std::to_string(Op)));
}
break;
}
if (Conn_ != nullptr) {
Conn_->RX += IncomingSize;
Conn_->MessageCount++;
}
}
}
catch (const Poco::Net::ConnectionResetException & E)
{
std::string IncomingMessageStr = asString(IncomingFrame);
Logger_.warning(Poco::format("%s(%s): Caught a ConnectionResetException: %s, Message: %s",
std::string(__func__), CId_, E.displayText(),IncomingMessageStr));
MustDisconnect= true;
}
catch (const Poco::JSON::JSONException & E)
{
std::string IncomingMessageStr = asString(IncomingFrame);
Logger_.warning(Poco::format("%s(%s): Caught a JSONException: %s. Message: %s",
std::string(__func__), CId_, E.displayText(), IncomingMessageStr ));
}
catch (const Poco::Net::WebSocketException & E)
{
std::string IncomingMessageStr = asString(IncomingFrame);
Logger_.warning(Poco::format("%s(%s): Caught a websocket exception: %s. Message: %s",
std::string(__func__), CId_, E.displayText(), IncomingMessageStr ));
MustDisconnect = true ;
}
catch (const Poco::Net::SSLConnectionUnexpectedlyClosedException & E)
{
std::string IncomingMessageStr = asString(IncomingFrame);
Logger_.warning(Poco::format("%s(%s): Caught a SSLConnectionUnexpectedlyClosedException: %s. Message: %s",
std::string(__func__), CId_, E.displayText(), IncomingMessageStr ));
MustDisconnect = true ;
}
catch (const Poco::Net::SSLException & E)
{
std::string IncomingMessageStr = asString(IncomingFrame);
Logger_.warning(Poco::format("%s(%s): Caught a SSL exception: %s. Message: %s",
std::string(__func__), CId_, E.displayText(), IncomingMessageStr ));
MustDisconnect = true ;
}
catch (const Poco::Net::NetException & E) {
std::string IncomingMessageStr = asString(IncomingFrame);
Logger_.warning( Poco::format("%s(%s): Caught a NetException: %s. Message: %s",
std::string(__func__), CId_, E.displayText(), IncomingMessageStr ));
MustDisconnect = true ;
}
catch (const Poco::IOException & E) {
std::string IncomingMessageStr = asString(IncomingFrame);
Logger_.warning( Poco::format("%s(%s): Caught a IOException: %s. Message: %s",
std::string(__func__), CId_, E.displayText(), IncomingMessageStr ));
MustDisconnect = true ;
}
catch (const Poco::Exception &E) {
std::string IncomingMessageStr = asString(IncomingFrame);
Logger_.warning( Poco::format("%s(%s): Caught a more generic Poco exception: %s. Message: %s",
std::string(__func__), CId_, E.displayText(), IncomingMessageStr ));
MustDisconnect = true ;
}
catch (const std::exception & E) {
std::string IncomingMessageStr = asString(IncomingFrame);
Logger_.warning( Poco::format("%s(%s): Caught a std::exception: %s. Message: %s",
std::string{__func__}, CId_, std::string{E.what()}, IncomingMessageStr) );
MustDisconnect = true ;
}
if(!MustDisconnect && Errors_<10)
return;
if(Errors_>10) {
Logger_.information(Poco::format("DISCONNECTING(%s): Too many errors",CId_));
}
delete this;
}
bool WSConnection::Send(const std::string &Payload) {
std::lock_guard Guard(Mutex_);
auto BytesSent = WS_->sendFrame(Payload.c_str(),(int)Payload.size());
if(Conn_)
Conn_->TX += BytesSent;
return BytesSent == Payload.size();
}
} //namespace

192
src/NewWebSocketServer.h Normal file
View File

@@ -0,0 +1,192 @@
//
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#ifndef UCENTRAL_UCENTRALWEBSOCKETSERVER_H
#define UCENTRAL_UCENTRALWEBSOCKETSERVER_H
#include <mutex>
#include <thread>
#include <array>
#include <ctime>
#include "DeviceRegistry.h"
#include "RESTAPI_GWobjects.h"
#include "StateProcessor.h"
#include "SubSystemServer.h"
#include "Poco/AutoPtr.h"
#include "Poco/Net/WebSocket.h"
#include "Poco/Net/NetException.h"
#include "Poco/JSON/Parser.h"
#include "Poco/DynamicAny.h"
#include "Poco/Net/SocketReactor.h"
#include "Poco/Net/SocketNotification.h"
#include "Poco/NObserver.h"
#include "Poco/Net/SocketAcceptor.h"
#include "Poco/Net/SocketNotification.h"
#include "Poco/Net/StreamSocket.h"
#include "Poco/Net/SecureStreamSocket.h"
#include "Poco/Net/SecureStreamSocketImpl.h"
#include "Poco/Net/ParallelSocketAcceptor.h"
#include "Poco/Environment.h"
#include "Poco/Net/HTTPRequestHandlerFactory.h"
#include "Poco/Net/HTTPRequestHandler.h"
#include "Poco/Net/HTTPServer.h"
namespace OpenWifi {
class ReactorPool {
public:
ReactorPool( unsigned int NumberOfThreads = Poco::Environment::processorCount() )
: NumberOfThreads_(NumberOfThreads)
{
}
void Start() {
for(auto i=0;i<NumberOfThreads_;++i) {
auto NewReactor = std::make_unique<Poco::Net::SocketReactor>();
auto NewThread = std::make_unique<Poco::Thread>();
NewThread->start(*NewReactor);
Reactors_.emplace_back( std::move(NewReactor));
Threads_.emplace_back( std::move(NewThread));
}
}
void Stop() {
for(auto &i:Reactors_)
i->stop();
for(auto &i:Threads_) {
i->join();
}
}
Poco::Net::SocketReactor & NextReactor() {
NextReactor_ ++;
NextReactor_ %= NumberOfThreads_;
return *Reactors_[NextReactor_];
}
private:
unsigned int NumberOfThreads_;
unsigned int NextReactor_=0;
std::vector<std::unique_ptr<Poco::Net::SocketReactor>> Reactors_;
std::vector<std::unique_ptr<Poco::Thread>> Threads_;
};
class WSConnection {
static constexpr int BufSize = 64000;
public:
WSConnection(Poco::SharedPtr<Poco::Net::WebSocket> WS, Poco::Net::SocketReactor& Reactor, Poco::Logger &Logger);
~WSConnection();
void ProcessJSONRPCEvent(Poco::JSON::Object::Ptr & Doc);
void ProcessJSONRPCResult(Poco::JSON::Object::Ptr & Doc);
void ProcessIncomingFrame();
bool Send(const std::string &Payload);
void OnSocketReadable(const Poco::AutoPtr<Poco::Net::ReadableNotification>& pNf);
void OnSocketShutdown(const Poco::AutoPtr<Poco::Net::ShutdownNotification>& pNf);
void OnSocketError(const Poco::AutoPtr<Poco::Net::ErrorNotification>& pNf);
bool LookForUpgrade(uint64_t UUID);
static bool ExtractCompressedData(const std::string & CompressedData, std::string & UnCompressedData);
void LogException(const Poco::Exception &E);
[[nodiscard]] GWObjects::CertificateValidation CertificateValidation() const { return CertValidation_; };
private:
std::recursive_mutex Mutex_;
Poco::SharedPtr<Poco::Net::WebSocket> WS_;
Poco::Net::SocketReactor & Reactor_;
Poco::Logger &Logger_;
Poco::Net::StreamSocket Socket_;
std::string SerialNumber_;
std::string Compatible_;
GWObjects::ConnectionState * Conn_ = nullptr;
bool Registered_ = false ;
std::string CId_;
std::string CN_;
GWObjects::CertificateValidation CertValidation_ = GWObjects::CertificateValidation::NO_CERTIFICATE;
uint64_t Errors_=0;
std::unique_ptr<StateProcessor> StatsProcessor_;
void CompleteStartup();
};
class WebSocketRequestHandler : public Poco::Net::HTTPRequestHandler {
public:
explicit WebSocketRequestHandler(ReactorPool &Pool, Poco::Logger &Logger) :
Pool_(Pool), Logger_(Logger) {}
void handleRequest(Poco::Net::HTTPServerRequest & Request, Poco::Net::HTTPServerResponse & Response) final {
try {
std::cout << __LINE__ << std::endl;
auto WS = Poco::SharedPtr<Poco::Net::WebSocket>(new Poco::Net::WebSocket(Request, Response));
std::cout << __LINE__ << std::endl;
new WSConnection(WS, Pool_.NextReactor(), Logger_);
std::cout << __LINE__ << std::endl;
} catch (const Poco::Exception &E) {
std::cout << E.what() << " " << E.name() << " " << E.displayText() << std::endl;
} catch (...) {
std::cout << __LINE__ << std::endl;
}
}
private:
ReactorPool &Pool_;
Poco::Logger &Logger_;
};
class WebSocketRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory {
public:
explicit WebSocketRequestHandlerFactory(ReactorPool & Pool, Poco::Logger & Logger) :
Pool_(Pool),
Logger_(Logger)
{}
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest & Request) final {
std::cout << __LINE__ << std::endl;
return new WebSocketRequestHandler(Pool_,Logger_);
}
private:
Poco::Logger & Logger_;
ReactorPool & Pool_;
};
class WebSocketServer : public SubSystemServer {
public:
static WebSocketServer *instance() {
if (instance_ == nullptr) {
instance_ = new WebSocketServer;
}
return instance_;
}
int Start() override;
void Stop() override;
bool IsCertOk() { return IssuerCert_!= nullptr; }
const Poco::Crypto::X509Certificate & Certificate() const { return *IssuerCert_; }
bool ValidateCertificate(const std::string & ConnectionId, const Poco::Crypto::X509Certificate & Certificate);
private:
static WebSocketServer *instance_;
std::unique_ptr<Poco::Crypto::X509Certificate> IssuerCert_;
ReactorPool ReactorPool_;
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> WebServers_;
Poco::ThreadPool Pool_;
WebSocketServer() noexcept: SubSystemServer("WebSocketServer", "WS-SVR", "nano")
{
std::cout << __LINE__ << std::endl;
}
};
inline WebSocketServer * WebSocketServer() { return WebSocketServer::instance(); }
} //namespace
#endif //UCENTRAL_UCENTRALWEBSOCKETSERVER_H

View File

@@ -17,7 +17,7 @@
#include "Utils.h"
namespace uCentral {
namespace OpenWifi {
class OUIServer * OUIServer::instance_;
int OUIServer::Start() {
@@ -38,6 +38,13 @@ namespace uCentral {
Updater.detach();
}
void OUIServer::reinitialize(Poco::Util::Application &self) {
Daemon()->LoadConfigurationFile();
Logger_.information("Reinitializing.");
Stop();
Start();
}
bool OUIServer::GetFile(const std::string &FileName) {
try {
std::unique_ptr<std::istream> pStr(
@@ -102,7 +109,7 @@ namespace uCentral {
OUIMap TmpOUIs;
if(GetFile(LatestOUIFileName) && ProcessFile(LatestOUIFileName, TmpOUIs)) {
SubMutexGuard G(Mutex_);
std::lock_guard G(Mutex_);
OUIs_ = std::move(TmpOUIs);
LastUpdate_ = time(nullptr);
Poco::File F1(CurrentOUIFileName);
@@ -114,7 +121,7 @@ namespace uCentral {
} else if(OUIs_.empty()) {
if(ProcessFile(CurrentOUIFileName, TmpOUIs)) {
LastUpdate_ = time(nullptr);
SubMutexGuard G(Mutex_);
std::lock_guard G(Mutex_);
OUIs_ = std::move(TmpOUIs);
}
}
@@ -122,7 +129,7 @@ namespace uCentral {
}
std::string OUIServer::GetManufacturer(const std::string &MAC) {
SubMutexGuard Guard(Mutex_);
std::lock_guard Guard(Mutex_);
auto Manufacturer = OUIs_.find(Utils::SerialNumberToOUI(MAC));
if(Manufacturer != OUIs_.end())
return Manufacturer->second;

View File

@@ -7,7 +7,7 @@
#include "SubSystemServer.h"
namespace uCentral {
namespace OpenWifi {
class OUIServer : public SubSystemServer {
public:
@@ -23,6 +23,9 @@ namespace uCentral {
int Start() override;
void Stop() override;
void reinitialize(Poco::Util::Application &self) override;
void Update();
void UpdateImpl();
[[nodiscard]] std::string GetManufacturer(const std::string &MAC);

View File

@@ -1,30 +1,33 @@
//
// Created by stephane bourque on 2021-07-01.
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
//
#include <iostream>
#include "OpenAPIRequest.h"
#include "Poco/Net/HTTPSClientSession.h"
#include <Poco/Net/HTTPClientSession.h>
#include <Poco/Net/HTTPRequest.h>
#include <Poco/Net/HTTPResponse.h>
#include <Poco/StreamCopier.h>
#include <Poco/JSON/Parser.h>
#include <Poco/Path.h>
#include <Poco/URI.h>
#include <Poco/Exception.h>
#include "Utils.h"
#include "Daemon.h"
namespace uCentral {
namespace OpenWifi {
OpenAPIRequestGet::OpenAPIRequestGet( const std::string & ServiceType,
const std::string & EndPoint,
OpenAPIRequestGet::OpenAPIRequestGet( std::string ServiceType,
std::string EndPoint,
Types::StringPairVec & QueryData,
uint64_t msTimeout):
Type_(ServiceType),
EndPoint_(EndPoint),
Type_(std::move(ServiceType)),
EndPoint_(std::move(EndPoint)),
QueryData_(QueryData),
msTimeout_(msTimeout) {
@@ -42,7 +45,7 @@ namespace uCentral {
URI.addQueryParameter(qp.first, qp.second);
std::string Path(URI.getPathAndQuery());
Session.setTimeout(Poco::Timespan(5, 0));
Session.setTimeout(Poco::Timespan(msTimeout_/1000, msTimeout_ % 1000));
Poco::Net::HTTPRequest Request(Poco::Net::HTTPRequest::HTTP_GET,
Path,

View File

@@ -1,5 +1,9 @@
//
// Created by stephane bourque on 2021-07-01.
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#ifndef UCENTRALGW_OPENAPIREQUEST_H
@@ -7,14 +11,14 @@
#include "Poco/JSON/Object.h"
#include "uCentralTypes.h"
#include "OpenWifiTypes.h"
namespace uCentral {
namespace OpenWifi {
class OpenAPIRequestGet {
public:
explicit OpenAPIRequestGet( const std::string & Type,
const std::string & EndPoint,
explicit OpenAPIRequestGet( std::string Type,
std::string EndPoint,
Types::StringPairVec & QueryData,
uint64_t msTimeout);
int Do(Poco::JSON::Object::Ptr &ResponseObject);

106
src/OpenWifiTypes.h Normal file
View File

@@ -0,0 +1,106 @@
//
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by Stephane Bourque on 2021-03-04.
// Arilia Wireless Inc.
//
#ifndef UCENTRALGW_UCENTRALTYPES_H
#define UCENTRALGW_UCENTRALTYPES_H
#include "SubSystemServer.h"
#include <vector>
#include <string>
#include <map>
#include <functional>
#include <list>
#include <utility>
#include <queue>
#include "Poco/StringTokenizer.h"
#include "Poco/JSON/Parser.h"
#include "Poco/JSON/Stringifier.h"
namespace OpenWifi::Types {
typedef std::pair<std::string,std::string> StringPair;
typedef std::vector<StringPair> StringPairVec;
typedef std::queue<StringPair> StringPairQueue;
typedef std::vector<std::string> StringVec;
typedef std::set<std::string> StringSet;
typedef std::vector<SubSystemServer*> SubSystemVec;
typedef std::map<std::string,std::set<std::string>> StringMapStringSet;
typedef std::function<void(std::string, std::string)> TopicNotifyFunction;
typedef std::list<std::pair<TopicNotifyFunction,int>> TopicNotifyFunctionList;
typedef std::map<std::string, TopicNotifyFunctionList> NotifyTable;
typedef std::map<std::string,uint64_t> CountedMap;
typedef std::string UUID_t;
typedef std::vector<UUID_t> UUIDvec_t;
inline void UpdateCountedMap(CountedMap &M, const std::string &S, uint64_t Increment=1) {
auto it = M.find(S);
if(it==M.end())
M[S] = Increment;
else
it->second += Increment;
}
inline std::string to_string( const StringVec &V) {
Poco::JSON::Array O;
for(const auto &i:V) {
O.add(i);
}
std::stringstream SS;
Poco::JSON::Stringifier::stringify(O,SS);
return SS.str();
}
inline std::string to_string( const StringPairVec &V) {
Poco::JSON::Array O;
for(const auto &i:V) {
Poco::JSON::Array OO;
OO.add(i.first);
OO.add(i.second);
O.add(OO);
}
std::stringstream SS;
Poco::JSON::Stringifier::stringify(O,SS);
return SS.str();
}
inline void from_string(const std::string &S, StringPairVec &V) {
try {
Poco::JSON::Parser P;
auto O = P.parse(S).extract<Poco::JSON::Array::Ptr>();
for(const auto &i:*O) {
auto Inner = i.extract<Poco::JSON::Array::Ptr>();
for(const auto &j:*Inner) {
auto S1 = i[0].toString();
auto S2 = i[1].toString();
V.push_back(std::make_pair(S1,S2));
}
}
} catch (...) {
}
}
inline void from_string(const std::string &S, StringVec &V) {
try {
Poco::JSON::Parser P;
auto O = P.parse(S).extract<Poco::JSON::Array::Ptr>();
for(auto const &i:*O) {
V.push_back(i.toString());
}
} catch (...) {
}
}
};
#endif // UCENTRALGW_UCENTRALTYPES_H

View File

@@ -13,59 +13,33 @@
#include "RESTAPI_BlackList.h"
#include "RESTAPI_protocol.h"
#include "StorageService.h"
#include "RESTAPI_errors.h"
namespace uCentral {
void RESTAPI_BlackList::handleRequest(Poco::Net::HTTPServerRequest &Request,
Poco::Net::HTTPServerResponse &Response) {
namespace OpenWifi {
if (!ContinueProcessing(Request, Response))
void RESTAPI_BlackList::DoDelete() {
auto SerialNumber = GetBinding(RESTAPI::Protocol::SERIALNUMBER, "");
if(SerialNumber.empty()) {
BadRequest(RESTAPI::Errors::MissingSerialNumber);
return;
if (!IsAuthorized(Request, Response))
return;
ParseParameters(Request);
try {
if (Request.getMethod() == Poco::Net::HTTPRequest::HTTP_DELETE)
DoDelete(Request, Response);
else if (Request.getMethod() == Poco::Net::HTTPRequest::HTTP_GET)
DoGet(Request, Response);
else if (Request.getMethod() == Poco::Net::HTTPRequest::HTTP_POST)
DoPost(Request, Response);
return;
} catch (const Poco::Exception &E) {
Logger_.error(Poco::format("%s: failed with %s", std::string(__func__), E.displayText()));
}
BadRequest(Request, Response);
}
void RESTAPI_BlackList::DoDelete(Poco::Net::HTTPServerRequest &Request,
Poco::Net::HTTPServerResponse &Response) {
GWObjects::BlackListedDevice D;
if(!Storage()->GetBlackListDevice(SerialNumber, D)) {
NotFound();
return;
}
try {
auto SerialNumber = GetBinding(uCentral::RESTAPI::Protocol::SERIALNUMBER, "");
if (!SerialNumber.empty()) {
if (Storage()->DeleteBlackListDevice(SerialNumber)) {
OK(Request, Response);
} else {
NotFound(Request, Response);
}
OK();
return;
}
} catch (const Poco::Exception &E) {
Logger_.log(E);
}
BadRequest(Request, Response);
BadRequest(RESTAPI::Errors::CouldNotBeDeleted);
}
void RESTAPI_BlackList::DoGet(Poco::Net::HTTPServerRequest &Request,
Poco::Net::HTTPServerResponse &Response) {
try {
InitQueryBlock();
void RESTAPI_BlackList::DoGet() {
std::vector<GWObjects::BlackListedDevice> Devices;
Poco::JSON::Array Objects;
if (Storage()->GetBlackListDevices(QB_.Offset, QB_.Limit, Devices)) {
for (const auto &i : Devices) {
@@ -75,34 +49,24 @@ namespace uCentral {
}
}
Poco::JSON::Object RetObj;
RetObj.set(uCentral::RESTAPI::Protocol::DEVICES, Objects);
ReturnObject(Request, RetObj, Response);
return;
} catch (const Poco::Exception &E) {
Logger_.log(E);
}
BadRequest(Request, Response);
RetObj.set(RESTAPI::Protocol::DEVICES, Objects);
ReturnObject(RetObj);
}
void RESTAPI_BlackList::DoPost(Poco::Net::HTTPServerRequest &Request,
Poco::Net::HTTPServerResponse &Response) {
try {
Poco::JSON::Parser parser;
Poco::JSON::Object::Ptr Obj =
parser.parse(Request.stream()).extract<Poco::JSON::Object::Ptr>();
if (Obj->has(uCentral::RESTAPI::Protocol::DEVICES) &&
Obj->isArray(uCentral::RESTAPI::Protocol::DEVICES)) {
void RESTAPI_BlackList::DoPost() {
auto Obj = ParseStream();
if (Obj->has(RESTAPI::Protocol::DEVICES) &&
Obj->isArray(RESTAPI::Protocol::DEVICES)) {
std::vector<GWObjects::BlackListedDevice> Devices;
auto DeviceArray = Obj->getArray(uCentral::RESTAPI::Protocol::DEVICES);
auto DeviceArray = Obj->getArray(RESTAPI::Protocol::DEVICES);
for (const auto &i : *DeviceArray) {
Poco::JSON::Parser pp;
auto InnerObj = pp.parse(i).extract<Poco::JSON::Object::Ptr>();
Poco::DynamicStruct Vars = *InnerObj;
if (Vars.contains(uCentral::RESTAPI::Protocol::SERIALNUMBER) &&
Vars.contains(uCentral::RESTAPI::Protocol::REASON)) {
auto SerialNumber = Vars[uCentral::RESTAPI::Protocol::SERIALNUMBER].toString();
auto Reason = Vars[uCentral::RESTAPI::Protocol::REASON].toString();
if (Vars.contains(RESTAPI::Protocol::SERIALNUMBER) &&
Vars.contains(RESTAPI::Protocol::REASON)) {
auto SerialNumber = Vars[RESTAPI::Protocol::SERIALNUMBER].toString();
auto Reason = Vars[RESTAPI::Protocol::REASON].toString();
GWObjects::BlackListedDevice D{.SerialNumber = SerialNumber,
.Reason = Reason,
.Author = UserInfo_.webtoken.username_,
@@ -112,14 +76,14 @@ namespace uCentral {
}
if (!Devices.empty()) {
if (Storage()->AddBlackListDevices(Devices)) {
OK(Request, Response);
OK();
return;
}
} else {
BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
} else {
BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
} catch (const Poco::Exception &E) {
Logger_.log(E);
}
BadRequest(Request, Response);
}
}

View File

@@ -11,22 +11,22 @@
#include "RESTAPI_handler.h"
namespace uCentral {
namespace OpenWifi {
class RESTAPI_BlackList : public RESTAPIHandler {
public:
RESTAPI_BlackList(const RESTAPIHandler::BindingMap &bindings, Poco::Logger &L)
RESTAPI_BlackList(const RESTAPIHandler::BindingMap &bindings, Poco::Logger &L, RESTAPI_GenericServer & Server, bool Internal)
: RESTAPIHandler(bindings, L,
std::vector<std::string>{Poco::Net::HTTPRequest::HTTP_GET,
Poco::Net::HTTPRequest::HTTP_POST,
Poco::Net::HTTPRequest::HTTP_DELETE,
Poco::Net::HTTPRequest::HTTP_OPTIONS}) {}
void handleRequest(Poco::Net::HTTPServerRequest &request,
Poco::Net::HTTPServerResponse &response) override;
void DoGet(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response);
void DoDelete(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response);
void DoPost(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response);
Poco::Net::HTTPRequest::HTTP_OPTIONS},
Server,
Internal) {}
static const std::list<const char *> PathName() { return std::list<const char *>{"/api/v1/blacklist"};}
void DoGet() final;
void DoDelete() final;
void DoPost() final;
void DoPut() final {};
};
}

View File

@@ -19,16 +19,16 @@
#include "RESTAPI_utils.h"
#include "Utils.h"
using uCentral::RESTAPI_utils::field_to_json;
using uCentral::RESTAPI_utils::field_from_json;
using uCentral::RESTAPI_utils::EmbedDocument;
using OpenWifi::RESTAPI_utils::field_to_json;
using OpenWifi::RESTAPI_utils::field_from_json;
using OpenWifi::RESTAPI_utils::EmbedDocument;
namespace uCentral::GWObjects {
namespace OpenWifi::GWObjects {
void Device::to_json(Poco::JSON::Object &Obj) const {
field_to_json(Obj,"serialNumber", SerialNumber);
#ifdef TIP_GATEWAY_SERVICE
field_to_json(Obj,"deviceType", uCentral::Daemon::instance()->IdentifyDevice(Compatible));
field_to_json(Obj,"deviceType", Daemon::instance()->IdentifyDevice(Compatible));
#endif
field_to_json(Obj,"macAddress", MACAddress);
field_to_json(Obj,"manufacturer", Manufacturer);
@@ -57,13 +57,15 @@ namespace uCentral::GWObjects {
if (DeviceRegistry()->GetState(SerialNumber, ConState)) {
ConState.to_json(Obj);
} else {
field_to_json(Obj,"ipAddress", "N/A");
field_to_json(Obj,"ipAddress", "");
field_to_json(Obj,"txBytes", (uint64_t) 0);
field_to_json(Obj,"rxBytes", (uint64_t )0);
field_to_json(Obj,"messageCount", (uint64_t )0);
field_to_json(Obj,"connected", false);
field_to_json(Obj,"lastContact", "N/A");
field_to_json(Obj,"lastContact", "");
field_to_json(Obj,"verifiedCertificate", "NO_CERTIFICATE");
field_to_json(Obj,"associations_2G", (uint64_t) 0);
field_to_json(Obj,"associations_5G", (uint64_t) 0);
}
#endif
}
@@ -176,6 +178,9 @@ namespace uCentral::GWObjects {
field_to_json(Obj,"connected", Connected);
field_to_json(Obj,"firmware", Firmware);
field_to_json(Obj,"lastContact", LastContact);
field_to_json(Obj,"associations_2G", Associations_2G);
field_to_json(Obj,"associations_5G", Associations_5G);
switch(VerifiedCertificate) {
case NO_CERTIFICATE:
field_to_json(Obj,"verifiedCertificate", "NO_CERTIFICATE"); break;
@@ -203,5 +208,40 @@ namespace uCentral::GWObjects {
field_to_json(Obj,"password",DevicePassword);
}
void Dashboard::to_json(Poco::JSON::Object &Obj) const {
field_to_json(Obj,"commands",commands);
field_to_json(Obj,"upTimes",upTimes);
field_to_json(Obj,"memoryUsed",memoryUsed);
field_to_json(Obj,"load1",load1);
field_to_json(Obj,"load5",load5);
field_to_json(Obj,"load15",load15);
field_to_json(Obj,"vendors",vendors);
field_to_json(Obj,"status",status);
field_to_json(Obj,"deviceType",deviceType);
field_to_json(Obj,"healths",healths);
field_to_json(Obj,"certificates",certificates);
field_to_json(Obj,"lastContact",lastContact);
field_to_json(Obj,"associations",associations);
field_to_json(Obj,"snapshot",snapshot);
field_to_json(Obj,"numberOfDevices",numberOfDevices);
}
void Dashboard::reset() {
commands.clear();
upTimes.clear();
memoryUsed.clear();
load1.clear();
load5.clear();
load15.clear();
vendors.clear();
status.clear();
deviceType.clear();
healths.clear();
certificates.clear();
lastContact.clear();
associations.clear();
numberOfDevices = 0 ;
snapshot = std::time(nullptr);
}
}

View File

@@ -12,7 +12,7 @@
#include "Poco/JSON/Object.h"
#include "RESTAPI_SecurityObjects.h"
namespace uCentral::GWObjects {
namespace OpenWifi::GWObjects {
enum CertificateValidation {
NO_CERTIFICATE,
@@ -24,14 +24,17 @@ namespace uCentral::GWObjects {
struct ConnectionState {
uint64_t MessageCount = 0 ;
std::string SerialNumber;
std::string Address = "N/A";
std::string Address;
uint64_t UUID = 0 ;
uint64_t PendingUUID = 0 ;
uint64_t TX = 0, RX = 0;
uint64_t Associations_2G=0;
uint64_t Associations_5G=0;
bool Connected = false;
uint64_t LastContact=0;
std::string Firmware;
CertificateValidation VerifiedCertificate = NO_CERTIFICATE;
std::string Compatible;
void to_json(Poco::JSON::Object &Obj) const;
};
@@ -61,6 +64,7 @@ namespace uCentral::GWObjects {
};
struct Statistics {
std::string SerialNumber;
uint64_t UUID;
std::string Data;
uint64_t Recorded;
@@ -68,6 +72,7 @@ namespace uCentral::GWObjects {
};
struct HealthCheck {
std::string SerialNumber;
uint64_t UUID;
std::string Data;
uint64_t Recorded;
@@ -93,6 +98,7 @@ namespace uCentral::GWObjects {
LOG_INFO = 6, /* informational */
LOG_DEBUG = 7 /* debug-level messages */
};
std::string SerialNumber;
std::string Log;
std::string Data;
uint64_t Severity;
@@ -156,6 +162,26 @@ namespace uCentral::GWObjects {
std::string DevicePassword;
void to_json(Poco::JSON::Object &Obj) const;
};
struct Dashboard {
uint64_t snapshot;
uint64_t numberOfDevices;
Types::CountedMap commands;
Types::CountedMap upTimes;
Types::CountedMap memoryUsed;
Types::CountedMap load1;
Types::CountedMap load5;
Types::CountedMap load15;
Types::CountedMap vendors;
Types::CountedMap status;
Types::CountedMap deviceType;
Types::CountedMap healths;
Types::CountedMap certificates;
Types::CountedMap lastContact;
Types::CountedMap associations;
void to_json(Poco::JSON::Object &Obj) const;
void reset();
};
}
#endif //UCENTRAL_RESTAPI_OBJECTS_H

View File

@@ -0,0 +1,5 @@
//
// Created by stephane bourque on 2021-09-15.
//
#include "RESTAPI_GenericServer.h"

View File

@@ -0,0 +1,78 @@
//
// Created by stephane bourque on 2021-09-15.
//
#ifndef OWPROV_RESTAPI_GENERICSERVER_H
#define OWPROV_RESTAPI_GENERICSERVER_H
#include <vector>
#include <string>
#include "Daemon.h"
#include "Poco/StringTokenizer.h"
#include "Poco/Net/HTTPRequest.h"
namespace OpenWifi {
class RESTAPI_GenericServer {
public:
enum {
LOG_GET=0,
LOG_DELETE,
LOG_PUT,
LOG_POST
};
void inline SetFlags(bool External, const std::string &Methods) {
Poco::StringTokenizer Tokens(Methods,",");
auto Offset = (External ? 0 : 4);
for(const auto &i:Tokens) {
if(Poco::icompare(i,Poco::Net::HTTPRequest::HTTP_DELETE)==0)
LogFlags_[Offset+LOG_DELETE]=true;
else if(Poco::icompare(i,Poco::Net::HTTPRequest::HTTP_PUT)==0)
LogFlags_[Offset+LOG_PUT]=true;
else if(Poco::icompare(i,Poco::Net::HTTPRequest::HTTP_POST)==0)
LogFlags_[Offset+LOG_POST]=true;
else if(Poco::icompare(i,Poco::Net::HTTPRequest::HTTP_GET)==0)
LogFlags_[Offset+LOG_GET]=true;
}
}
inline void InitLogging() {
std::string Public = Daemon()->ConfigGetString("apilogging.public.methods","PUT,POST,DELETE");
SetFlags(true, Public);
std::string Private = Daemon()->ConfigGetString("apilogging.private.methods","PUT,POST,DELETE");
SetFlags(false, Private);
std::string PublicBadTokens = Daemon()->ConfigGetString("apilogging.public.badtokens.methods","");
LogBadTokens_[0] = (Poco::icompare(PublicBadTokens,"true")==0);
std::string PrivateBadTokens = Daemon()->ConfigGetString("apilogging.private.badtokens.methods","");
LogBadTokens_[1] = (Poco::icompare(PrivateBadTokens,"true")==0);
}
[[nodiscard]] inline bool LogIt(const std::string &Method, bool External) const {
auto Offset = (External ? 0 : 4);
if(Method == Poco::Net::HTTPRequest::HTTP_GET)
return LogFlags_[Offset+LOG_GET];
if(Method == Poco::Net::HTTPRequest::HTTP_POST)
return LogFlags_[Offset+LOG_POST];
if(Method == Poco::Net::HTTPRequest::HTTP_PUT)
return LogFlags_[Offset+LOG_PUT];
if(Method == Poco::Net::HTTPRequest::HTTP_DELETE)
return LogFlags_[Offset+LOG_DELETE];
return false;
};
[[nodiscard]] inline bool LogBadTokens(bool External) const {
return LogBadTokens_[ (External ? 0 : 1) ];
};
private:
std::array<bool,8> LogFlags_{false};
std::array<bool,2> LogBadTokens_{false};
};
}
#endif //OWPROV_RESTAPI_GENERICSERVER_H

View File

@@ -7,7 +7,6 @@
#include "Poco/URI.h"
#include "RESTAPI_BlackList.h"
#include "RESTAPI_callback.h"
#include "RESTAPI_command.h"
#include "RESTAPI_commands.h"
#include "RESTAPI_default_configuration.h"
@@ -16,20 +15,16 @@
#include "RESTAPI_device_handler.h"
#include "RESTAPI_devices_handler.h"
#include "RESTAPI_file.h"
#include "RESTAPI_system_command.h"
#include "RESTAPI_ouis.h"
#include "Utils.h"
namespace uCentral {
namespace OpenWifi {
class RESTAPI_InternalServer *RESTAPI_InternalServer::instance_ = nullptr;
RESTAPI_InternalServer::RESTAPI_InternalServer() noexcept: SubSystemServer("RESTAPIInternalServer", "REST-ISRV", "ucentral.internal.restapi")
{
}
int RESTAPI_InternalServer::Start() {
Logger_.information("Starting.");
Server_.InitLogging();
for(const auto & Svr: ConfigServersList_) {
Logger_.information(Poco::format("Starting: %s:%s Keyfile:%s CertFile: %s", Svr.Address(), std::to_string(Svr.Port()),
@@ -45,7 +40,7 @@ namespace uCentral {
Params->setMaxQueued(200);
Params->setKeepAlive(true);
auto NewServer = std::make_unique<Poco::Net::HTTPServer>(new InternalRequestHandlerFactory, Pool_, Sock, Params);
auto NewServer = std::make_unique<Poco::Net::HTTPServer>(new InternalRequestHandlerFactory(Server_), Pool_, Sock, Params);
NewServer->start();
RESTServers_.push_back(std::move(NewServer));
}
@@ -57,17 +52,22 @@ namespace uCentral {
Logger_.information("Stopping ");
for( const auto & svr : RESTServers_ )
svr->stop();
RESTServers_.clear();
}
void RESTAPI_InternalServer::reinitialize(Poco::Util::Application &self) {
Daemon()->LoadConfigurationFile();
Logger_.information("Reinitializing.");
Stop();
Start();
}
Poco::Net::HTTPRequestHandler *InternalRequestHandlerFactory::createRequestHandler(const Poco::Net::HTTPServerRequest & Request) {
Logger_.debug(Poco::format("REQUEST(%s): %s %s", uCentral::Utils::FormatIPv6(Request.clientAddress().toString()), Request.getMethod(), Request.getURI()));
Poco::URI uri(Request.getURI());
const auto & Path = uri.getPath();
RESTAPIHandler::BindingMap Bindings;
return RESTAPI_Router<
return RESTAPI_Router_I<
RESTAPI_devices_handler,
RESTAPI_device_handler,
RESTAPI_device_commandHandler,
@@ -77,6 +77,6 @@ namespace uCentral {
RESTAPI_commands,
RESTAPI_ouis,
RESTAPI_file,
RESTAPI_BlackList>(Path,Bindings,Logger_); }
RESTAPI_BlackList>(Path,Bindings,Logger_, Server_); }
}

View File

@@ -11,13 +11,13 @@
#include "Poco/Net/HTTPRequestHandlerFactory.h"
#include "Poco/Net/HTTPServerRequest.h"
#include "Poco/Net/NetException.h"
#include "RESTAPI_GenericServer.h"
namespace uCentral {
namespace OpenWifi {
class RESTAPI_InternalServer : public SubSystemServer {
public:
RESTAPI_InternalServer() noexcept;
static RESTAPI_InternalServer *instance() {
if (instance_ == nullptr) {
@@ -28,23 +28,32 @@ namespace uCentral {
int Start() override;
void Stop() override;
void reinitialize(Poco::Util::Application &self) override;
private:
static RESTAPI_InternalServer *instance_;
std::vector<std::unique_ptr<Poco::Net::HTTPServer>> RESTServers_;
Poco::ThreadPool Pool_;
RESTAPI_GenericServer Server_;
RESTAPI_InternalServer() noexcept: SubSystemServer("RESTAPIInternalServer", "REST-ISRV", "openwifi.internal.restapi")
{
}
};
inline RESTAPI_InternalServer * RESTAPI_InternalServer() { return RESTAPI_InternalServer::instance(); };
class InternalRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory {
public:
InternalRequestHandlerFactory() :
Logger_(RESTAPI_InternalServer()->Logger()){}
explicit InternalRequestHandlerFactory(RESTAPI_GenericServer & Server) :
Logger_(RESTAPI_InternalServer()->Logger()),
Server_(Server)
{}
Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &request) override;
private:
Poco::Logger & Logger_;
RESTAPI_GenericServer & Server_;
};

View File

@@ -13,19 +13,22 @@
#include "StorageService.h"
#include "DeviceRegistry.h"
#include "CommandManager.h"
#include "uCentralProtocol.h"
namespace uCentral::RESTAPI_RPC {
void SetCommandAsPending(GWObjects::CommandDetails &Cmd,
namespace OpenWifi::RESTAPI_RPC {
void SetCommandStatus(GWObjects::CommandDetails &Cmd,
Poco::Net::HTTPServerRequest &Request,
Poco::Net::HTTPServerResponse &Response, RESTAPIHandler *Handler) {
if (Storage()->AddCommand(Cmd.SerialNumber, Cmd, Storage::COMMAND_PENDING)) {
Poco::Net::HTTPServerResponse &Response,
RESTAPIHandler *Handler,
OpenWifi::Storage::CommandExecutionType Status,
Poco::Logger &Logger) {
if (Storage()->AddCommand(Cmd.SerialNumber, Cmd, Status)) {
Poco::JSON::Object RetObj;
Cmd.to_json(RetObj);
Handler->ReturnObject(Request, RetObj, Response);
Handler->ReturnObject(RetObj);
return;
} else {
Handler->ReturnStatus(Request, Response,
Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);
Handler->ReturnStatus(Poco::Net::HTTPResponse::HTTP_INTERNAL_SERVER_ERROR);
return;
}
}
@@ -34,26 +37,26 @@ namespace uCentral::RESTAPI_RPC {
Poco::JSON::Object & Params,
Poco::Net::HTTPServerRequest &Request,
Poco::Net::HTTPServerResponse &Response,
std::chrono::milliseconds D,
int64_t WaitTimeInMs,
Poco::JSON::Object * ObjectToReturn,
RESTAPIHandler * Handler) {
RESTAPIHandler * Handler,
Poco::Logger &Logger) {
// if the command should be executed in the future, or if the device is not connected, then we should just add the command to
// the DB and let it figure out when to deliver the command.
if(Cmd.RunAt || !DeviceRegistry()->Connected(Cmd.SerialNumber)) {
SetCommandAsPending(Cmd, Request, Response, Handler);
SetCommandStatus(Cmd, Request, Response, Handler, Storage::COMMAND_PENDING, Logger);
return;
} else if(Cmd.RunAt==0 && DeviceRegistry()->Connected(Cmd.SerialNumber)) {
auto Promise = std::make_shared<std::promise<Poco::JSON::Object::Ptr>>();
std::future<Poco::JSON::Object::Ptr> Future = Promise->get_future();
}
Cmd.Executed = time(nullptr);
if (CommandManager()->SendCommand(Cmd.SerialNumber, Cmd.Command, Params, Promise, Cmd.UUID)) {
auto Status = Future.wait_for(D);
if (Status == std::future_status::ready) {
auto Answer = Future.get();
Cmd.Executed = std::time(nullptr);
uint64_t RPC_Id=0;
if (CommandManager()->SendCommand(Cmd.SerialNumber, Cmd.Command, Params, Cmd.UUID, RPC_Id)) {
CommandTag T;
while (CommandManager()->Running() && WaitTimeInMs > 0) {
if (CommandManager()->GetCommand(RPC_Id, Cmd.SerialNumber, T)) {
auto Answer = T.Result;
if (Answer->has("result") && Answer->isObject("result")) {
auto ResultFields =
Answer->get("result").extract<Poco::JSON::Object::Ptr>();
@@ -70,63 +73,46 @@ namespace uCentral::RESTAPI_RPC {
Cmd.Status = "completed";
Cmd.Completed = time(nullptr);
// Add the completed command to the database...
Storage()->AddCommand(Cmd.SerialNumber, Cmd,Storage::COMMAND_COMPLETED);
if (Cmd.ErrorCode && Cmd.Command == uCentralProtocol::TRACE) {
Cmd.WaitingForFile = 0;
Cmd.AttachDate = Cmd.AttachSize = 0;
Cmd.AttachType = "";
}
if(ObjectToReturn) {
Handler->ReturnObject(Request, *ObjectToReturn, Response);
// Add the completed command to the database...
Storage()->AddCommand(Cmd.SerialNumber, Cmd,
Storage::COMMAND_COMPLETED);
if (ObjectToReturn) {
Handler->ReturnObject(*ObjectToReturn);
} else {
Poco::JSON::Object O;
Cmd.to_json(O);
Handler->ReturnObject(Request, O, Response);
Handler->ReturnObject(O);
}
return;
} else {
SetCommandStatus(Cmd, Request, Response, Handler, Storage::COMMAND_FAILED, Logger);
Logger.information(Poco::format("Invalid response for command '%s'. Missing status.", Cmd.UUID));
return;
}
} else {
SetCommandAsPending(Cmd, Request, Response, Handler);
SetCommandStatus(Cmd, Request, Response, Handler, Storage::COMMAND_FAILED, Logger);
Logger.information(Poco::format("Invalid response for command '%s'. Missing result.", Cmd.UUID));
return;
}
} else {
SetCommandAsPending(Cmd, Request, Response, Handler);
return;
Poco::Thread::trySleep(100);
WaitTimeInMs -= 100;
}
}
if(WaitTimeInMs<0)
SetCommandStatus(Cmd, Request, Response, Handler, Storage::COMMAND_TIMEDOUT, Logger);
else
SetCommandStatus(Cmd, Request, Response, Handler, Storage::COMMAND_PENDING, Logger);
} else {
SetCommandAsPending(Cmd, Request, Response, Handler);
return;
SetCommandStatus(Cmd, Request, Response, Handler, Storage::COMMAND_PENDING, Logger);
}
}
}
bool WaitForRPC(GWObjects::CommandDetails &Cmd,
Poco::Net::HTTPServerRequest &Request,
Poco::Net::HTTPServerResponse &Response, uint64_t Timeout,
bool ReturnValue,
RESTAPIHandler * Handler) {
if (DeviceRegistry()->Connected(Cmd.SerialNumber)) {
GWObjects::CommandDetails ResCmd;
while (Timeout > 0) {
Timeout -= 1000;
Poco::Thread::sleep(1000);
if (Storage()->GetCommand(Cmd.UUID, ResCmd)) {
if (ResCmd.Completed) {
if (ReturnValue) {
Poco::JSON::Object RetObj;
ResCmd.to_json(RetObj);
Handler->ReturnObject(Request, RetObj, Response);
}
return true;
}
}
}
}
if (ReturnValue) {
Poco::JSON::Object RetObj;
Cmd.to_json(RetObj);
Handler->ReturnObject(Request, RetObj, Response);
}
return false;
}
}

View File

@@ -17,27 +17,25 @@
#include "RESTAPI_GWobjects.h"
#include "RESTAPI_handler.h"
#include "StorageService.h"
namespace uCentral::RESTAPI_RPC {
bool WaitForRPC(GWObjects::CommandDetails &Cmd,
Poco::Net::HTTPServerRequest &Request,
Poco::Net::HTTPServerResponse &Response,
uint64_t Timeout,
bool ReturnObject,
RESTAPIHandler * Handler);
namespace OpenWifi::RESTAPI_RPC {
void WaitForCommand( GWObjects::CommandDetails &Cmd,
Poco::JSON::Object & Params,
Poco::Net::HTTPServerRequest &Request,
Poco::Net::HTTPServerResponse &Response,
std::chrono::milliseconds D,
int64_t WaitTimeInMs,
Poco::JSON::Object * ObjectToReturn,
RESTAPIHandler * Handler);
RESTAPIHandler * Handler,
Poco::Logger &Logger);
void SetCommandAsPending(GWObjects::CommandDetails &Cmd,
void SetCommandStatus( GWObjects::CommandDetails &Cmd,
Poco::Net::HTTPServerRequest &Request,
Poco::Net::HTTPServerResponse &Response, RESTAPIHandler * handler);
Poco::Net::HTTPServerResponse &Response, RESTAPIHandler * handler,
OpenWifi::Storage::CommandExecutionType Status,
Poco::Logger &Logger);
}
#endif // UCENTRALGW_RESTAPI_RPC_H

View File

@@ -12,10 +12,10 @@
#include "RESTAPI_SecurityObjects.h"
#include "RESTAPI_utils.h"
using uCentral::RESTAPI_utils::field_to_json;
using uCentral::RESTAPI_utils::field_from_json;
using OpenWifi::RESTAPI_utils::field_to_json;
using OpenWifi::RESTAPI_utils::field_from_json;
namespace uCentral::SecurityObjects {
namespace OpenWifi::SecurityObjects {
void AclTemplate::to_json(Poco::JSON::Object &Obj) const {
field_to_json(Obj,"Read",Read_);
@@ -26,12 +26,12 @@ namespace uCentral::SecurityObjects {
}
ResourceAccessType ResourceAccessTypeFromString(const std::string &s) {
if(s=="READ") return READ;
if(s=="MODIFY") return MODIFY;
if(s=="DELETE") return DELETE;
if(s=="CREATE") return CREATE;
if(s=="TEST") return TEST;
if(s=="MOVE") return MOVE;
if(!Poco::icompare(s,"READ")) return READ;
if(!Poco::icompare(s,"MODIFY")) return MODIFY;
if(!Poco::icompare(s,"DELETE")) return DELETE;
if(!Poco::icompare(s,"CREATE")) return CREATE;
if(!Poco::icompare(s,"TEST")) return TEST;
if(!Poco::icompare(s,"MOVE")) return MOVE;
return NONE;
}
@@ -48,17 +48,17 @@ namespace uCentral::SecurityObjects {
}
USER_ROLE UserTypeFromString(const std::string &U) {
if (U=="root")
if (!Poco::icompare(U,"root"))
return ROOT;
else if (U=="admin")
else if (!Poco::icompare(U,"admin"))
return ADMIN;
else if (U=="subscriber")
else if (!Poco::icompare(U,"subscriber"))
return SUBSCRIBER;
else if (U=="csr")
else if (!Poco::icompare(U,"csr"))
return CSR;
else if (U=="system")
else if (!Poco::icompare(U, "system"))
return SYSTEM;
else if (U=="special")
else if (!Poco::icompare(U, "special"))
return SPECIAL;
return UNKNOWN;
}
@@ -71,6 +71,7 @@ namespace uCentral::SecurityObjects {
case CSR: return "csr";
case SYSTEM: return "system";
case SPECIAL: return "special";
case ADMIN: return "admin";
default: return "unknown";
}
}
@@ -302,6 +303,20 @@ namespace uCentral::SecurityObjects {
return false;
}
bool append_from_json(Poco::JSON::Object::Ptr Obj, const UserInfo &UInfo, NoteInfoVec & Notes) {
try {
SecurityObjects::NoteInfoVec NIV;
NIV = RESTAPI_utils::to_object_array<SecurityObjects::NoteInfo>(Obj->get("notes").toString());
for(auto const &i:NIV) {
SecurityObjects::NoteInfo ii{.created=(uint64_t)std::time(nullptr), .createdBy=UInfo.email, .note=i.note};
Notes.push_back(ii);
}
} catch(...) {
}
return false;
}
void ProfileAction::to_json(Poco::JSON::Object &Obj) const {
field_to_json(Obj,"resource", resource);
field_to_json<ResourceAccessType>(Obj,"access", access, ResourceAccessTypeToString);

View File

@@ -10,9 +10,9 @@
#define UCENTRAL_RESTAPI_SECURITYOBJECTS_H
#include "Poco/JSON/Object.h"
#include "uCentralTypes.h"
#include "OpenWifiTypes.h"
namespace uCentral::SecurityObjects {
namespace OpenWifi::SecurityObjects {
struct AclTemplate {
bool Read_ = true;
@@ -41,16 +41,6 @@ namespace uCentral::SecurityObjects {
bool from_json(const Poco::JSON::Object::Ptr &Obj);
};
enum AUTH_ERROR {
SUCCESS,
PASSWORD_CHANGE_REQUIRED,
PASSWORD_DOES_NOT_MATCH,
PASSWORD_ALREADY_USED,
USERNAME_PENDING_VERIFICATION,
PASSWORD_INVALID,
INTERNAL_ERROR
};
enum USER_ROLE {
UNKNOWN, ROOT, ADMIN, SUBSCRIBER, CSR, SYSTEM, SPECIAL
};
@@ -104,6 +94,8 @@ namespace uCentral::SecurityObjects {
};
typedef std::vector<UserInfo> UserInfoVec;
bool append_from_json(Poco::JSON::Object::Ptr Obj, const UserInfo &UInfo, NoteInfoVec & Notes);
struct InternalServiceInfo {
std::string privateURI;
std::string publicURI;
@@ -124,9 +116,9 @@ namespace uCentral::SecurityObjects {
struct SystemEndpoint {
std::string type;
uint64_t id = 0;
std::string vendor;
std::string vendor{"OpenWiFi"};
std::string uri;
std::string authenticationType;
std::string authenticationType{"internal_v1"};
void to_json(Poco::JSON::Object &Obj) const;
bool from_json(const Poco::JSON::Object::Ptr &Obj);
};
@@ -168,7 +160,7 @@ namespace uCentral::SecurityObjects {
typedef std::vector<ProfileAction> ProfileActionVec;
struct SecurityProfile {
uint64_t id;
uint64_t id=0;
std::string name;
std::string description;
ProfileActionVec policy;

Some files were not shown because too many files have changed in this diff Show More