Compare commits

...

168 Commits

Author SHA1 Message Date
TIP Automation User
8e727ac1de Chg: update image tag in helm values to v2.11.0 2023-10-04 14:03:24 +00:00
TIP Automation User
4c8017c170 Chg: update image tag in helm values to v2.11.0-RC2 2023-09-26 14:44:37 +00:00
Stephane Bourque
bc8cf59626 Merge pull request #333 from Telecominfraproject/master
https://telecominfraproject.atlassian.net/browse/WIFI-7831
2023-09-25 21:58:59 -07:00
stephb9959
c48d129f4a https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-25 21:57:28 -07:00
stephb9959
673f506ff0 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-25 21:44:34 -07:00
stephb9959
ac078ec1b8 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-25 21:38:39 -07:00
Stephane Bourque
e623774aa6 Merge pull request #332 from Telecominfraproject/master
https://telecominfraproject.atlassian.net/browse/WIFI-12947
2023-09-25 16:18:05 -07:00
stephb9959
2007998ae1 https://telecominfraproject.atlassian.net/browse/WIFI-12947
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-25 16:16:57 -07:00
stephb9959
8050228b40 https://telecominfraproject.atlassian.net/browse/WIFI-12947
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-25 16:12:41 -07:00
stephb9959
a73ea9b260 https://telecominfraproject.atlassian.net/browse/WIFI-12947
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-25 16:12:00 -07:00
stephb9959
334728ca4e https://telecominfraproject.atlassian.net/browse/WIFI-12947
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-25 16:07:30 -07:00
stephb9959
33e010bf78 https://telecominfraproject.atlassian.net/browse/WIFI-12947
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-25 16:02:51 -07:00
stephb9959
657c96f8cd https://telecominfraproject.atlassian.net/browse/WIFI-12947
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-25 15:55:47 -07:00
Stephane Bourque
4c91742d8f Merge pull request #331 from Telecominfraproject/master
Merge master to Release
2023-09-24 11:55:14 -07:00
stephb9959
5cd421a4b9 https://telecominfraproject.atlassian.net/browse/WIFI-12954
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-24 10:52:22 -07:00
stephb9959
b5a0c96927 https://telecominfraproject.atlassian.net/browse/WIFI-12954
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-23 15:23:55 -07:00
stephb9959
e5a22a1af2 https://telecominfraproject.atlassian.net/browse/WIFI-12954
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-22 22:27:21 -07:00
stephb9959
4f1fa18cf6 https://telecominfraproject.atlassian.net/browse/WIFI-12954
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-22 13:44:33 -07:00
stephb9959
bc04d0b774 https://telecominfraproject.atlassian.net/browse/WIFI-12954
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-22 13:10:44 -07:00
stephb9959
598a15100d https://telecominfraproject.atlassian.net/browse/WIFI-12954
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-22 13:04:28 -07:00
stephb9959
3227883074 https://telecominfraproject.atlassian.net/browse/WIFI-12954
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-22 12:54:03 -07:00
stephb9959
4a4c771e52 https://telecominfraproject.atlassian.net/browse/WIFI-12954
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-22 12:33:45 -07:00
stephb9959
2f45a6955d https://telecominfraproject.atlassian.net/browse/WIFI-12954
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-22 12:23:45 -07:00
stephb9959
78015d2ecf https://telecominfraproject.atlassian.net/browse/WIFI-12954
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-22 12:16:59 -07:00
stephb9959
9235495e2c https://telecominfraproject.atlassian.net/browse/WIFI-12945
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-19 21:54:42 -07:00
stephb9959
84e4a201e7 https://telecominfraproject.atlassian.net/browse/WIFI-12945
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-18 09:39:23 -07:00
stephb9959
89522132d0 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 15:16:05 -07:00
stephb9959
780cf3e18f https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 15:05:39 -07:00
stephb9959
6ba3c6d713 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 14:58:11 -07:00
stephb9959
eae89452ff https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 14:46:33 -07:00
stephb9959
33884c8b81 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 14:19:54 -07:00
stephb9959
1b33470d69 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 12:07:51 -07:00
stephb9959
625ace2d50 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 10:26:08 -07:00
stephb9959
09b50cde9b https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 10:20:01 -07:00
stephb9959
1c6022c227 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 10:09:19 -07:00
stephb9959
960640cc05 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 10:08:18 -07:00
stephb9959
ebc4fd6f4c https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 10:05:46 -07:00
stephb9959
2542635aa8 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 09:54:21 -07:00
stephb9959
8150daa6d5 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 09:44:08 -07:00
stephb9959
06af6eb5a1 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 09:27:15 -07:00
stephb9959
fcc765c981 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 09:22:22 -07:00
stephb9959
98db7f19d1 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-15 09:15:02 -07:00
stephb9959
904d034d5f https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 15:50:33 -07:00
stephb9959
52fa1ac922 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 15:48:31 -07:00
stephb9959
7790cde143 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 15:30:13 -07:00
stephb9959
1d294c86a2 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 15:28:08 -07:00
stephb9959
45ba1d94ba https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 15:18:23 -07:00
stephb9959
bdcb1aebce https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 15:14:06 -07:00
stephb9959
cb276b3246 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 15:12:39 -07:00
stephb9959
eeac5844f6 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 14:58:11 -07:00
stephb9959
396462c5a2 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 14:55:02 -07:00
stephb9959
b83b15d2a3 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 14:52:13 -07:00
stephb9959
1a6fb2a277 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 14:29:45 -07:00
stephb9959
c2012bcc00 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 14:27:41 -07:00
stephb9959
15f938fc07 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 07:37:11 -07:00
stephb9959
8718bb882d https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 07:32:32 -07:00
stephb9959
bc38160b71 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 07:29:22 -07:00
stephb9959
99c037b1ed https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 07:09:50 -07:00
stephb9959
c66ab909d4 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-14 07:00:14 -07:00
stephb9959
cf811a5767 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-13 23:59:30 -07:00
stephb9959
d7b5d7fda3 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-13 23:48:40 -07:00
stephb9959
797165f10d https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-13 23:43:38 -07:00
stephb9959
32f094562a https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-13 13:15:23 -07:00
stephb9959
bc8f714362 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-13 12:19:24 -07:00
stephb9959
ec0f2ae59e https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-13 10:02:19 -07:00
stephb9959
8f34181ae5 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-13 09:18:40 -07:00
stephb9959
92f14f517a https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-13 08:33:40 -07:00
stephb9959
caf1ec9381 https://telecominfraproject.atlassian.net/browse/WIFI-7831
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-13 08:10:19 -07:00
stephb9959
6b49c684c5 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-09-01 09:25:51 -07:00
TIP Automation User
5c85694200 Chg: update image tag in helm values to v2.11.0-RC1 2023-09-01 16:08:44 +00:00
stephb9959
5425366f0c https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 15:26:20 -07:00
stephb9959
6ea604c64f https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 15:24:07 -07:00
stephb9959
816885273d https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 13:12:08 -07:00
stephb9959
da6a49cda6 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 12:58:11 -07:00
stephb9959
0b02e0d8fd https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 12:52:34 -07:00
stephb9959
f03a5ca216 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 12:34:26 -07:00
stephb9959
cc1aac5520 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 11:56:52 -07:00
stephb9959
fb265ff767 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 10:42:51 -07:00
stephb9959
746458d6ac https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 09:54:27 -07:00
stephb9959
63d2bcde53 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 09:52:16 -07:00
stephb9959
68827af75b https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 09:33:11 -07:00
stephb9959
ba525dfc19 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 09:28:06 -07:00
stephb9959
174c0fa430 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 09:18:14 -07:00
stephb9959
e50392d837 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 09:17:20 -07:00
stephb9959
d28d70e5b9 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 09:09:16 -07:00
stephb9959
240950787c https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 09:07:47 -07:00
stephb9959
e6da06e22c https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 09:01:25 -07:00
stephb9959
7edbdb719c https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 08:31:42 -07:00
stephb9959
992616c01b https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 08:07:15 -07:00
stephb9959
a17529d0c4 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-31 07:49:04 -07:00
stephb9959
c1d4082401 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-30 23:06:40 -07:00
stephb9959
fabea09f3d https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-30 22:53:02 -07:00
stephb9959
bb577a3fc1 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-30 22:38:29 -07:00
stephb9959
1d5007ab6a https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-30 22:33:22 -07:00
stephb9959
624f995966 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-30 08:13:01 -07:00
stephb9959
e78ed60974 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 16:23:04 -07:00
stephb9959
df769135b6 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 16:04:12 -07:00
stephb9959
8a77ba8c76 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 15:59:23 -07:00
stephb9959
d0931d95d5 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 15:50:39 -07:00
stephb9959
a4c6d26a6c https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 14:27:00 -07:00
stephb9959
6b0594a393 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 14:19:40 -07:00
stephb9959
9844b8a6b8 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 14:09:06 -07:00
stephb9959
3d1887c5a8 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 13:58:40 -07:00
stephb9959
ed845b6a0d https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 13:53:57 -07:00
stephb9959
7d58000caa https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 13:45:22 -07:00
stephb9959
0f3c847c60 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 13:28:47 -07:00
stephb9959
d5bc014618 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 13:24:12 -07:00
stephb9959
104da1278b https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-29 13:23:07 -07:00
stephb9959
6933602706 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 21:37:09 -07:00
stephb9959
b7df12e7b0 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 20:28:28 -07:00
stephb9959
029bc8e3df https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 16:25:32 -07:00
stephb9959
ed66a2cc2b https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 16:16:03 -07:00
stephb9959
25383df599 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 13:53:18 -07:00
stephb9959
25fb62403d https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 13:41:53 -07:00
stephb9959
c928c1492b https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 13:31:55 -07:00
stephb9959
958b07b0df https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 12:56:02 -07:00
stephb9959
642c2bb914 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 12:46:02 -07:00
stephb9959
0486907e33 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 12:44:08 -07:00
stephb9959
6b92d0619c https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 12:34:26 -07:00
stephb9959
7093999c19 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 11:42:47 -07:00
stephb9959
ef2e4069d0 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-28 07:57:10 -07:00
stephb9959
3fdb6a6177 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-21 12:11:02 -07:00
stephb9959
3b9d3ee422 https://telecominfraproject.atlassian.net/browse/WIFI-12871
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-10 10:26:56 -07:00
stephb9959
a4ea9744cc https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-09 23:19:49 -07:00
stephb9959
1aa3af7cec https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-03 23:22:39 -07:00
stephb9959
10cced8d5e https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-03 22:26:18 -07:00
stephb9959
de85d4e517 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-03 11:08:47 -07:00
stephb9959
a06a6a2b27 https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-03 10:34:40 -07:00
stephb9959
1a4af66a8a https://telecominfraproject.atlassian.net/browse/WIFI-12868
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-08-03 10:12:45 -07:00
stephb9959
6db4feeedd https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 15:25:40 -07:00
stephb9959
dfdfd06ab1 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 15:18:10 -07:00
stephb9959
842995f7f6 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 14:57:11 -07:00
stephb9959
ba01cfa02b https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 14:14:53 -07:00
stephb9959
329dfbbcde https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 12:24:06 -07:00
stephb9959
ac1b5df59a https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 12:11:48 -07:00
stephb9959
8f2dd3ec6e https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 11:57:46 -07:00
stephb9959
8edf3af709 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 11:54:02 -07:00
stephb9959
4392b37c0b https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 11:49:01 -07:00
stephb9959
286607fc5d https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 10:08:47 -07:00
stephb9959
4f15fb055d https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 10:04:45 -07:00
stephb9959
3864082269 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 10:02:04 -07:00
stephb9959
076ad66754 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:57:15 -07:00
stephb9959
cd5d8365fb https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:52:47 -07:00
stephb9959
1b4ba18d70 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:45:43 -07:00
stephb9959
80502c7414 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:42:08 -07:00
stephb9959
dea0e371fd https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:38:26 -07:00
stephb9959
df9c11b640 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:32:22 -07:00
stephb9959
fef2e00fef https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:28:28 -07:00
stephb9959
9f27ed2d64 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:26:17 -07:00
stephb9959
a9ebb18609 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:19:16 -07:00
stephb9959
7b2d557d90 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:15:31 -07:00
stephb9959
fe50bdc8c5 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:12:42 -07:00
stephb9959
3ae4676df2 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:09:25 -07:00
stephb9959
ff78235bf7 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 09:04:30 -07:00
stephb9959
68d11560ee https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 08:59:22 -07:00
stephb9959
b468952e04 https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 08:38:41 -07:00
stephb9959
aec6e6f71d https://telecominfraproject.atlassian.net/browse/WIFI-12762
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-18 08:32:15 -07:00
stephb9959
1020473e54 https://telecominfraproject.atlassian.net/browse/WIFI-12691
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-13 06:57:43 -07:00
stephb9959
3433a13b62 https://telecominfraproject.atlassian.net/browse/WIFI-12691
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-12 14:51:50 -07:00
stephb9959
b9ecb8632a https://telecominfraproject.atlassian.net/browse/WIFI-12691
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-12 13:25:41 -07:00
stephb9959
be97cca949 https://telecominfraproject.atlassian.net/browse/WIFI-12691
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-12 09:11:47 -07:00
stephb9959
0c46a0a957 https://telecominfraproject.atlassian.net/browse/WIFI-12691
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-12 09:07:18 -07:00
stephb9959
3e0d091f4d https://telecominfraproject.atlassian.net/browse/WIFI-12691
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-12 08:45:27 -07:00
stephb9959
1387c67219 https://telecominfraproject.atlassian.net/browse/WIFI-12691
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-12 08:31:03 -07:00
stephb9959
fd02712159 https://telecominfraproject.atlassian.net/browse/WIFI-12691
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-12 07:31:33 -07:00
stephb9959
c75689800e https://telecominfraproject.atlassian.net/browse/WIFI-12691
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-11 23:15:00 -07:00
stephb9959
b094709d4c https://telecominfraproject.atlassian.net/browse/WIFI-12738
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-10 13:17:58 -07:00
stephb9959
f1a6f42b8a https://telecominfraproject.atlassian.net/browse/WIFI-12738
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2023-07-10 11:06:27 -07:00
63 changed files with 2237 additions and 506 deletions

2
.idea/ucentral.iml generated
View File

@@ -2,7 +2,7 @@
<module classpath="CMake" type="CPP_MODULE" version="4">
<component name="FacetManager">
<facet type="Python" name="Python facet">
<configuration sdkName="Python 3.9 (venv)" />
<configuration sdkName="Python 3.9 (wlan-cloud-ucentralgw)" />
</facet>
</component>
</module>

View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.13)
project(owgw VERSION 2.10.0)
project(owgw VERSION 2.11.0)
set(CMAKE_CXX_STANDARD 17)
@@ -49,7 +49,7 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
string(REGEX REPLACE "\n$" "" GIT_HASH "${GIT_HASH}")
endif()
add_definitions(-DTIP_GATEWAY_SERVICE="1" -DPOCO_LOG_DEBUG="1")
add_definitions(-DTIP_GATEWAY_SERVICE="1" -DPOCO_LOG_DEBUG="1" -DBOOST_NO_CXX98_FUNCTION_BASE=1)
find_package(OpenSSL REQUIRED)
find_package(ZLIB REQUIRED)
@@ -211,7 +211,7 @@ add_executable( owgw
src/RegulatoryInfo.cpp src/RegulatoryInfo.h
src/RADIUSSessionTracker.cpp src/RADIUSSessionTracker.h
src/libs/Scheduler.h src/libs/InterruptableSleep.h src/libs/ctpl_stl.h src/libs/Cron.h
src/GenericScheduler.cpp src/GenericScheduler.h src/framework/default_device_types.h src/AP_WS_Process_rebootLog.cpp src/AP_WS_ConfigAutoUpgrader.cpp src/AP_WS_ConfigAutoUpgrader.h)
src/GenericScheduler.cpp src/GenericScheduler.h src/framework/default_device_types.h src/AP_WS_Process_rebootLog.cpp src/AP_WS_ConfigAutoUpgrader.cpp src/AP_WS_ConfigAutoUpgrader.h src/RESTAPI/RESTAPI_default_firmwares.cpp src/RESTAPI/RESTAPI_default_firmwares.h src/RESTAPI/RESTAPI_default_firmware.cpp src/RESTAPI/RESTAPI_default_firmware.h src/storage/storage_def_firmware.cpp src/firmware_revision_cache.h src/sdks/sdk_fms.h)
if(NOT SMALL_BUILD)

View File

@@ -2,6 +2,8 @@ ARG DEBIAN_VERSION=11.5-slim
ARG POCO_VERSION=poco-tip-v2
ARG CPPKAFKA_VERSION=tip-v1
ARG VALIJASON_VERSION=tip-v1
ARG APP_NAME=owgw
ARG APP_HOME_DIR=/openwifi
FROM debian:$DEBIAN_VERSION AS build-base
@@ -53,12 +55,14 @@ RUN cmake ..
RUN cmake --build . --config Release -j8
RUN cmake --build . --target install
FROM build-base AS owgw-build
FROM build-base AS app-build
ADD CMakeLists.txt build /owgw/
ADD cmake /owgw/cmake
ADD src /owgw/src
ADD .git /owgw/.git
ARG APP_NAME
ADD CMakeLists.txt build /${APP_NAME}/
ADD cmake /${APP_NAME}/cmake
ADD src /${APP_NAME}/src
ADD .git /${APP_NAME}/.git
COPY --from=poco-build /usr/local/include /usr/local/include
COPY --from=poco-build /usr/local/lib /usr/local/lib
@@ -66,23 +70,28 @@ COPY --from=cppkafka-build /usr/local/include /usr/local/include
COPY --from=cppkafka-build /usr/local/lib /usr/local/lib
COPY --from=valijson-build /usr/local/include /usr/local/include
WORKDIR /owgw
WORKDIR /${APP_NAME}
RUN mkdir cmake-build
WORKDIR /owgw/cmake-build
WORKDIR /${APP_NAME}/cmake-build
RUN cmake ..
RUN cmake --build . --config Release -j8
FROM debian:$DEBIAN_VERSION
ENV OWGW_USER=owgw \
OWGW_ROOT=/owgw-data \
OWGW_CONFIG=/owgw-data
ARG APP_NAME
ARG APP_HOME_DIR
RUN useradd "$OWGW_USER"
ENV APP_NAME=$APP_NAME \
APP_USER=$APP_NAME \
APP_ROOT=/$APP_NAME-data \
APP_CONFIG=/$APP_NAME-data \
APP_HOME_DIR=$APP_HOME_DIR
RUN mkdir /openwifi
RUN mkdir -p "$OWGW_ROOT" "$OWGW_CONFIG" && \
chown "$OWGW_USER": "$OWGW_ROOT" "$OWGW_CONFIG"
RUN useradd $APP_USER
RUN mkdir $APP_HOME_DIR
RUN mkdir -p $APP_ROOT $APP_CONFIG && \
chown $APP_USER: $APP_ROOT $APP_CONFIG
RUN apt-get update && apt-get install --no-install-recommends -y \
librdkafka++1 gosu gettext ca-certificates bash jq curl wget \
@@ -91,14 +100,14 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
COPY readiness_check /readiness_check
COPY test_scripts/curl/cli /cli
COPY owgw.properties.tmpl /
COPY $APP_NAME.properties.tmpl /
COPY docker-entrypoint.sh /
COPY wait-for-postgres.sh /
COPY rtty_ui /dist/rtty_ui
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.crt
COPY --from=owgw-build /owgw/cmake-build/owgw /openwifi/owgw
COPY --from=app-build /$APP_NAME/cmake-build/$APP_NAME $APP_HOME_DIR/$APP_NAME
COPY --from=cppkafka-build /cppkafka/cmake-build/src/lib /usr/local/lib/
COPY --from=poco-build /poco/cmake-build/lib /usr/local/lib/
@@ -107,4 +116,4 @@ RUN ldconfig
EXPOSE 15002 16002 16003 17002 16102
ENTRYPOINT ["/docker-entrypoint.sh"]
CMD ["/openwifi/owgw"]
CMD ${APP_HOME_DIR}/${APP_NAME}

2
build
View File

@@ -1 +1 @@
64
29

View File

@@ -6,35 +6,35 @@ if [ "$SELFSIGNED_CERTS" = 'true' ]; then
fi
if [[ "$TEMPLATE_CONFIG" = 'true' ]]; 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_ROOTCA=${WEBSOCKET_HOST_ROOTCA:-"\${APP_ROOT}/certs/root.pem"} \
WEBSOCKET_HOST_ISSUER=${WEBSOCKET_HOST_ISSUER:-"\${APP_ROOT}/certs/issuer.pem"} \
WEBSOCKET_HOST_CERT=${WEBSOCKET_HOST_CERT:-"\${APP_ROOT}/certs/websocket-cert.pem"} \
WEBSOCKET_HOST_KEY=${WEBSOCKET_HOST_KEY:-"\${APP_ROOT}/certs/websocket-key.pem"} \
WEBSOCKET_HOST_CLIENTCAS=${WEBSOCKET_HOST_CLIENTCAS:-"\${APP_ROOT}/certs/clientcas.pem"} \
WEBSOCKET_HOST_CAS=${WEBSOCKET_HOST_CAS:-"\${APP_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_ROOTCA=${RESTAPI_HOST_ROOTCA:-"\${APP_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_CERT=${RESTAPI_HOST_CERT:-"\${APP_ROOT}/certs/restapi-cert.pem"} \
RESTAPI_HOST_KEY=${RESTAPI_HOST_KEY:-"\${APP_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_ROOTCA=${INTERNAL_RESTAPI_HOST_ROOTCA:-"\${APP_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_CERT=${INTERNAL_RESTAPI_HOST_CERT:-"\${APP_ROOT}/certs/restapi-cert.pem"} \
INTERNAL_RESTAPI_HOST_KEY=${INTERNAL_RESTAPI_HOST_KEY:-"\${APP_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_ROOTCA=${FILEUPLOADER_HOST_ROOTCA:-"\${APP_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_CERT=${FILEUPLOADER_HOST_CERT:-"\${APP_ROOT}/certs/restapi-cert.pem"} \
FILEUPLOADER_HOST_KEY=${FILEUPLOADER_HOST_KEY:-"\${APP_ROOT}/certs/restapi-key.pem"} \
FILEUPLOADER_HOST_KEY_PASSWORD=${FILEUPLOADER_HOST_KEY_PASSWORD:-"mypassword"} \
FILEUPLOADER_PATH=${FILEUPLOADER_PATH:-"\$OWGW_ROOT/uploads"} \
FILEUPLOADER_PATH=${FILEUPLOADER_PATH:-"\${APP_ROOT}/uploads"} \
FILEUPLOADER_URI=${FILEUPLOADER_URI:-"https://localhost:16003"} \
SERVICE_KEY=${SERVICE_KEY:-"\$OWGW_ROOT/certs/restapi-key.pem"} \
SERVICE_KEY=${SERVICE_KEY:-"\${APP_ROOT}/certs/restapi-key.pem"} \
SERVICE_KEY_PASSWORD=${SERVICE_KEY_PASSWORD:-"mypassword"} \
SYSTEM_DATA=${SYSTEM_DATA:-"\$OWGW_ROOT/data"} \
SYSTEM_DATA=${SYSTEM_DATA:-"\${APP_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"} \
@@ -51,7 +51,7 @@ if [[ "$TEMPLATE_CONFIG" = 'true' ]]; then
RTTY_TOKEN=${RTTY_TOKEN:-""} \
RTTY_TIMEOUT=${RTTY_TIMEOUT:-"60"} \
RTTY_VIEWPORT=${RTTY_VIEWPORT:-"5913"} \
RTTY_ASSETS=${RTTY_ASSETS:-"\$OWGW_ROOT/rtty_ui"} \
RTTY_ASSETS=${RTTY_ASSETS:-"\${APP_ROOT}/rtty_ui"} \
RADIUS_PROXY_ENABLE=${RADIUS_PROXY_ENABLE:-"false"} \
RADIUS_PROXY_ACCOUNTING_PORT=${RADIUS_PROXY_ACCOUNTING_PORT:-"1813"} \
RADIUS_PROXY_AUTHENTICATION_PORT=${RADIUS_PROXY_AUTHENTICATION_PORT:-"1812"} \
@@ -64,41 +64,41 @@ if [[ "$TEMPLATE_CONFIG" = 'true' ]]; then
KAFKA_SSL_KEY_PASSWORD=${KAFKA_SSL_KEY_PASSWORD:-""} \
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_USERNAME=${STORAGE_TYPE_POSTGRESQL_USERNAME:-"${APP_USER}"} \
STORAGE_TYPE_POSTGRESQL_PASSWORD=${STORAGE_TYPE_POSTGRESQL_PASSWORD:-"${APP_USER}"} \
STORAGE_TYPE_POSTGRESQL_DATABASE=${STORAGE_TYPE_POSTGRESQL_DATABASE:-"${APP_NAME}"} \
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_USERNAME=${STORAGE_TYPE_MYSQL_USERNAME:-"${APP_USER}"} \
STORAGE_TYPE_MYSQL_PASSWORD=${STORAGE_TYPE_MYSQL_PASSWORD:-"${APP_USER}"} \
STORAGE_TYPE_MYSQL_DATABASE=${STORAGE_TYPE_MYSQL_DATABASE:-"${APP_NAME}"} \
STORAGE_TYPE_MYSQL_PORT=${STORAGE_TYPE_MYSQL_PORT:-"3306"} \
CERTIFICATES_ALLOWMISMATCH=${CERTIFICATES_ALLOWMISMATCH:-"false"} \
IPINFO_DEFAULT_COUNTRY=${IPINFO_DEFAULT_COUNTRY:-"US"} \
DEVICE_SESSION_TIMEOUT=${DEVICE_SESSION_TIMEOUT:-"600"} \
envsubst < /owgw.properties.tmpl > $OWGW_CONFIG/owgw.properties
envsubst < /"${APP_NAME}".properties.tmpl > "${APP_CONFIG}"/"${APP_NAME}".properties
fi
# Check if rtty_ui directory exists
export RTTY_ASSETS=$(grep 'rtty.assets' $OWGW_CONFIG/owgw.properties | awk -F '=' '{print $2}' | xargs | envsubst)
export RTTY_ASSETS=$(grep 'rtty.assets' "${APP_CONFIG}"/"${APP_NAME}".properties | awk -F '=' '{print $2}' | xargs | envsubst)
if [ -z "$RTTY_ASSETS" ]; then
export RTTY_ASSETS="$OWGW_ROOT/rtty_ui"
export RTTY_ASSETS="${APP_ROOT}/rtty_ui"
fi
if [[ ! -d "$(dirname $RTTY_ASSETS)" ]]; then
mkdir -p $(dirname $RTTY_ASSETS)
mkdir -p "$(dirname $RTTY_ASSETS)"
fi
if [[ ! -d "$RTTY_ASSETS" ]]; then
cp -r /dist/rtty_ui $RTTY_ASSETS
fi
if [ "$1" = '/openwifi/owgw' -a "$(id -u)" = '0' ]; then
if [ "$1" = "${APP_HOME_DIR}/${APP_NAME}" -a "$(id -u)" = '0' ]; then
if [ "$RUN_CHOWN" = 'true' ]; then
chown -R "$OWGW_USER": "$OWGW_ROOT" "$OWGW_CONFIG"
chown -R "$APP_USER": "${APP_ROOT}" "$APP_CONFIG"
fi
exec gosu "$OWGW_USER" "$@"
exec gosu "$APP_USER" "$@"
fi
exec "$@"

View File

@@ -9,7 +9,7 @@ fullnameOverride: ""
images:
owgw:
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owgw
tag: master
tag: v2.11.0
pullPolicy: Always
# regcred:
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io

View File

@@ -2,7 +2,7 @@ openapi: 3.0.1
info:
title: uCentral gateway API
description: A process to manage configuration for devices.
version: 2.10.0
version: 2.11.0
license:
name: BSD3
url: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
@@ -553,6 +553,35 @@ components:
items:
$ref : '#/components/schemas/DefaultConfiguration'
DefaultFirmware:
type: object
properties:
deviceType:
type: string
description:
type: string
uri:
type: string
revision:
type: string
imageCreationDate:
type: integer
format: int64
created:
type: integer
format: int64
lastModified:
type: integer
format: int64
DefaultFirmwareList:
type: object
properties:
firmwares:
type: array
items:
$ref: '#/components/schemas/DefaultFirmware'
UpgradeRequest:
type: object
properties:
@@ -942,12 +971,6 @@ components:
- $ref: '#/components/schemas/StringList'
- $ref: '#/components/schemas/TagValuePairList'
SystemCommandResults:
type: object
oneOf:
- $ref: '#/components/schemas/StringList'
- $ref: '#/components/schemas/TagValuePairList'
NoteInfo:
type: object
properties:
@@ -987,6 +1010,33 @@ components:
type: integer
format: int64
SystemResources:
type: object
properties:
numberOfFileDescriptors:
type: integer
format: int64
currRealMem:
type: integer
format: int64
peakRealMem:
type: integer
format: int64
currVirtMem:
type: integer
format: int64
peakVirtMem:
type: integer
format: int64
SystemCommandResults:
type: object
oneOf:
- $ref: '#/components/schemas/SystemResources'
- $ref: '#/components/schemas/SystemInfoResults'
- $ref: '#/components/schemas/StringList'
- $ref: '#/components/schemas/TagValuePairList'
SystemCommandSetLogLevel:
type: object
properties:
@@ -1289,6 +1339,29 @@ components:
$ref: '#/components/schemas/RadiusProxyServerConfig'
coaConfig:
$ref: '#/components/schemas/RadiusProxyServerConfig'
radsecPoolType:
type: string
enum:
- generic
- orion
- globalreach
default:
generic
poolProxyIp:
type: string
description: This is the fake IP for the entire pool
example:
- These addresses must match the addresses in the AP configuration and must start with 0.0
- 0.0.0.1
- 0.0.1.1
radsecPoolKeepAlive:
type: integer
description: The keep alive value in seconds. Usually 30s or less.
format: int64
default: 25
enabled:
type: boolean
default: true
RadiusProxyPoolList:
type: object
@@ -1358,6 +1431,9 @@ components:
type: string
chargeableUserIdentity:
type: string
userName:
type: string
paths:
/devices:
@@ -1771,6 +1847,123 @@ paths:
404:
$ref: '#/components/responses/NotFound'
/default_firmwares:
get:
tags:
- Firmware
summary: Retrieve the lists of all default firmwares.
description: Retrieve the lists of all default firmwares.
operationId: getDefaultFirmwares
responses:
200:
description: List of default firmwares
content:
application/json:
schema:
$ref: '#/components/schemas/DefaultFirmwareList'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
/default_firmware/{deviceType}:
get:
tags:
- Firmware
summary: Retrieve a default firmware.
description: Retrieve a default firmware.
operationId: getDefaultFirmware
parameters:
- in: path
name: deviceType
schema:
type: string
required: true
responses:
200:
description: Default firmware included
content:
application/json:
schema:
$ref: '#/components/schemas/DefaultFirmware'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
post:
tags:
- Firmware
summary: Create a default firmware.
description: Create a default firmware.
operationId: createDefaultFirmware
parameters:
- in: path
name: deviceType
schema:
type: string
required: true
requestBody:
description: Information used to create the new firmware entry
content:
application/json:
schema:
$ref: '#/components/schemas/DefaultFirmware'
responses:
200:
$ref: '#/components/responses/Success'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
delete:
tags:
- Firmware
summary: Delete a default default firmware
description: Delete a default default firmware
operationId: deleteDefaultFirmware
parameters:
- in: path
name: deviceType
schema:
type: string
required: true
responses:
204:
$ref: '#/components/responses/Success'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
put:
tags:
- Firmware
summary: Update a default firmware
description: Update a default firmware
operationId: updateDefaultFirmware
parameters:
- in: path
name: deviceType
schema:
type: string
required: true
requestBody:
description: Firmware details
content:
application/json:
schema:
$ref: '#/components/schemas/DefaultFirmware'
responses:
200:
$ref: '#/components/responses/Success'
403:
$ref: '#/components/responses/Unauthorized'
404:
$ref: '#/components/responses/NotFound'
/device/{serialNumber}:
get:
tags:
@@ -3086,6 +3279,7 @@ paths:
type: string
enum:
- coadm
- disconnectUser
requestBody:
description: operationParameters
content:
@@ -3199,16 +3393,12 @@ paths:
type: string
enum:
- info
- extraConfiguration
- resources
required: true
responses:
200:
description: Successful command execution
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/SystemInfoResults'
$ref: '#/components/schemas/SystemCommandResults'
403:
$ref: '#/components/responses/Unauthorized'
404:

View File

@@ -73,6 +73,7 @@ namespace OpenWifi {
*this, &AP_WS_Connection::OnSocketError));
Registered_ = true;
Valid_ = true;
uuid_ = MicroServiceRandom(std::numeric_limits<std::uint64_t>::max()-1);
}
bool AP_WS_Connection::ValidatedDevice() {
@@ -222,17 +223,15 @@ namespace OpenWifi {
return false;
}
static void NotifyKafkaDisconnect(const std::string &SerialNumber) {
static void NotifyKafkaDisconnect(const std::string &SerialNumber, std::uint64_t uuid) {
try {
Poco::JSON::Object Disconnect;
Poco::JSON::Object Details;
Details.set(uCentralProtocol::SERIALNUMBER, SerialNumber);
Details.set(uCentralProtocol::TIMESTAMP, Utils::Now());
Details.set(uCentralProtocol::UUID,uuid);
Disconnect.set(uCentralProtocol::DISCONNECTION, Details);
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
Stringify.condense(Disconnect, OS);
KafkaManager()->PostMessage(KafkaTopics::CONNECTION, SerialNumber, std::make_shared<std::string>(OS.str()));
KafkaManager()->PostMessage(KafkaTopics::CONNECTION, SerialNumber, Disconnect);
} catch (...) {
}
}
@@ -242,9 +241,9 @@ namespace OpenWifi {
EndConnection();
}
void DeviceDisconnectionCleanup(const std::string &SerialNumber) {
void DeviceDisconnectionCleanup(const std::string &SerialNumber, std::uint64_t uuid) {
if (KafkaManager()->Enabled()) {
NotifyKafkaDisconnect(SerialNumber);
NotifyKafkaDisconnect(SerialNumber, uuid);
}
RADIUSSessionTracker()->DeviceDisconnect(SerialNumber);
}
@@ -272,7 +271,7 @@ namespace OpenWifi {
WS_->close();
if(!SerialNumber_.empty()) {
std::thread Cleanup(DeviceDisconnectionCleanup,SerialNumber_);
std::thread Cleanup(DeviceDisconnectionCleanup,SerialNumber_, uuid_);
Cleanup.detach();
}
@@ -720,12 +719,11 @@ namespace OpenWifi {
PingDetails.set(uCentralProtocol::COMPATIBLE, Compatible_);
PingDetails.set(uCentralProtocol::CONNECTIONIP, CId_);
PingDetails.set(uCentralProtocol::TIMESTAMP, Utils::Now());
PingDetails.set(uCentralProtocol::UUID, uuid_);
PingDetails.set("locale", State_.locale);
PingObject.set(uCentralProtocol::PING, PingDetails);
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
Stringify.condense(PingObject, OS);
KafkaManager()->PostMessage(KafkaTopics::CONNECTION, SerialNumber_, std::make_shared<std::string>(OS.str()));
poco_trace(Logger_,fmt::format("Sending PING for {}", SerialNumber_));
KafkaManager()->PostMessage(KafkaTopics::CONNECTION, SerialNumber_,PingObject);
}
return;
} break;

View File

@@ -201,6 +201,7 @@ namespace OpenWifi {
void UpdateCounts();
bool hasGPS=false;
std::double_t memory_used_=0.0, cpu_load_ = 0.0, temperature_ = 0.0;
std::uint64_t uuid_=0;
};
} // namespace OpenWifi

View File

@@ -21,11 +21,7 @@ namespace OpenWifi {
if (ParamsObj->has(uCentralProtocol::SERIAL) && ParamsObj->has(uCentralProtocol::DATA)) {
if (KafkaManager()->Enabled()) {
auto Data = ParamsObj->get(uCentralProtocol::DATA);
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
Stringify.condense(ParamsObj, OS);
KafkaManager()->PostMessage(KafkaTopics::ALERTS, SerialNumber_, std::make_shared<std::string>(OS.str()));
KafkaManager()->PostMessage(KafkaTopics::ALERTS, SerialNumber_, *ParamsObj);
}
}
}

View File

@@ -14,6 +14,8 @@
#include "framework/KafkaManager.h"
#include "framework/utils.h"
#include "firmware_revision_cache.h"
#include "UI_GW_WebSocketNotifications.h"
#include <GWKafkaEvents.h>
@@ -30,9 +32,7 @@ namespace OpenWifi {
Event.set("type", "device.firmware_change");
Event.set("timestamp", Utils::Now());
Event.set("payload", EventDetails);
std::ostringstream OS;
Event.stringify(OS);
KafkaManager()->PostMessage(KafkaTopics::DEVICE_EVENT_QUEUE, SerialNumber, std::make_shared<std::string>(OS.str()));
KafkaManager()->PostMessage(KafkaTopics::DEVICE_EVENT_QUEUE, SerialNumber, Event);
}
}
@@ -49,9 +49,7 @@ namespace OpenWifi {
Event.set("type", "device.not_provisioned");
Event.set("timestamp", Utils::Now());
Event.set("payload", EventDetails);
std::ostringstream OS;
Event.stringify(OS);
KafkaManager()->PostMessage(KafkaTopics::DEVICE_EVENT_QUEUE, SerialNumber, std::make_shared<std::string>(OS.str()));
KafkaManager()->PostMessage(KafkaTopics::DEVICE_EVENT_QUEUE, SerialNumber, Event);
}
}
@@ -63,6 +61,11 @@ namespace OpenWifi {
auto Firmware = ParamsObj->get(uCentralProtocol::FIRMWARE).toString();
auto Capabilities = ParamsObj->getObject(uCentralProtocol::CAPABILITIES);
std::string DevicePassword;
if(ParamsObj->has("password")) {
DevicePassword = ParamsObj->get("password").toString();
}
SerialNumber_ = Serial;
SerialNumberInt_ = Utils::SerialNumberToInt(SerialNumber_);
@@ -109,7 +112,55 @@ namespace OpenWifi {
GWObjects::Device DeviceInfo;
auto DeviceExists = StorageService()->GetDevice(SerialNumber_, DeviceInfo);
if (Daemon()->AutoProvisioning() && !DeviceExists) {
StorageService()->CreateDefaultDevice(SerialNumber_, Caps, Firmware, PeerAddress_, State_.VerifiedCertificate==GWObjects::SIMULATED );
// check the firmware version. if this is too old, we cannot let that device connect yet, we must
// force a firmware upgrade
GWObjects::DefaultFirmware MinimumFirmware;
if(FirmwareRevisionCache()->DeviceMustUpgrade(Compatible_, Firmware, MinimumFirmware)) {
/*
{ "jsonrpc" : "2.0" ,
"method" : "upgrade" ,
"params" : {
"serial" : <serial number> ,
"when" : Optional - <UTC time when to upgrade the firmware, 0 mean immediate, this is a suggestion>,
"uri" : <URI to download the firmware>,
"FWsignature" : <string representation of the signature for the FW> (optional)
},
"id" : <some number>
}
*/
Poco::JSON::Object UpgradeCommand, Params;
UpgradeCommand.set(uCentralProtocol::JSONRPC,uCentralProtocol::JSONRPC_VERSION);
UpgradeCommand.set(uCentralProtocol::METHOD,uCentralProtocol::UPGRADE);
Params.set(uCentralProtocol::SERIALNUMBER, SerialNumber_);
Params.set(uCentralProtocol::WHEN, 0);
Params.set(uCentralProtocol::URI, MinimumFirmware.uri);
Params.set(uCentralProtocol::KEEP_REDIRECTOR,1);
UpgradeCommand.set(uCentralProtocol::PARAMS, Params);
UpgradeCommand.set(uCentralProtocol::ID, 1);
std::ostringstream Command;
UpgradeCommand.stringify(Command);
if(Send(Command.str())) {
poco_information(
Logger(),
fmt::format(
"Forcing device {} to upgrade to {} before connection is allowed.",
SerialNumber_, MinimumFirmware.revision));
} else {
poco_error(
Logger(),
fmt::format(
"Could not force device {} to upgrade to {} before connection is allowed.",
SerialNumber_, MinimumFirmware.revision));
}
return;
} else {
StorageService()->CreateDefaultDevice(
SerialNumber_, Caps, Firmware, PeerAddress_,
State_.VerifiedCertificate == GWObjects::SIMULATED);
}
} else if (!Daemon()->AutoProvisioning() && !DeviceExists) {
SendKafkaDeviceNotProvisioned(SerialNumber_, Firmware, Compatible_, CId_);
poco_warning(Logger(),fmt::format("Device {} is a {} from {} and cannot be provisioned.",SerialNumber_,Compatible_, CId_));
@@ -135,6 +186,11 @@ namespace OpenWifi {
}
}
if(DeviceInfo.DevicePassword!=DevicePassword) {
DeviceInfo.DevicePassword = DevicePassword.empty() ? "openwifi" : DevicePassword ;
++Updated;
}
if (DeviceInfo.lastRecordedContact==0) {
DeviceInfo.lastRecordedContact = Utils::Now();
++Updated;
@@ -225,14 +281,11 @@ namespace OpenWifi {
GWWebSocketNotifications::DeviceConnected(Notification);
if (KafkaManager()->Enabled()) {
Poco::JSON::Stringifier Stringify;
ParamsObj->set(uCentralProtocol::CONNECTIONIP, CId_);
ParamsObj->set("locale", State_.locale);
ParamsObj->set(uCentralProtocol::TIMESTAMP, Utils::Now());
std::ostringstream OS;
Stringify.condense(ParamsObj, OS);
KafkaManager()->PostMessage(KafkaTopics::CONNECTION, SerialNumber_, std::make_shared<std::string>(OS.str()));
ParamsObj->set(uCentralProtocol::UUID, uuid_);
KafkaManager()->PostMessage(KafkaTopics::CONNECTION, SerialNumber_, *ParamsObj);
}
} else {
poco_warning(

View File

@@ -24,7 +24,7 @@ namespace OpenWifi {
StorageService()->SetDevicePassword(Serial, Password);
poco_trace(
Logger_,
fmt::format("DEVICEUPDATE({}): Device is updating its login password.", Serial));
fmt::format("DEVICE-UPDATE({}): Device is updating its login password.", Serial));
}
}

View File

@@ -34,11 +34,8 @@ namespace OpenWifi {
FullEvent.set("type", EventType);
FullEvent.set("timestamp", EventTimeStamp);
FullEvent.set("payload", EventPayload);
std::ostringstream OS;
FullEvent.stringify(OS);
KafkaManager()->PostMessage(KafkaTopics::DEVICE_EVENT_QUEUE, SerialNumber_,
std::make_shared<std::string>(OS.str()));
FullEvent);
}
}
} catch (const Poco::Exception &E) {

View File

@@ -60,11 +60,7 @@ namespace OpenWifi {
SetLastHealthCheck(Check);
if (KafkaManager()->Enabled()) {
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
ParamsObj->set("timestamp", Utils::Now());
Stringify.condense(ParamsObj, OS);
KafkaManager()->PostMessage(KafkaTopics::HEALTHCHECK, SerialNumber_, std::make_shared<std::string>(OS.str()));
KafkaManager()->PostMessage(KafkaTopics::HEALTHCHECK, SerialNumber_, *ParamsObj);
}
} else {
poco_warning(Logger_, fmt::format("HEALTHCHECK({}): Missing parameter", CId_));

View File

@@ -56,10 +56,7 @@ namespace OpenWifi {
State_.Associations_5G, State_.Associations_6G);
if (KafkaManager()->Enabled()) {
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
Stringify.condense(ParamsObj, OS);
KafkaManager()->PostMessage(KafkaTopics::STATE, SerialNumber_, std::make_shared<std::string>(OS.str()));
KafkaManager()->PostMessage(KafkaTopics::STATE, SerialNumber_, *ParamsObj);
}
GWWebSocketNotifications::SingleDevice_t N;

View File

@@ -27,7 +27,7 @@ namespace OpenWifi {
std::ostringstream SS;
Payload->stringify(SS);
auto now = Utils::Now();
auto KafkaPayload = std::make_shared<std::string>(SS.str());
auto KafkaPayload = SS.str();
if (ParamsObj->has("adhoc")) {
KafkaManager()->PostMessage(KafkaTopics::DEVICE_TELEMETRY, SerialNumber_,
KafkaPayload);
@@ -39,7 +39,7 @@ namespace OpenWifi {
// std::endl;
TelemetryWebSocketPackets_++;
State_.websocketPackets = TelemetryWebSocketPackets_;
TelemetryStream()->NotifyEndPoint(SerialNumberInt_, *KafkaPayload);
TelemetryStream()->NotifyEndPoint(SerialNumberInt_, KafkaPayload);
} else {
StopWebSocketTelemetry(CommandManager()->Next_RPC_ID());
}

View File

@@ -21,11 +21,7 @@ namespace OpenWifi {
if (ParamsObj->has(uCentralProtocol::SERIAL) && ParamsObj->has(uCentralProtocol::DATA)) {
if (KafkaManager()->Enabled()) {
auto Data = ParamsObj->get(uCentralProtocol::DATA);
Poco::JSON::Stringifier Stringify;
std::ostringstream OS;
Stringify.condense(ParamsObj, OS);
KafkaManager()->PostMessage(KafkaTopics::WIFISCAN, SerialNumber_, std::make_shared<std::string>(OS.str()));
KafkaManager()->PostMessage(KafkaTopics::WIFISCAN, SerialNumber_, *ParamsObj);
}
}
}

View File

@@ -233,10 +233,7 @@ namespace OpenWifi {
FullEvent.set("timestamp", now);
FullEvent.set("payload", KafkaNotification);
std::ostringstream OS;
FullEvent.stringify(OS);
KafkaManager()->PostMessage(KafkaTopics::DEVICE_EVENT_QUEUE, "system",
std::make_shared<std::string>(OS.str()));
KafkaManager()->PostMessage(KafkaTopics::DEVICE_EVENT_QUEUE, "system", FullEvent);
}
void AP_WS_Server::Stop() {

View File

@@ -35,6 +35,7 @@
#include "VenueBroadcaster.h"
#include "AP_WS_ConfigAutoUpgrader.h"
#include "rttys/RTTYS_server.h"
#include "firmware_revision_cache.h"
namespace OpenWifi {
class Daemon *Daemon::instance() {
@@ -42,21 +43,34 @@ namespace OpenWifi {
vDAEMON_PROPERTIES_FILENAME, vDAEMON_ROOT_ENV_VAR, vDAEMON_CONFIG_ENV_VAR,
vDAEMON_APP_NAME, vDAEMON_BUS_TIMER,
SubSystemVec{GenericScheduler(), StorageService(), SerialNumberCache(), ConfigurationValidator(),
UI_WebSocketClientServer(), OUIServer(), FindCountryFromIP(),
CommandManager(), FileUploader(), StorageArchiver(), TelemetryStream(),
RTTYS_server(), RADIUS_proxy_server(), VenueBroadcaster(), ScriptManager(),
SignatureManager(), AP_WS_Server(),
RegulatoryInfo(),
RADIUSSessionTracker(),
AP_WS_ConfigAutoUpgrader()
UI_WebSocketClientServer(), OUIServer(), FindCountryFromIP(),
CommandManager(), FileUploader(), StorageArchiver(), TelemetryStream(),
RTTYS_server(), RADIUS_proxy_server(), VenueBroadcaster(), ScriptManager(),
SignatureManager(), AP_WS_Server(),
RegulatoryInfo(),
RADIUSSessionTracker(),
AP_WS_ConfigAutoUpgrader(),
FirmwareRevisionCache()
});
return &instance;
}
static std::string ALBHealthCallback() {
uint64_t Connections, AverageConnectionTime, NumberOfConnectingDevices;
AP_WS_Server()->AverageDeviceStatistics(Connections, AverageConnectionTime,
NumberOfConnectingDevices);
std::ostringstream os;
os << "Connections: " << Connections << std::endl <<
"ConnectingDevices: " << NumberOfConnectingDevices << std::endl <<
"ConnectionTime: " << AverageConnectionTime << std::endl;
return os.str();
}
void Daemon::PostInitialization([[maybe_unused]] Poco::Util::Application &self) {
AutoProvisioning_ = config().getBool("openwifi.autoprovisioning", false);
DeviceTypes_ = DefaultDeviceTypeList;
WebSocketProcessor_ = std::make_unique<GwWebSocketClient>(logger());
MicroServiceALBCallback(ALBHealthCallback);
}
[[nodiscard]] std::string Daemon::IdentifyDevice(const std::string &Id) const {

View File

@@ -12,10 +12,7 @@ namespace OpenWifi {
Event.set("type", type_);
Event.set("timestamp", timestamp_);
Event.set("payload", payload_);
std::ostringstream OS;
Event.stringify(OS);
auto payload = std::make_shared<std::string>(OS.str());
KafkaManager()->PostMessage(KafkaTopics::DEVICE_EVENT_QUEUE, Utils::IntToSerialNumber(serialNumber_), payload);
KafkaManager()->PostMessage(KafkaTopics::DEVICE_EVENT_QUEUE, Utils::IntToSerialNumber(serialNumber_), Event);
}
}

View File

@@ -98,7 +98,7 @@ namespace OpenWifi {
void RADIUSSessionTracker::ProcessAuthenticationSession([[maybe_unused]] OpenWifi::SessionNotification &Notification) {
std::lock_guard Guard(Mutex_);
std::string CallingStationId, AccountingSessionId, AccountingMultiSessionId, UserName, ChargeableUserIdentity, Interface, nasId;
std::string CallingStationId, CalledStationId, AccountingSessionId, AccountingMultiSessionId, UserName, ChargeableUserIdentity, Interface, nasId;
for (const auto &attribute : Notification.Packet_.Attrs_) {
switch (attribute.type) {
case RADIUS::Attributes::AUTH_USERNAME: {
@@ -111,6 +111,11 @@ namespace OpenWifi {
&Notification.Packet_.P_.attributes[attribute.pos],
&Notification.Packet_.P_.attributes[attribute.pos + attribute.len]);
} break;
case RADIUS::Attributes::CALLED_STATION_ID: {
CalledStationId.assign(
&Notification.Packet_.P_.attributes[attribute.pos],
&Notification.Packet_.P_.attributes[attribute.pos + attribute.len]);
} break;
case RADIUS::Attributes::ACCT_SESSION_ID: {
AccountingSessionId.assign(
&Notification.Packet_.P_.attributes[attribute.pos],
@@ -153,7 +158,7 @@ namespace OpenWifi {
ap_hint = AccountingSessions_.find(Notification.SerialNumber_);
}
auto Index = CallingStationId; // + AccountingSessionId; // +AccountingMultiSessionId;
auto Index = AccountingSessionId +AccountingMultiSessionId;
auto session_hint = ap_hint->second.find(Index);
if(session_hint==end(ap_hint->second)) {
auto NewSession = std::make_shared<GWObjects::RADIUSSession>();
@@ -161,6 +166,7 @@ namespace OpenWifi {
NewSession->started = NewSession->lastTransaction = Utils::Now();
NewSession->userName = UserName;
NewSession->callingStationId = CallingStationId;
NewSession->calledStationId = CalledStationId;
NewSession->accountingSessionId = AccountingSessionId;
NewSession->accountingMultiSessionId = AccountingMultiSessionId;
NewSession->chargeableUserIdentity = ChargeableUserIdentity;
@@ -172,6 +178,14 @@ namespace OpenWifi {
session_hint->second->lastTransaction = Utils::Now();
}
/*
if(ap_hint!=AccountingSessions_.end()) {
std::cout << "Auth table:" << std::endl;
for(const auto &session:ap_hint->second) {
std::cout << Notification.SerialNumber_ << ": Index: " << session.first << ": ID: " << session.second->accountingSessionId << " MID:" << session.second->accountingMultiSessionId << std::endl;
}
}
*/
}
std::uint32_t GetUiInt32(const std::uint8_t *buf) {
@@ -188,7 +202,7 @@ namespace OpenWifi {
RADIUSSessionTracker::ProcessAccountingSession(OpenWifi::SessionNotification &Notification) {
std::lock_guard Guard(Mutex_);
std::string CallingStationId, AccountingSessionId, AccountingMultiSessionId, UserName, ChargeableUserIdentity, Interface;
std::string CallingStationId, CalledStationId, AccountingSessionId, AccountingMultiSessionId, UserName, ChargeableUserIdentity, Interface;
std::uint8_t AccountingPacketType = 0;
std::uint32_t InputOctets=0, OutputOctets=0, InputPackets=0, OutputPackets=0, InputGigaWords=0, OutputGigaWords=0,
SessionTime = 0;
@@ -204,6 +218,11 @@ namespace OpenWifi {
&Notification.Packet_.P_.attributes[attribute.pos],
&Notification.Packet_.P_.attributes[attribute.pos + attribute.len]);
} break;
case RADIUS::Attributes::CALLED_STATION_ID: {
CalledStationId.assign(
&Notification.Packet_.P_.attributes[attribute.pos],
&Notification.Packet_.P_.attributes[attribute.pos + attribute.len]);
} break;
case RADIUS::Attributes::ACCT_SESSION_ID: {
AccountingSessionId.assign(
&Notification.Packet_.P_.attributes[attribute.pos],
@@ -258,7 +277,6 @@ namespace OpenWifi {
}
}
auto Index = CallingStationId; // + AccountingSessionId; // +AccountingMultiSessionId;
auto ap_hint = AccountingSessions_.find(Notification.SerialNumber_);
if(ap_hint==end(AccountingSessions_)) {
SessionMap M;
@@ -266,6 +284,7 @@ namespace OpenWifi {
ap_hint = AccountingSessions_.find(Notification.SerialNumber_);
}
auto Index = AccountingSessionId + AccountingMultiSessionId;
auto session_hint = ap_hint->second.find(Index);
if(session_hint==end(ap_hint->second)) {
// find the calling_station_id
@@ -275,12 +294,15 @@ namespace OpenWifi {
return;
}
// std::cout << "ACT -> " << Notification.SerialNumber_ << ": AccountingSessionId: " << AccountingSessionId << " AccountingMultiSessionId: " << AccountingMultiSessionId << std::endl;
auto NewSession = std::make_shared<GWObjects::RADIUSSession>();
NewSession->serialNumber = Notification.SerialNumber_;
NewSession->destination = Notification.Destination_;
NewSession->started = NewSession->lastTransaction = Utils::Now();
NewSession->userName = UserName;
NewSession->callingStationId = CallingStationId;
NewSession->calledStationId = CalledStationId;
NewSession->accountingSessionId = AccountingSessionId;
NewSession->accountingMultiSessionId = AccountingMultiSessionId;
NewSession->accountingPacket = Notification.Packet_;
@@ -319,6 +341,14 @@ namespace OpenWifi {
session_hint->second->sessionTime = SessionTime;
}
}
/* if(ap_hint!=AccountingSessions_.end()) {
std::cout << "Acct table:" << std::endl;
for(const auto &session:ap_hint->second) {
std::cout << Notification.SerialNumber_ << ": Index: " << session.first << ": ID: " << session.second->accountingSessionId << " MID:" << session.second->accountingMultiSessionId << std::endl;
}
}
*/
}
[[maybe_unused]] static void store_packet(const std::string &serialNumber, const char *buffer, std::size_t size, int i) {
@@ -340,18 +370,19 @@ namespace OpenWifi {
P.Identifier(std::rand() & 0x00ff);
P.AppendAttribute(RADIUS::Attributes::AUTH_USERNAME, session->userName);
P.AppendAttribute(RADIUS::Attributes::NAS_IP, (std::uint32_t)(0x7f000001));
P.AppendAttribute(RADIUS::Attributes::CALLING_STATION_ID, session->callingStationId);
if(!session->calledStationId.empty())
P.AppendAttribute(RADIUS::Attributes::CALLED_STATION_ID, session->calledStationId);
if(!session->callingStationId.empty())
P.AppendAttribute(RADIUS::Attributes::CALLING_STATION_ID, session->callingStationId);
if(!session->nasId.empty())
P.AppendAttribute(RADIUS::Attributes::NAS_IDENTIFIER, session->nasId);
if(!session->accountingSessionId.empty())
P.AppendAttribute(RADIUS::Attributes::ACCT_SESSION_ID, session->accountingSessionId);
if(!session->accountingMultiSessionId.empty())
P.AppendAttribute(RADIUS::Attributes::ACCT_MULTI_SESSION_ID, session->accountingMultiSessionId);
if(!session->chargeableUserIdentity.empty())
P.AppendAttribute(RADIUS::Attributes::CHARGEABLE_USER_IDENTITY, session->chargeableUserIdentity);
if(!session->nasId.empty())
P.AppendAttribute(RADIUS::Attributes::NAS_IDENTIFIER, session->nasId);
auto ProxyState = session->serialNumber + ":" + "0.0.0.0" + ":" + "3799" + ":" + session->interface;
std::cout << "Proxy state: " << ProxyState << " Secret: " << session->secret << std::endl;
// P.AppendAttribute(RADIUS::PROXY_STATE, ProxyState);
// std::cout << "Proxy state: " << ProxyState << " Secret: " << session->secret << std::endl;
P.AppendAttribute(RADIUS::Attributes::PROXY_STATE, ProxyState);
P.RecomputeAuthenticator(session->secret);
P.Log(std::cout);
AP_WS_Server()->SendRadiusCoAData(session->serialNumber, P.Buffer(), P.Size_);
@@ -368,9 +399,23 @@ namespace OpenWifi {
return false;
}
for(const auto &[_,session]:ap_hint->second) {
if(session->accountingSessionId==sessionId) {
SendCoADM(session);
auto session_hint = ap_hint->second.find(sessionId);
if(session_hint!=ap_hint->second.end()) {
SendCoADM(session_hint->second);
}
return true;
}
bool RADIUSSessionTracker::DisconnectUser(const std::string &UserName) {
poco_information(Logger(),fmt::format("Disconnect user {}.", UserName));
std::lock_guard Guard(Mutex_);
for(const auto &AP:AccountingSessions_) {
for(const auto &Session:AP.second) {
if(Session.second->userName==UserName) {
SendCoADM(Session.second);
}
}
}

View File

@@ -165,6 +165,7 @@ namespace OpenWifi {
bool SendCoADM(const std::string &serialNumber, const std::string &sessionId);
bool SendCoADM(const RADIUSSessionPtr &session);
bool DisconnectUser(const std::string &UserName);
inline std::uint32_t HasSessions(const std::string & serialNumber) {
std::lock_guard G(Mutex_);

View File

@@ -66,6 +66,7 @@ namespace OpenWifi::RADIUS {
constexpr std::uint8_t ACCT_INPUT_GIGAWORDS = 52;
constexpr std::uint8_t ACCT_OUTPUT_GIGAWORDS = 53;
constexpr std::uint8_t EVENT_TIMESTAMP = 55;
constexpr std::uint8_t TUNNEL_PRIVATE_GROUP_ID = 81;
constexpr std::uint8_t MESSAGE_AUTHENTICATOR = 80;
constexpr std::uint8_t CHARGEABLE_USER_IDENTITY = 89;
};
@@ -622,7 +623,7 @@ namespace OpenWifi::RADIUS {
std::string Attr33;
// format is serial:IP:port:interface
Attr33.assign((const char *)(const char *)&P_.attributes[attribute.pos],
attribute.len - 2);
attribute.len);
auto Parts = Poco::StringTokenizer(Attr33, "|");
if (Parts.count() == 4) {
return Parts[0];
@@ -645,7 +646,7 @@ namespace OpenWifi::RADIUS {
// format is
Attr33.assign((const char *)(const char *)&P_.attributes[attribute.pos],
attribute.len - 2);
attribute.len);
auto Parts = Poco::StringTokenizer(Attr33, "|");
if (Parts.count() == 4) {
Poco::Net::SocketAddress D(Parts[1], Parts[2]);
@@ -665,9 +666,9 @@ namespace OpenWifi::RADIUS {
std::string ExtractCallingStationID() const {
std::string Result;
for (const auto &attribute : Attrs_) {
if (attribute.type == RADIUS::Attributes::CALLING_STATION_ID && attribute.len > 2) {
if (attribute.type == RADIUS::Attributes::CALLING_STATION_ID && attribute.len > 0) {
Result.assign((const char *)(const char *)&P_.attributes[attribute.pos],
attribute.len - 2);
attribute.len);
return Result;
}
}
@@ -677,9 +678,21 @@ namespace OpenWifi::RADIUS {
std::string ExtractAccountingSessionID() const {
std::string Result;
for (const auto &attribute : Attrs_) {
if (attribute.type == RADIUS::Attributes::ACCT_SESSION_ID && attribute.len > 2) {
if (attribute.type == RADIUS::Attributes::ACCT_SESSION_ID && attribute.len > 0) {
Result.assign((const char *)(const char *)&P_.attributes[attribute.pos],
attribute.len - 2);
attribute.len );
return Result;
}
}
return Result;
}
std::string ExtractAccountingMultiSessionID() const {
std::string Result;
for (const auto &attribute : Attrs_) {
if (attribute.type == RADIUS::Attributes::ACCT_MULTI_SESSION_ID && attribute.len > 0) {
Result.assign((const char *)(const char *)&P_.attributes[attribute.pos],
attribute.len );
return Result;
}
}
@@ -689,9 +702,9 @@ namespace OpenWifi::RADIUS {
std::string ExtractCalledStationID() const {
std::string Result;
for (const auto &attribute : Attrs_) {
if (attribute.type == RADIUS::Attributes::CALLED_STATION_ID && attribute.len > 2) {
if (attribute.type == RADIUS::Attributes::CALLED_STATION_ID && attribute.len > 0) {
Result.assign((const char *)(const char *)&P_.attributes[attribute.pos],
attribute.len - 2);
attribute.len);
return Result;
}
}
@@ -969,7 +982,7 @@ namespace OpenWifi::RADIUS {
inline void AddAttribute(unsigned char attr, uint8_t len, const unsigned char *data) {
P_.attributes[AttributesLen_++] = attr;
P_.attributes[AttributesLen_++] = len;
P_.attributes[AttributesLen_++] = len+2;
memcpy(&P_.attributes[AttributesLen_], data, len);
AttributesLen_ += len;
}

View File

@@ -18,8 +18,6 @@ namespace OpenWifi {
const int DEFAULT_RADIUS_ACCOUNTING_PORT = 1813;
const int DEFAULT_RADIUS_CoA_PORT = 3799;
int RADIUS_proxy_server::Start() {
ConfigFilename_ = MicroServiceDataDirectory() + "/radius_pool_config.json";
@@ -161,11 +159,15 @@ namespace OpenWifi {
void RADIUS_proxy_server::StartRADSECServers() {
std::lock_guard G(Mutex_);
for (const auto &pool : PoolList_.pools) {
for (const auto &entry : pool.authConfig.servers) {
if (entry.radsec) {
RADSECservers_[Poco::Net::SocketAddress(entry.ip, 0)] =
std::make_unique<RADSEC_server>(*RadiusReactor_, entry);
if(pool.enabled) {
for (const auto &entry : pool.authConfig.servers) {
if (entry.radsec) {
RADSECservers_[Poco::Net::SocketAddress(entry.ip, 0)] =
std::make_unique<RADSEC_server>(*RadiusReactor_, entry, pool);
}
}
} else {
poco_information(Logger(),fmt::format("Pool {} is not enabled.", pool.name));
}
}
}
@@ -186,20 +188,15 @@ namespace OpenWifi {
return;
}
P.Evaluate(ReceiveSize);
// P.Log(std::cout);
auto SerialNumber = P.ExtractSerialNumberFromProxyState();
if (SerialNumber.empty()) {
poco_warning(Logger(), "Accounting: missing serial number.");
poco_warning(Logger(), "Accounting: missing serial number. Dropping request.");
return;
}
auto CallingStationID = P.ExtractCallingStationID();
auto CalledStationID = P.ExtractCalledStationID();
poco_debug(
Logger(),
fmt::format(
"Accounting Packet received for {}, CalledStationID: {}, CallingStationID:{}",
SerialNumber, CalledStationID, CallingStationID));
"Accounting Packet Response received for {}", SerialNumber ));
AP_WS_Server()->SendRadiusAccountingData(SerialNumber, P.Buffer(), P.Size());
}
@@ -214,10 +211,13 @@ namespace OpenWifi {
return;
}
P.Evaluate(ReceiveSize);
// P.Log(std::cout);
if(Logger().trace()) {
P.Log(std::cout);
}
auto SerialNumber = P.ExtractSerialNumberFromProxyState();
if (SerialNumber.empty()) {
poco_warning(Logger(), "Authentication: missing serial number.");
poco_warning(Logger(), "Authentication: missing serial number. Dropping request.");
return;
}
auto CallingStationID = P.ExtractCallingStationID();
@@ -241,12 +241,11 @@ namespace OpenWifi {
poco_warning(Logger(), "CoA/DM: bad packet received.");
return;
}
// P.Log(std::cout);
P.Evaluate(ReceiveSize);
auto SerialNumber = P.ExtractSerialNumberTIP();
if (SerialNumber.empty()) {
poco_warning(Logger(), "CoA/DM: missing serial number.");
poco_warning(Logger(), "CoA/DM: missing serial number. Dropping request.");
return;
}
auto CallingStationID = P.ExtractCallingStationID();
@@ -334,11 +333,7 @@ namespace OpenWifi {
try {
RADIUS::RadiusPacket P((unsigned char *)buffer, size);
// P.Log(std::cout);
auto Destination = P.ExtractProxyStateDestination();
// store_packet(serialNumber, buffer, size);
RouteAndSendAccountingPacket(Destination, serialNumber, P, false, secret);
RADIUSSessionTracker()->AddAccountingSession(Destination, serialNumber, P, secret);
@@ -368,14 +363,11 @@ namespace OpenWifi {
auto CalledStationID = P.ExtractCalledStationID();
Poco::Net::SocketAddress Dst(Destination);
// P.Log(std::cout);
std::lock_guard G(Mutex_);
bool UseRADSEC = false;
auto FinalDestination = Route(radius_type::auth, Dst, P, UseRADSEC, secret);
RADIUSSessionTracker()->AddAuthenticationSession(Destination, serialNumber, P, secret);
// std::cout << "Authentication secret: " << secret << std::endl;
if (UseRADSEC) {
Poco::Net::SocketAddress RSP(FinalDestination.host(), 0);
auto DestinationServer = RADSECservers_.find(RSP);
@@ -431,13 +423,19 @@ namespace OpenWifi {
Destination = "0.0.0.0:0";
}
P.Log(std::cout);
if(Logger().trace()) {
P.Log(std::cout);
}
if(Destination.empty()) {
poco_warning(Logger(),fmt::format("{}: CoA packet does not have a valid destination.", serialNumber));
return;
}
Poco::Net::SocketAddress Dst(Destination);
std::lock_guard G(Mutex_);
bool UseRADSEC = false;
auto FinalDestination = Route(radius_type::coa, Dst, P, UseRADSEC, secret);
std::cout << "CoA secret: " << secret << std::endl;
if (UseRADSEC) {
Poco::Net::SocketAddress RSP(FinalDestination.host(), 0);
auto DestinationServer = RADSECservers_.find(RSP);
@@ -458,9 +456,10 @@ namespace OpenWifi {
auto AllSent = SendData(
Dst.family() == Poco::Net::SocketAddress::IPv4 ? *CoASocketV4_ : *CoASocketV6_,
(const unsigned char *)buffer, size, FinalDestination);
if (!AllSent)
if (!AllSent) {
poco_error(Logger(), fmt::format("{}: Could not send CoA packet packet to {}.",
serialNumber, Destination));
}
else
poco_debug(Logger(), fmt::format("{}: Sending CoA Packet to {}", serialNumber,
FinalDestination.toString()));
@@ -475,7 +474,8 @@ namespace OpenWifi {
void RADIUS_proxy_server::ParseServerList(const GWObjects::RadiusProxyServerConfig &Config,
std::vector<Destination> &V4,
std::vector<Destination> &V6, bool setAsDefault) {
std::vector<Destination> &V6, bool setAsDefault,
const std::string &poolProxyIp) {
uint64_t TotalV4 = 0, TotalV6 = 0;
for (const auto &server : Config.servers) {
@@ -499,7 +499,8 @@ namespace OpenWifi {
.useAsDefault = setAsDefault,
.useRADSEC = server.radsec,
.realms = server.radsecRealms,
.secret = server.secret };
.secret = server.secret,
.poolProxyIp = poolProxyIp};
if (setAsDefault && D.useRADSEC)
DefaultIsRADSEC_ = true;
@@ -548,11 +549,11 @@ namespace OpenWifi {
for (const auto &pool : RPC.pools) {
RadiusPool NewPool;
ParseServerList(pool.authConfig, NewPool.AuthV4, NewPool.AuthV6,
pool.useByDefault);
pool.useByDefault, pool.poolProxyIp);
ParseServerList(pool.acctConfig, NewPool.AcctV4, NewPool.AcctV6,
pool.useByDefault);
pool.useByDefault, pool.poolProxyIp);
ParseServerList(pool.coaConfig, NewPool.CoaV4, NewPool.CoaV6,
pool.useByDefault);
pool.useByDefault, pool.poolProxyIp);
Pools_.push_back(NewPool);
}
} else {
@@ -582,6 +583,7 @@ namespace OpenWifi {
const Poco::Net::SocketAddress &RequestedAddress,
const RADIUS::RadiusPacket &P, bool &UseRADSEC,
std::string &Secret) {
bool IsV4 = RequestedAddress.family() == Poco::Net::SocketAddress::IPv4;
// find the realm...
@@ -596,7 +598,6 @@ namespace OpenWifi {
if (!server.realms.empty()) {
for (const auto &realm : server.realms) {
if (RealmMatch(UserRealm, realm)) {
// std::cout << "Realm match..." << std::endl;
UseRADSEC = true;
return server.Addr;
}
@@ -618,17 +619,17 @@ namespace OpenWifi {
: Pools_[DefaultPoolIndex_].AuthV6,
RequestedAddress, Secret);
}
case radius_type::coa: {
return ChooseAddress(IsV4 ? Pools_[DefaultPoolIndex_].CoaV4
: Pools_[DefaultPoolIndex_].CoaV6,
RequestedAddress, Secret);
}
case radius_type::acct:
default: {
return ChooseAddress(IsV4 ? Pools_[DefaultPoolIndex_].AcctV4
: Pools_[DefaultPoolIndex_].AcctV6,
RequestedAddress, Secret);
}
case radius_type::coa: {
return ChooseAddress(IsV4 ? Pools_[DefaultPoolIndex_].CoaV4
: Pools_[DefaultPoolIndex_].CoaV6,
RequestedAddress, Secret);
}
}
}
@@ -637,7 +638,6 @@ namespace OpenWifi {
const Poco::Net::SocketAddress &RequestedAddress,
const RADIUS::RadiusPacket &P, bool &UseRADSEC,
std::string &Secret) {
std::lock_guard G(Mutex_);
if (Pools_.empty()) {
UseRADSEC = false;
@@ -646,6 +646,7 @@ namespace OpenWifi {
bool IsV4 = RequestedAddress.family() == Poco::Net::SocketAddress::IPv4;
bool useDefault;
useDefault = IsV4 ? RequestedAddress.host() ==
Poco::Net::IPAddress::wildcard(Poco::Net::IPAddress::IPv4)
: RequestedAddress.host() ==
@@ -656,29 +657,36 @@ namespace OpenWifi {
}
auto isAddressInPool = [&](const std::vector<Destination> &D, bool &UseRADSEC) -> bool {
for (const auto &entry : D)
for (const auto &entry : D) {
if (!entry.poolProxyIp.empty() &&
entry.poolProxyIp == RequestedAddress.host().toString()) {
UseRADSEC = entry.useRADSEC;
return true;
}
if (entry.Addr.host() == RequestedAddress.host()) {
UseRADSEC = entry.useRADSEC;
return true;
}
}
return false;
};
for (auto &i : Pools_) {
for (auto &pool : Pools_) {
// try and match the pool's address to the destination
switch (rtype) {
case radius_type::coa: {
if (isAddressInPool((IsV4 ? i.CoaV4 : i.CoaV6), UseRADSEC)) {
return ChooseAddress(IsV4 ? i.CoaV4 : i.CoaV6, RequestedAddress, Secret);
if (isAddressInPool((IsV4 ? pool.CoaV4 : pool.CoaV6), UseRADSEC)) {
return ChooseAddress(IsV4 ? pool.CoaV4 : pool.CoaV6, RequestedAddress, Secret);
}
} break;
case radius_type::auth: {
if (isAddressInPool((IsV4 ? i.AuthV4 : i.AuthV6), UseRADSEC)) {
return ChooseAddress(IsV4 ? i.AuthV4 : i.AuthV6, RequestedAddress, Secret);
if (isAddressInPool((IsV4 ? pool.AuthV4 : pool.AuthV6), UseRADSEC)) {
return ChooseAddress(IsV4 ? pool.AuthV4 : pool.AuthV6, RequestedAddress, Secret);
}
} break;
case radius_type::acct: {
if (isAddressInPool((IsV4 ? i.AcctV4 : i.AcctV6), UseRADSEC)) {
return ChooseAddress(IsV4 ? i.AcctV4 : i.AcctV6, RequestedAddress, Secret);
if (isAddressInPool((IsV4 ? pool.AcctV4 : pool.AcctV6), UseRADSEC)) {
return ChooseAddress(IsV4 ? pool.AcctV4 : pool.AcctV6, RequestedAddress, Secret);
}
} break;
}
@@ -695,7 +703,8 @@ namespace OpenWifi {
if (Pool.size() == 1) {
Secret = Pool[0].secret;
return Pool[0].Addr;
auto A = Pool[0].Addr;
return A;
}
if (Pool[0].strategy == "weighted") {
@@ -741,7 +750,7 @@ namespace OpenWifi {
}
if (!found) {
return OriginalAddress;
// return OriginalAddress;
}
Pool[index].state += 1;

View File

@@ -62,6 +62,7 @@ namespace OpenWifi {
bool useRADSEC = false;
std::vector<std::string> realms;
std::string secret;
std::string poolProxyIp;
};
inline bool Continue() const { return Running_ && Enabled_ && !Pools_.empty(); }
@@ -107,8 +108,9 @@ namespace OpenWifi {
Poco::Net::SocketAddress Route(radius_type rtype, const Poco::Net::SocketAddress &A,
const RADIUS::RadiusPacket &P, bool &UseRADSEC, std::string &secret);
void ParseServerList(const GWObjects::RadiusProxyServerConfig &Config,
std::vector<Destination> &V4, std::vector<Destination> &V6,
bool setAsDefault);
std::vector<Destination> &V4,
std::vector<Destination> &V6, bool setAsDefault,
const std::string &poolProxyIp);
static Poco::Net::SocketAddress
ChooseAddress(std::vector<Destination> &Pool,
const Poco::Net::SocketAddress &OriginalAddress, std::string &Secret);

View File

@@ -10,6 +10,7 @@
#include "RESTObjects/RESTAPI_GWobjects.h"
#include "Poco/Crypto/X509Certificate.h"
#include "Poco/Crypto/RSAKey.h"
#include "Poco/Net/Context.h"
#include "Poco/Net/NetException.h"
#include "Poco/Net/SecureStreamSocket.h"
@@ -27,10 +28,12 @@ namespace OpenWifi {
class RADSEC_server : public Poco::Runnable {
public:
RADSEC_server(Poco::Net::SocketReactor &R, GWObjects::RadiusProxyServerEntry E)
RADSEC_server(Poco::Net::SocketReactor &R, GWObjects::RadiusProxyServerEntry E, const GWObjects::RadiusProxyPool &P)
: Reactor_(R), Server_(std::move(E)),
Logger_(Poco::Logger::get(
fmt::format("RADSEC: {}@{}:{}", Server_.name, Server_.ip, Server_.port))) {
KeepAlive_ = P.radsecKeepAlive;
Type_ = P.radsecPoolType;
Start();
}
@@ -49,22 +52,27 @@ namespace OpenWifi {
}
inline void run() final {
Poco::Thread::trySleep(3000);
std::uint64_t LastStatus = 0;
auto RadSecKeepAlive = MicroServiceConfigGetInt("radsec.keepalive", 120);
Poco::Thread::trySleep(5000);
std::uint64_t CurrentDelay = 10, maxDelay=300, LastTry=0, LastKeepAlive=0;
while (TryAgain_) {
if (!Connected_) {
std::lock_guard G(LocalMutex_);
LastStatus = Utils::Now();
Connect();
} else if ((Utils::Now() - LastStatus) > RadSecKeepAlive) {
if(!LastTry || (Utils::Now()-LastTry)>CurrentDelay) {
LastTry = Utils::Now();
if (!Connect()) {
CurrentDelay *= 2;
if(CurrentDelay>maxDelay) CurrentDelay=10;
} else {
CurrentDelay = 10;
}
}
} else if ((Utils::Now() - LastKeepAlive) > KeepAlive_) {
RADIUS::RadiusOutputPacket P(Server_.radsecSecret);
P.MakeStatusMessage();
poco_information(Logger_, "Keep-Alive message.");
poco_trace(Logger_, fmt::format("{}: Keep-Alive message.", Server_.name));
Socket_->sendBytes(P.Data(), P.Len());
LastStatus = Utils::Now();
LastKeepAlive = Utils::Now();
}
Poco::Thread::trySleep(!Connected_ ? 3000 : 10000);
Poco::Thread::trySleep(2000);
}
}
@@ -75,11 +83,11 @@ namespace OpenWifi {
RADIUS::RadiusPacket P(buffer, length);
int sent_bytes;
if (P.VerifyMessageAuthenticator(Server_.radsecSecret)) {
poco_debug(Logger_, fmt::format("{}: {} Sending {} bytes", serial_number,
poco_trace(Logger_, fmt::format("{}: {} Sending {} bytes", serial_number,
P.PacketType(), length));
sent_bytes = Socket_->sendBytes(buffer, length);
} else {
poco_debug(Logger_, fmt::format("{}: {} Sending {} bytes", serial_number,
poco_trace(Logger_, fmt::format("{}: {} Sending {} bytes", serial_number,
P.PacketType(), length));
P.ComputeMessageAuthenticator(Server_.radsecSecret);
sent_bytes = Socket_->sendBytes(P.Buffer(), length);
@@ -105,35 +113,35 @@ namespace OpenWifi {
if (P.IsAuthentication()) {
auto SerialNumber = P.ExtractSerialNumberFromProxyState();
if (!SerialNumber.empty()) {
poco_debug(Logger_,
poco_trace(Logger_,
fmt::format("{}: {} Received {} bytes.", SerialNumber,
P.PacketType(), NumberOfReceivedBytes));
AP_WS_Server()->SendRadiusAuthenticationData(SerialNumber, Buffer,
NumberOfReceivedBytes);
} else {
poco_debug(Logger_, "AUTH packet dropped.");
poco_trace(Logger_, "AUTH packet dropped.");
}
} else if (P.IsAccounting()) {
auto SerialNumber = P.ExtractSerialNumberFromProxyState();
if (!SerialNumber.empty()) {
poco_debug(Logger_,
poco_trace(Logger_,
fmt::format("{}: {} Received {} bytes.", SerialNumber,
P.PacketType(), NumberOfReceivedBytes));
AP_WS_Server()->SendRadiusAccountingData(SerialNumber, Buffer,
NumberOfReceivedBytes);
} else {
poco_debug(Logger_, "ACCT packet dropped.");
poco_trace(Logger_, "ACCT packet dropped.");
}
} else if (P.IsAuthority()) {
auto SerialNumber = P.ExtractSerialNumberTIP();
if (!SerialNumber.empty()) {
poco_debug(Logger_,
poco_trace(Logger_,
fmt::format("{}: {} Received {} bytes.", SerialNumber,
P.PacketType(), NumberOfReceivedBytes));
AP_WS_Server()->SendRadiusCoAData(SerialNumber, Buffer,
NumberOfReceivedBytes);
} else {
poco_debug(Logger_, "CoA/DM packet dropped.");
poco_trace(Logger_, "CoA/DM packet dropped.");
}
} else {
poco_warning(Logger_,
@@ -165,7 +173,126 @@ namespace OpenWifi {
Disconnect();
}
inline bool Connect() {
static inline bool IsExpired(const Poco::Crypto::X509Certificate &C) {
return C.expiresOn().timestamp().epochTime() < (std::time_t)Utils::Now();
}
inline bool Connect_GlobalReach() {
if (TryAgain_) {
std::lock_guard G(LocalMutex_);
Poco::TemporaryFile CertFile_(MicroServiceDataDirectory());
Poco::TemporaryFile KeyFile_(MicroServiceDataDirectory());
Poco::TemporaryFile OpenRoamingRootCertFile_(MicroServiceDataDirectory());
Poco::TemporaryFile Intermediate0(MicroServiceDataDirectory());
Poco::TemporaryFile Intermediate1(MicroServiceDataDirectory());
Poco::TemporaryFile Combined(MicroServiceDataDirectory());
std::vector<std::unique_ptr<Poco::TemporaryFile>> CaCertFiles_;
DecodeFile(KeyFile_.path(), Server_.radsecKey);
DecodeFile(CertFile_.path(), Server_.radsecCert);
DecodeFile(Intermediate0.path(), Server_.radsecCacerts[0]);
DecodeFile(Intermediate1.path(), Server_.radsecCacerts[1]);
for (auto &cert : Server_.radsecCacerts) {
CaCertFiles_.emplace_back(
std::make_unique<Poco::TemporaryFile>(MicroServiceDataDirectory()));
DecodeFile(CaCertFiles_[CaCertFiles_.size() - 1]->path(), cert);
}
std::string OpenRoamingRootCert{"-----BEGIN CERTIFICATE-----\n"
"MIIClDCCAhugAwIBAgIUF1f+h+uJNHyr+ZqTpwew8LYRAW0wCgYIKoZIzj0EAwMw\n"
"gYkxCzAJBgNVBAYTAkdCMQ8wDQYDVQQIEwZMb25kb24xDzANBgNVBAcTBkxvbmRv\n"
"bjEsMCoGA1UEChMjR2xvYmFsUmVhY2ggVGVjaG5vbG9neSBFTUVBIExpbWl0ZWQx\n"
"KjAoBgNVBAMTIUdsb2JhbFJlYWNoIENlcnRpZmljYXRlIEF1dGhvcml0eTAeFw0y\n"
"MzA3MTQwOTMyMDBaFw00MzA3MDkwOTMyMDBaMIGJMQswCQYDVQQGEwJHQjEPMA0G\n"
"A1UECBMGTG9uZG9uMQ8wDQYDVQQHEwZMb25kb24xLDAqBgNVBAoTI0dsb2JhbFJl\n"
"YWNoIFRlY2hub2xvZ3kgRU1FQSBMaW1pdGVkMSowKAYDVQQDEyFHbG9iYWxSZWFj\n"
"aCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAARy\n"
"f02umFNy5W/TtM5nfMaLhRF61vLxhT8iNQHR1mXiRmNdME3ArForBcAm2eolHPcJ\n"
"RH9DcXs59d2zzoPEaBjXADTCjUts3F7G6fjqvfki2e/txx/xfUopQO8G54XcFWqj\n"
"QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRS\n"
"tNe7MgAFwTaMZKUtS1/8pVoBqjAKBggqhkjOPQQDAwNnADBkAjA7VKHTybtSMBcN\n"
"717jGYvkWlcj4c9/LzPtkHO053wGsPigaq+1SjY7tDhS/g9oUQACMA6UqH2e8cfn\n"
"cZqmBNVNN3DBjIb4anug7F+FnYOQF36ua6MLBeGn3aKxvu1aO+hjPg==\n"
"-----END CERTIFICATE-----\n"};
std::ofstream ofs{OpenRoamingRootCertFile_.path().c_str(),std::ios_base::trunc|std::ios_base::out|std::ios_base::binary};
ofs << OpenRoamingRootCert;
ofs.close();
Poco::Net::Context::Ptr SecureContext =
Poco::AutoPtr<Poco::Net::Context>(new Poco::Net::Context(
Poco::Net::Context::TLS_CLIENT_USE, ""));
if (Server_.allowSelfSigned) {
SecureContext->setSecurityLevel(Poco::Net::Context::SECURITY_LEVEL_NONE);
SecureContext->enableExtendedCertificateVerification(false);
}
SecureContext->usePrivateKey(Poco::Crypto::RSAKey("",KeyFile_.path(),""));
Poco::Crypto::X509Certificate Cert(CertFile_.path());
if(!IsExpired(Cert)) {
SecureContext->useCertificate(Poco::Crypto::X509Certificate(CertFile_.path()));
} else {
poco_error(Logger_, fmt::format("Certificate for {} has expired. We cannot connect to this server.", Server_.name));
return false;
}
SecureContext->addCertificateAuthority(Poco::Crypto::X509Certificate(OpenRoamingRootCertFile_.path()));
SecureContext->addChainCertificate(Poco::Crypto::X509Certificate(Intermediate0.path()));
SecureContext->addChainCertificate(Poco::Crypto::X509Certificate(Intermediate1.path()));
SecureContext->enableExtendedCertificateVerification(false);
Socket_ = std::make_unique<Poco::Net::SecureStreamSocket>(SecureContext);
Poco::Net::SocketAddress Destination(Server_.ip, Server_.port);
try {
poco_information(Logger_, "Attempting to connect");
Socket_->connect(Destination, Poco::Timespan(20, 0));
Socket_->completeHandshake();
if (!Server_.allowSelfSigned) {
Socket_->verifyPeerCertificate();
}
if (Socket_->havePeerCertificate()) {
Peer_Cert_ = std::make_unique<Poco::Crypto::X509Certificate>(
Socket_->peerCertificate());
}
Socket_->setBlocking(false);
Socket_->setNoDelay(true);
Socket_->setKeepAlive(true);
Socket_->setReceiveTimeout(Poco::Timespan(1 * 60 * 60, 0));
Reactor_.addEventHandler(
*Socket_, Poco::NObserver<RADSEC_server, Poco::Net::ReadableNotification>(
*this, &RADSEC_server::onData));
Reactor_.addEventHandler(
*Socket_, Poco::NObserver<RADSEC_server, Poco::Net::ErrorNotification>(
*this, &RADSEC_server::onError));
Reactor_.addEventHandler(
*Socket_, Poco::NObserver<RADSEC_server, Poco::Net::ShutdownNotification>(
*this, &RADSEC_server::onShutdown));
Connected_ = true;
poco_information(Logger_, fmt::format("Connected. CN={}", CommonName()));
return true;
} catch (const Poco::Net::NetException &E) {
poco_warning(Logger_, "NetException: Could not connect.");
Logger_.log(E);
} catch (const Poco::Exception &E) {
poco_warning(Logger_, "Exception: Could not connect.");
Logger_.log(E);
} catch (...) {
poco_warning(Logger_, "Could not connect.");
}
}
return false;
}
inline bool Connect_Orion() {
if (TryAgain_) {
std::lock_guard G(LocalMutex_);
@@ -176,6 +303,12 @@ namespace OpenWifi {
DecodeFile(CertFile_.path(), Server_.radsecCert);
DecodeFile(KeyFile_.path(), Server_.radsecKey);
Poco::Crypto::X509Certificate Cert(CertFile_.path());
if(IsExpired(Cert)) {
poco_error(Logger_, fmt::format("Certificate for {} has expired. We cannot connect to this server.", Server_.name));
return false;
}
for (auto &cert : Server_.radsecCacerts) {
CaCertFiles_.emplace_back(
std::make_unique<Poco::TemporaryFile>(MicroServiceDataDirectory()));
@@ -244,6 +377,19 @@ namespace OpenWifi {
return false;
}
inline bool Connect_Generic() {
if (TryAgain_) {
std::lock_guard G(LocalMutex_);
}
return true;
}
inline bool Connect() {
if(Type_=="orion") return Connect_Orion();
if(Type_=="globalreach") return Connect_GlobalReach();
return Connect_Generic();
}
inline void Disconnect() {
if (Connected_) {
std::lock_guard G(LocalMutex_);
@@ -300,5 +446,7 @@ namespace OpenWifi {
std::unique_ptr<Poco::Crypto::X509Certificate> Peer_Cert_;
volatile bool Connected_ = false;
volatile bool TryAgain_ = true;
std::uint64_t KeepAlive_;
std::string Type_;
};
} // namespace OpenWifi

View File

@@ -7,7 +7,6 @@
//
#include "Poco/Array.h"
#include "Poco/JSON/Stringifier.h"
#include "RESTAPI_default_configurations.h"
#include "StorageService.h"

View File

@@ -0,0 +1,117 @@
//
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by stephane bourque on 2023-07-11.
// Arilia Wireless Inc.
//
#include "RESTAPI/RESTAPI_default_firmware.h"
#include "RESTObjects/RESTAPI_GWobjects.h"
#include "StorageService.h"
#include "framework/orm.h"
#include "framework/ow_constants.h"
#include "framework/utils.h"
namespace OpenWifi {
void RESTAPI_default_firmware::DoGet() {
std::string deviceType = ORM::Escape(GetBinding(RESTAPI::Protocol::DEVICETYPE, ""));
GWObjects::DefaultFirmware Firmware;
if (StorageService()->GetDefaultFirmware(deviceType, Firmware)) {
return Object(Firmware);
}
NotFound();
}
void RESTAPI_default_firmware::DoDelete() {
std::string deviceType = ORM::Escape(GetBinding(RESTAPI::Protocol::DEVICETYPE, ""));
if (deviceType.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
if (StorageService()->DeleteDefaultFirmware(deviceType)) {
return OK();
}
BadRequest(RESTAPI::Errors::CouldNotBeDeleted);
}
void RESTAPI_default_firmware::DoPost() {
std::string deviceType = GetBinding(RESTAPI::Protocol::DEVICETYPE, "");
if (deviceType.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
if (StorageService()->DefaultFirmwareAlreadyExists(deviceType)) {
return BadRequest(RESTAPI::Errors::DefFirmwareNameExists);
}
const auto &Obj = ParsedBody_;
GWObjects::DefaultFirmware Firmware;
if (!Firmware.from_json(Obj)) {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
}
if(Firmware.uri.empty() || Firmware.revision.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
try {
Poco::URI FirmwareURI(Firmware.uri);
} catch (...) {
return BadRequest(RESTAPI::Errors::InvalidURI);
}
Firmware.Created = Firmware.LastModified = Utils::Now();
if (StorageService()->CreateDefaultFirmware(Firmware)) {
GWObjects::DefaultFirmware ModifiedFirmware;
StorageService()->GetDefaultFirmware(deviceType, ModifiedFirmware);
return Object(ModifiedFirmware);
}
BadRequest(RESTAPI::Errors::RecordNotCreated);
}
void RESTAPI_default_firmware::DoPut() {
std::string deviceType = GetBinding(RESTAPI::Protocol::DEVICETYPE, "");
const auto &Obj = ParsedBody_;
GWObjects::DefaultFirmware NewFirmware;
if (!NewFirmware.from_json(Obj)) {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
}
GWObjects::DefaultFirmware Existing;
if (!StorageService()->GetDefaultFirmware(deviceType, Existing)) {
return NotFound();
}
Existing.LastModified = Utils::Now();
AssignIfPresent(Obj, "description", Existing.Description);
AssignIfPresent(Obj, "imageCreationDate", Existing.imageCreationDate);
AssignIfPresent(Obj, "revision", Existing.revision);
if (Obj->has("uri")) {
if(NewFirmware.uri.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
try {
Poco::URI FirmwareURI(NewFirmware.uri);
} catch (...) {
return BadRequest(RESTAPI::Errors::InvalidURI);
}
Existing.uri = NewFirmware.uri;
}
if (StorageService()->UpdateDefaultFirmware(Existing)) {
GWObjects::DefaultFirmware ModifiedFirmware;
StorageService()->GetDefaultFirmware(deviceType, ModifiedFirmware);
return Object(ModifiedFirmware);
}
BadRequest(RESTAPI::Errors::RecordNotUpdated);
}
} // namespace OpenWifi

View File

@@ -0,0 +1,30 @@
//
// Created by stephane bourque on 2023-07-11.
//
#pragma once
#include "framework/RESTAPI_Handler.h"
namespace OpenWifi {
class RESTAPI_default_firmware : public RESTAPIHandler {
public:
RESTAPI_default_firmware(const RESTAPIHandler::BindingMap &bindings, Poco::Logger &L,
RESTAPI_GenericServerAccounting &Server,
uint64_t TransactionId, bool Internal)
: RESTAPIHandler(bindings, L,
std::vector<std::string>{Poco::Net::HTTPRequest::HTTP_GET,
Poco::Net::HTTPRequest::HTTP_POST,
Poco::Net::HTTPRequest::HTTP_PUT,
Poco::Net::HTTPRequest::HTTP_DELETE,
Poco::Net::HTTPRequest::HTTP_OPTIONS},
Server, TransactionId, Internal) {}
static auto PathName() {
return std::list<std::string>{"/api/v1/default_firmware/{deviceType}"};
}
void DoGet() final;
void DoDelete() final;
void DoPost() final;
void DoPut() final;
};
} // namespace OpenWifi

View File

@@ -0,0 +1,25 @@
//
// Created by stephane bourque on 2023-07-11.
//
#include "RESTAPI_default_firmwares.h"
#include "Poco/Array.h"
#include "RESTAPI_default_firmwares.h"
#include "StorageService.h"
#include "framework/ow_constants.h"
namespace OpenWifi {
void RESTAPI_default_firmwares::DoGet() {
if (QB_.CountOnly) {
auto Count = StorageService()->GetDefaultFirmwaresCount();
return ReturnCountOnly(Count);
}
std::vector<GWObjects::DefaultFirmware> Firmwares;
StorageService()->GetDefaultFirmwares(QB_.Offset, QB_.Limit, Firmwares);
return Object(RESTAPI::Protocol::FIRMWARES, Firmwares);
}
} // namespace OpenWifi

View File

@@ -0,0 +1,25 @@
//
// Created by stephane bourque on 2023-07-11.
//
#pragma once
#include "framework/RESTAPI_Handler.h"
namespace OpenWifi {
class RESTAPI_default_firmwares : public RESTAPIHandler {
public:
RESTAPI_default_firmwares(const RESTAPIHandler::BindingMap &bindings, Poco::Logger &L,
RESTAPI_GenericServerAccounting &Server,
uint64_t TransactionId, bool Internal)
: RESTAPIHandler(bindings, L,
std::vector<std::string>{Poco::Net::HTTPRequest::HTTP_GET,
Poco::Net::HTTPRequest::HTTP_OPTIONS},
Server, TransactionId, Internal){};
static auto PathName() { return std::list<std::string>{"/api/v1/default_firmwares"}; }
void DoGet() final;
void DoDelete() final{};
void DoPost() final{};
void DoPut() final{};
};
} // namespace OpenWifi

View File

@@ -1024,7 +1024,7 @@ namespace OpenWifi {
RESTAPI_RPC::WaitForCommand(CMD_RPC, APCommands::Commands::wifiscan, false, Cmd, Params,
*Request, *Response, timeout, nullptr, this, Logger_);
if (Cmd.ErrorCode == 0) {
KafkaManager()->PostMessage(KafkaTopics::WIFISCAN, SerialNumber_, std::make_shared<std::string>(Cmd.Results));
KafkaManager()->PostMessage(KafkaTopics::WIFISCAN, SerialNumber_, Cmd.Results);
}
}
@@ -1069,7 +1069,7 @@ namespace OpenWifi {
Logger_);
if (Cmd.ErrorCode == 0) {
KafkaManager()->PostMessage(KafkaTopics::DEVICE_EVENT_QUEUE, SerialNumber_,
std::make_shared<std::string>(Cmd.Results));
Cmd.Results);
}
return;
}
@@ -1126,9 +1126,6 @@ namespace OpenWifi {
BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
#define DBGLINE \
{ std::cout << __LINE__ << std::endl; }
void RESTAPI_device_commandHandler::Rtty(
const std::string &CMD_UUID, uint64_t CMD_RPC, std::chrono::milliseconds timeout,
[[maybe_unused]] const GWObjects::DeviceRestrictions &Restrictions) {

View File

@@ -8,6 +8,11 @@
namespace OpenWifi {
static bool ValidRadiusPoolServerType(const std::string &T) {
static std::set<std::string> Types{ "generic", "orion", "globalreach"};
return Types.find(T)!=Types.end();
}
void RESTAPI_radiusProxyConfig_handler::DoGet() {
Logger_.information(fmt::format("GET-RADIUS-PROXY-CONFIG: TID={} user={} thr_id={}",
TransactionId_, Requester(),
@@ -44,10 +49,22 @@ namespace OpenWifi {
}
// Logically validate the config.
for (const auto &pool : C.pools) {
for (auto &pool : C.pools) {
if (pool.name.empty()) {
return BadRequest(RESTAPI::Errors::PoolNameInvalid);
}
if (pool.radsecPoolType.empty()) {
pool.radsecPoolType = "generic";
}
if(!ValidRadiusPoolServerType(pool.radsecPoolType)) {
return BadRequest(RESTAPI::Errors::NotAValidRadiusPoolType);
}
if(pool.radsecKeepAlive==0) {
pool.radsecKeepAlive=25;
}
for (const auto &config : {pool.acctConfig, pool.authConfig, pool.coaConfig}) {
if (config.servers.empty())
continue;

View File

@@ -110,14 +110,26 @@ namespace OpenWifi {
return BadRequest(RESTAPI::Errors::InvalidJSONDocument);
}
if(Parameters.callingStationId.empty() || Parameters.accountingSessionId.empty() || Parameters.accountingMultiSessionId.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
auto Command = GetParameter("operation","");
if(Command=="coadm") {
if(RADIUSSessionTracker()->SendCoADM(SerialNumber, Parameters.accountingSessionId)) {
if(Parameters.callingStationId.empty() || Parameters.accountingSessionId.empty() || Parameters.accountingMultiSessionId.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
auto Index = Parameters.accountingSessionId + Parameters.accountingMultiSessionId;
poco_information(Logger(), fmt::format("Disconnecting session {},{}", Parameters.accountingSessionId, Parameters.accountingMultiSessionId ));
if(RADIUSSessionTracker()->SendCoADM(SerialNumber, Index)) {
return OK();
}
return BadRequest(RESTAPI::Errors::CouldNotPerformCommand);
}
if(Command=="disconnectUser" && !Parameters.userName.empty()) {
if(Parameters.userName.empty()) {
return BadRequest(RESTAPI::Errors::MissingOrInvalidParameters);
}
poco_information(Logger(), fmt::format("Disconnecting sessions for user: {}", Parameters.userName ));
if(RADIUSSessionTracker()->DisconnectUser(Parameters.userName)) {
return OK();
}
return BadRequest(RESTAPI::Errors::CouldNotPerformCommand);

View File

@@ -22,6 +22,8 @@
#include "RESTAPI/RESTAPI_scripts_handler.h"
#include "RESTAPI/RESTAPI_telemetryWebSocket.h"
#include "RESTAPI/RESTAPI_radiussessions_handler.h"
#include "RESTAPI/RESTAPI_default_firmware.h"
#include "RESTAPI/RESTAPI_default_firmwares.h"
#include "framework/RESTAPI_SystemCommand.h"
#include "framework/RESTAPI_SystemConfiguration.h"
@@ -41,7 +43,8 @@ namespace OpenWifi {
RESTAPI_blacklist, RESTAPI_blacklist_list, RESTAPI_iptocountry_handler,
RESTAPI_radiusProxyConfig_handler, RESTAPI_scripts_handler, RESTAPI_script_handler,
RESTAPI_capabilities_handler, RESTAPI_telemetryWebSocket, RESTAPI_radiussessions_handler,
RESTAPI_regulatory>(Path, Bindings, L, S,
RESTAPI_regulatory, RESTAPI_default_firmwares,
RESTAPI_default_firmware>(Path, Bindings, L, S,
TransactionId);
}
@@ -55,6 +58,7 @@ namespace OpenWifi {
RESTAPI_commands, RESTAPI_ouis, RESTAPI_file, RESTAPI_blacklist,
RESTAPI_iptocountry_handler, RESTAPI_radiusProxyConfig_handler, RESTAPI_scripts_handler,
RESTAPI_script_handler, RESTAPI_blacklist_list, RESTAPI_radiussessions_handler,
RESTAPI_regulatory>(Path, Bindings, L, S, TransactionId);
RESTAPI_regulatory, RESTAPI_default_firmwares,
RESTAPI_default_firmware>(Path, Bindings, L, S, TransactionId);
}
} // namespace OpenWifi

View File

@@ -171,6 +171,31 @@ namespace OpenWifi::GWObjects {
field_to_json(Obj, "lastModified", LastModified);
}
void DefaultFirmware::to_json(Poco::JSON::Object &Obj) const {
field_to_json(Obj, "deviceType", deviceType);
field_to_json(Obj, "description", Description);
field_to_json(Obj, "uri", uri);
field_to_json(Obj, "revision", revision);
field_to_json(Obj, "imageCreationDate", imageCreationDate);
field_to_json(Obj, "created", Created);
field_to_json(Obj, "lastModified", LastModified);
}
bool DefaultFirmware::from_json(const Poco::JSON::Object::Ptr &Obj) {
try {
field_from_json(Obj, "deviceType", deviceType);
field_from_json(Obj, "description", Description);
field_from_json(Obj, "uri", uri);
field_from_json(Obj, "revision", revision);
field_from_json(Obj, "imageCreationDate", imageCreationDate);
field_from_json(Obj, "created", Created);
field_from_json(Obj, "lastModified", LastModified);
return true;
} catch (const Poco::Exception &E) {
}
return false;
}
void CommandDetails::to_json(Poco::JSON::Object &Obj) const {
EmbedDocument("details", Obj, Details);
EmbedDocument("results", Obj, Results);
@@ -405,6 +430,10 @@ namespace OpenWifi::GWObjects {
field_to_json(Obj, "acctConfig", acctConfig);
field_to_json(Obj, "coaConfig", coaConfig);
field_to_json(Obj, "useByDefault", useByDefault);
field_to_json(Obj, "radsecKeepAlive", radsecKeepAlive);
field_to_json(Obj, "poolProxyIp", poolProxyIp);
field_to_json(Obj, "radsecPoolType", radsecPoolType);
field_to_json(Obj, "enabled", enabled);
}
bool RadiusProxyPool::from_json(const Poco::JSON::Object::Ptr &Obj) {
@@ -415,6 +444,10 @@ namespace OpenWifi::GWObjects {
field_from_json(Obj, "acctConfig", acctConfig);
field_from_json(Obj, "coaConfig", coaConfig);
field_from_json(Obj, "useByDefault", useByDefault);
field_from_json(Obj, "radsecKeepAlive", radsecKeepAlive);
field_from_json(Obj, "poolProxyIp", poolProxyIp);
field_from_json(Obj, "radsecPoolType", radsecPoolType);
field_from_json(Obj, "enabled", enabled);
return true;
} catch (const Poco::Exception &E) {
}
@@ -633,18 +666,28 @@ namespace OpenWifi::GWObjects {
field_to_json(Obj, "interface", interface);
field_to_json(Obj, "secret", secret);
field_to_json(Obj, "nasId", nasId);
field_to_json(Obj, "calledStationId", calledStationId);
}
void RADIUSSessionList::to_json(Poco::JSON::Object &Obj) const {
field_to_json(Obj, "sessions", sessions);
}
void RadiusCoADMParameters::to_json(Poco::JSON::Object &Obj) const {
field_to_json(Obj, "accountingSessionId", accountingSessionId);
field_to_json(Obj, "accountingMultiSessionId", accountingMultiSessionId);
field_to_json(Obj, "callingStationId", callingStationId);
field_to_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
field_to_json(Obj, "userName", userName);
}
bool RadiusCoADMParameters::from_json(const Poco::JSON::Object::Ptr &Obj) {
try {
field_from_json(Obj, "accountingSessionId", accountingSessionId);
field_from_json(Obj, "accountingMultiSessionId", accountingMultiSessionId);
field_from_json(Obj, "callingStationId", callingStationId);
field_from_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
field_from_json(Obj, "userName", userName);
return true;
} catch (const Poco::Exception &E) {
}

View File

@@ -182,6 +182,26 @@ namespace OpenWifi::GWObjects {
bool from_json(const Poco::JSON::Object::Ptr &Obj);
};
struct DefaultFirmware {
std::string deviceType;
std::string Description;
std::string uri;
std::string revision;
uint64_t imageCreationDate;
uint64_t Created;
uint64_t LastModified;
void to_json(Poco::JSON::Object &Obj) const;
bool from_json(const Poco::JSON::Object::Ptr &Obj);
};
struct DefaultFirmwareList {
std::vector<DefaultFirmware> firmwares;
void to_json(Poco::JSON::Object &Obj) const;
bool from_json(const Poco::JSON::Object::Ptr &Obj);
};
struct CommandDetails {
std::string UUID;
std::string SerialNumber;
@@ -340,6 +360,10 @@ namespace OpenWifi::GWObjects {
RadiusProxyServerConfig acctConfig;
RadiusProxyServerConfig coaConfig;
bool useByDefault = false;
std::string radsecPoolType;
std::string poolProxyIp;
std::uint64_t radsecKeepAlive=25;
bool enabled=true;
void to_json(Poco::JSON::Object &Obj) const;
bool from_json(const Poco::JSON::Object::Ptr &Obj);
@@ -403,6 +427,7 @@ namespace OpenWifi::GWObjects {
inputGigaWords = 0,
outputGigaWords = 0;
std::uint32_t sessionTime = 0;
std::string calledStationId;
#ifdef TIP_GATEWAY_SERVICE
RADIUS::RadiusPacket accountingPacket;
@@ -420,9 +445,11 @@ namespace OpenWifi::GWObjects {
std::string accountingSessionId,
accountingMultiSessionId,
callingStationId,
chargeableUserIdentity;
chargeableUserIdentity,
userName;
bool from_json(const Poco::JSON::Object::Ptr &Obj);
void to_json(Poco::JSON::Object &Obj) const;
};
} // namespace OpenWifi::GWObjects

View File

@@ -175,6 +175,19 @@ namespace OpenWifi {
uint64_t GetDefaultConfigurationsCount();
bool DefaultConfigurationAlreadyExists(std::string &Name);
bool UpdateDefaultFirmware(GWObjects::DefaultFirmware &DefFirmware);
bool CreateDefaultFirmware(GWObjects::DefaultFirmware &DefConfig);
bool DeleteDefaultFirmware(std::string &name);
bool GetDefaultFirmware(std::string &name, GWObjects::DefaultFirmware &DefConfig);
bool GetDefaultFirmwares(uint64_t From, uint64_t HowMany,
std::vector<GWObjects::DefaultFirmware> &Devices);
bool FindDefaultFirmwareForModel(const std::string &Model,
GWObjects::DefaultFirmware &DefConfig);
uint64_t GetDefaultFirmwaresCount();
bool DefaultFirmwareAlreadyExists(std::string &Name);
bool AddCommand(std::string &SerialNumber, GWObjects::CommandDetails &Command,
CommandExecutionType Type);
bool GetCommands(std::string &SerialNumber, uint64_t FromDate, uint64_t ToDate,
@@ -242,6 +255,7 @@ namespace OpenWifi {
int Create_CommandList();
int Create_BlackList();
int Create_FileUploads();
int Create_DefaultFirmwares();
bool AnalyzeCommands(Types::CountedMap &R);
bool AnalyzeDevices(GWObjects::Dashboard &D);

View File

@@ -0,0 +1,66 @@
//
// Created by stephane bourque on 2023-07-12.
//
#pragma once
#include "framework/SubSystemServer.h"
#include "Poco/ExpireLRUCache.h"
#include "sdks/sdk_fms.h"
namespace OpenWifi {
class FirmwareRevisionCache : public SubSystemServer {
public:
static auto instance() {
static auto instance_ = new FirmwareRevisionCache;
return instance_;
}
inline int Start() override {
poco_notice(Logger(), "Starting...");
return 0;
}
inline void Stop() override {
poco_notice(Logger(), "Stopping...");
poco_notice(Logger(), "Stopped...");
}
inline bool DeviceMustUpgrade([[maybe_unused]] std::string &deviceType,
[[maybe_unused]] const std::string &firmware_string,
[[maybe_unused]] GWObjects::DefaultFirmware &Firmware) {
return false;
if(StorageService()->GetDefaultFirmware(deviceType,Firmware)) {
std::string key{ deviceType + Firmware.revision };
if(!Cache_.has(key)) {
FMSObjects::FirmwareAgeDetails FAD;
if(SDK::FMS::GetFirmwareAge(deviceType,Firmware.revision,FAD,Logger())) {
Cache_.add(key,FAD);
} else {
// if we cannot establish the age of the currently running firmware,
// then we assume it is too old.
return true;
}
}
auto FAD = Cache_.get(key);
if(FAD->imageDate < Firmware.imageCreationDate) {
return true;
}
}
return false;
}
private:
Poco::ExpireLRUCache<std::string, FMSObjects::FirmwareAgeDetails> Cache_{
512, 1200000};
FirmwareRevisionCache() noexcept
: SubSystemServer("FirmwareRevisionCache", "FWCACHE-SVR", "firmwarecache") {
}
};
inline auto FirmwareRevisionCache() { return FirmwareRevisionCache::instance(); }
} // namespace OpenWifi

View File

@@ -26,7 +26,7 @@ namespace OpenWifi {
Response.set("Connection", "keep-alive");
Response.setVersion(Poco::Net::HTTPMessage::HTTP_1_1);
std::ostream &Answer = Response.send();
Answer << "process Alive and kicking!";
Answer << ALBHealthCheckServer()->CallbackText();
} catch (...) {
}
}

View File

@@ -37,6 +37,8 @@ namespace OpenWifi {
inline static std::atomic_uint64_t req_id_ = 1;
};
typedef std::string ALBHealthMessageCallback();
class ALBHealthCheckServer : public SubSystemServer {
public:
ALBHealthCheckServer();
@@ -48,10 +50,22 @@ namespace OpenWifi {
int Start() override;
void Stop() override;
inline void RegisterExtendedHealthMessage(ALBHealthMessageCallback *F) {
Callback_=F;
};
inline std::string CallbackText() {
if(Callback_== nullptr) {
return "process Alive and kicking!";
} else {
return Callback_();
}
}
private:
std::unique_ptr<Poco::Net::HTTPServer> Server_;
std::unique_ptr<Poco::Net::ServerSocket> Socket_;
ALBHealthMessageCallback *Callback_= nullptr;
int Port_ = 0;
mutable std::atomic_bool Running_ = false;
};

View File

@@ -34,6 +34,10 @@ static std::string DefaultUCentralSchema = R"foo(
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"strict": {
"type": "boolean",
"default": false
},
"uuid": {
"type": "integer"
},
@@ -114,6 +118,20 @@ static std::string DefaultUCentralSchema = R"foo(
"random-password": {
"type": "boolean",
"default": false
},
"beacon-advertisement": {
"type": "object",
"properties": {
"device-name": {
"type": "boolean"
},
"device-serial": {
"type": "boolean"
},
"network-id": {
"type": "integer"
}
}
}
}
},
@@ -222,6 +240,52 @@ static std::string DefaultUCentralSchema = R"foo(
}
}
},
"interface.ssid.encryption": {
"type": "object",
"properties": {
"proto": {
"type": "string",
"enum": [
"none",
"owe",
"owe-transition",
"psk",
"psk2",
"psk-mixed",
"psk2-radius",
"wpa",
"wpa2",
"wpa-mixed",
"sae",
"sae-mixed",
"wpa3",
"wpa3-192",
"wpa3-mixed"
],
"examples": [
"psk2"
]
},
"key": {
"type": "string",
"maxLength": 63,
"minLength": 8
},
"ieee80211w": {
"type": "string",
"enum": [
"disabled",
"optional",
"required"
],
"default": "disabled"
},
"key-caching": {
"type": "boolean",
"default": true
}
}
},
"definitions": {
"type": "object",
"properties": {
@@ -716,7 +780,8 @@ static std::string DefaultUCentralSchema = R"foo(
"type": "string",
"enum": [
"dynamic",
"static"
"static",
"none"
],
"examples": [
"static"
@@ -1006,52 +1071,6 @@ static std::string DefaultUCentralSchema = R"foo(
}
]
},
"interface.ssid.encryption": {
"type": "object",
"properties": {
"proto": {
"type": "string",
"enum": [
"none",
"owe",
"owe-transition",
"psk",
"psk2",
"psk-mixed",
"psk2-radius",
"wpa",
"wpa2",
"wpa-mixed",
"sae",
"sae-mixed",
"wpa3",
"wpa3-192",
"wpa3-mixed"
],
"examples": [
"psk2"
]
},
"key": {
"type": "string",
"maxLength": 63,
"minLength": 8
},
"ieee80211w": {
"type": "string",
"enum": [
"disabled",
"optional",
"required"
],
"default": "disabled"
},
"key-caching": {
"type": "boolean",
"default": true
}
}
},
"interface.ssid.multi-psk": {
"type": "object",
"properties": {
@@ -2020,6 +2039,11 @@ static std::string DefaultUCentralSchema = R"foo(
"decription": "This option allows embedding custom vendor specific IEs inside the beacons of a BSS in AP mode.",
"type": "string"
},
"tip-information-element": {
"decription": "The device will broadcast the TIP vendor IE inside its beacons if this option is enabled.",
"type": "boolean",
"default": true
},
"fils-discovery-interval": {
"type": "integer",
"default": 20,
@@ -2235,6 +2259,17 @@ static std::string DefaultUCentralSchema = R"foo(
]
}
},
"vlan-awareness": {
"type": "object",
"properties": {
"first": {
"type": "integer"
},
"last": {
"type": "integer"
}
}
},
"vlan": {
"$ref": "#/$defs/interface.vlan"
},
@@ -2432,6 +2467,24 @@ static std::string DefaultUCentralSchema = R"foo(
"type": "boolean",
"default": false
},
"mode": {
"type": "string",
"enum": [
"radius",
"user"
]
},
"port-filter": {
"type": "array",
"items": {
"type": "string",
"examples": [
{
"LAN1": null
}
]
}
},
"server-certificate": {
"type": "string"
},
@@ -2443,6 +2496,77 @@ static std::string DefaultUCentralSchema = R"foo(
"items": {
"$ref": "#/$defs/interface.ssid.radius.local-user"
}
},
"radius": {
"type": "object",
"properties": {
"nas-identifier": {
"type": "string"
},
"auth-server-addr": {
"type": "string",
"format": "uc-host",
"examples": [
"192.168.1.10"
]
},
"auth-server-port": {
"type": "integer",
"maximum": 65535,
"minimum": 1024,
"examples": [
1812
]
},
"auth-server-secret": {
"type": "string",
"examples": [
"secret"
]
},
"acct-server-addr": {
"type": "string",
"format": "uc-host",
"examples": [
"192.168.1.10"
]
},
"acct-server-port": {
"type": "integer",
"maximum": 65535,
"minimum": 1024,
"examples": [
1813
]
},
"acct-server-secret": {
"type": "string",
"examples": [
"secret"
]
},
"coa-server-addr": {
"type": "string",
"format": "uc-host",
"examples": [
"192.168.1.10"
]
},
"coa-server-port": {
"type": "integer",
"maximum": 65535,
"minimum": 1024,
"examples": [
1814
]
},
"coa-server-secret": {
"type": "string",
"examples": [
"secret"
]
}
}
}
}
},
@@ -2766,6 +2890,12 @@ static std::string DefaultUCentralSchema = R"foo(
}
}
},
"services": {
"type": "array",
"items": {
"type": "string"
}
},
"classifier": {
"type": "array",
"items": {
@@ -3008,6 +3138,24 @@ static std::string DefaultUCentralSchema = R"foo(
"relay-server": {
"type": "string",
"format": "uc-ip"
},
"circuit-id-format": {
"type": "string",
"enum": [
"vlan-id",
"ap-mac",
"ssid"
],
"default": "vlan-id"
},
"remote-id-format": {
"type": "string",
"enum": [
"vlan-id",
"ap-mac",
"ssid"
],
"default": "ap-mac"
}
}
}

View File

@@ -14,18 +14,18 @@ namespace OpenWifi {
void EventBusManager::run() {
Running_ = true;
Utils::SetThreadName("fmwk:EventMgr");
auto Msg = std::make_shared<std::string>(MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_JOIN));
auto Msg = (MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_JOIN));
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg,
false);
while (Running_) {
Poco::Thread::trySleep((unsigned long)MicroServiceDaemonBusTimer());
if (!Running_)
break;
Msg = std::make_shared<std::string>(MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE));
Msg = (MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE));
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(),
Msg, false);
}
Msg = std::make_shared<std::string>(MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_LEAVE));
Msg = (MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_LEAVE));
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg,
false);
};

View File

@@ -6,6 +6,7 @@
#include "fmt/format.h"
#include "framework/MicroServiceFuncs.h"
#include "cppkafka/utils/consumer_dispatcher.h"
namespace OpenWifi {
@@ -99,9 +100,12 @@ namespace OpenWifi {
try {
auto Msg = dynamic_cast<KafkaMessage *>(Note.get());
if (Msg != nullptr) {
Producer.produce(cppkafka::MessageBuilder(Msg->Topic())
.key(Msg->Key())
.payload(Msg->Payload()));
auto NewMessage = cppkafka::MessageBuilder(Msg->Topic());
NewMessage.key(Msg->Key());
NewMessage.partition(0);
NewMessage.payload(Msg->Payload());
Producer.produce(NewMessage);
Producer.flush();
}
} catch (const cppkafka::HandleException &E) {
poco_warning(Logger_,
@@ -156,43 +160,49 @@ namespace OpenWifi {
}
});
bool AutoCommit = MicroServiceConfigGetBool("openwifi.kafka.auto.commit", false);
auto BatchSize = MicroServiceConfigGetInt("openwifi.kafka.consumer.batchsize", 20);
// bool AutoCommit = MicroServiceConfigGetBool("openwifi.kafka.auto.commit", false);
// auto BatchSize = MicroServiceConfigGetInt("openwifi.kafka.consumer.batchsize", 100);
Types::StringVec Topics;
KafkaManager()->Topics(Topics);
std::for_each(Topics_.begin(),Topics_.end(),
[&](const std::string & T) { Topics.emplace_back(T); });
Consumer.subscribe(Topics);
Running_ = true;
while (Running_) {
try {
std::vector<cppkafka::Message> MsgVec =
Consumer.poll_batch(BatchSize, std::chrono::milliseconds(100));
for (auto const &Msg : MsgVec) {
if (!Msg)
continue;
if (Msg.get_error()) {
if (!Msg.is_eof()) {
poco_error(Logger_,
fmt::format("Error: {}", Msg.get_error().to_string()));
std::vector<cppkafka::Message> MsgVec;
Dispatcher_ = std::make_unique<cppkafka::ConsumerDispatcher>(Consumer);
Dispatcher_->run(
// Callback executed whenever a new message is consumed
[&](cppkafka::Message msg) {
// Print the key (if any)
std::lock_guard G(ConsumerMutex_);
auto It = Notifiers_.find(msg.get_topic());
if (It != Notifiers_.end()) {
const auto &FL = It->second;
for (const auto &[CallbackFunc, _] : FL) {
try {
CallbackFunc(msg.get_key(), msg.get_payload());
} catch(const Poco::Exception &E) {
} catch(...) {
}
if (!AutoCommit)
Consumer.async_commit(Msg);
continue;
}
KafkaManager()->Dispatch(Msg.get_topic().c_str(), Msg.get_key(), std::make_shared<std::string>(Msg.get_payload()));
if (!AutoCommit)
Consumer.async_commit(Msg);
}
} catch (const cppkafka::HandleException &E) {
poco_warning(Logger_,
fmt::format("Caught a Kafka exception (consumer): {}", E.what()));
} catch (const Poco::Exception &E) {
Logger_.log(E);
} catch (...) {
poco_error(Logger_, "std::exception");
Consumer.commit(msg);
},
// Whenever there's an error (other than the EOF soft error)
[&Logger_](cppkafka::Error error) {
poco_warning(Logger_,fmt::format("Error: {}", error.to_string()));
},
// Whenever EOF is reached on a partition, print this
[&Logger_](cppkafka::ConsumerDispatcher::EndOfFile, const cppkafka::TopicPartition& topic_partition) {
poco_debug(Logger_,fmt::format("Partition {} EOF", topic_partition.get_partition()));
}
}
);
Consumer.unsubscribe();
poco_information(Logger_, "Stopped...");
}
@@ -213,14 +223,13 @@ namespace OpenWifi {
}
void KafkaProducer::Produce(const char *Topic, const std::string &Key,
const std::shared_ptr<std::string> Payload) {
const std::string &Payload) {
std::lock_guard G(Mutex_);
Queue_.enqueueNotification(new KafkaMessage(Topic, Key, Payload));
}
void KafkaConsumer::Start() {
if (!Running_) {
Running_ = true;
Worker_.start(*this);
}
}
@@ -228,29 +237,16 @@ namespace OpenWifi {
void KafkaConsumer::Stop() {
if (Running_) {
Running_ = false;
Worker_.wakeUp();
if(Dispatcher_) {
Dispatcher_->stop();
}
Worker_.join();
}
}
void KafkaDispatcher::Start() {
if (!Running_) {
Running_ = true;
Worker_.start(*this);
}
}
void KafkaDispatcher::Stop() {
if (Running_) {
Running_ = false;
Queue_.wakeUpAll();
Worker_.join();
}
}
auto KafkaDispatcher::RegisterTopicWatcher(const std::string &Topic,
std::uint64_t KafkaConsumer::RegisterTopicWatcher(const std::string &Topic,
Types::TopicNotifyFunction &F) {
std::lock_guard G(Mutex_);
std::lock_guard G(ConsumerMutex_);
auto It = Notifiers_.find(Topic);
if (It == Notifiers_.end()) {
Types::TopicNotifyFunctionList L;
@@ -259,11 +255,12 @@ namespace OpenWifi {
} else {
It->second.emplace(It->second.end(), std::make_pair(F, FunctionId_));
}
Topics_.insert(Topic);
return FunctionId_++;
}
void KafkaDispatcher::UnregisterTopicWatcher(const std::string &Topic, int Id) {
std::lock_guard G(Mutex_);
void KafkaConsumer::UnregisterTopicWatcher(const std::string &Topic, int Id) {
std::lock_guard G(ConsumerMutex_);
auto It = Notifiers_.find(Topic);
if (It != Notifiers_.end()) {
Types::TopicNotifyFunctionList &L = It->second;
@@ -275,56 +272,17 @@ namespace OpenWifi {
}
}
void KafkaDispatcher::Dispatch(const char *Topic, const std::string &Key,
const std::shared_ptr<std::string> Payload) {
std::lock_guard G(Mutex_);
auto It = Notifiers_.find(Topic);
if (It != Notifiers_.end()) {
Queue_.enqueueNotification(new KafkaMessage(Topic, Key, Payload));
}
}
void KafkaDispatcher::run() {
Poco::Logger &Logger_ =
Poco::Logger::create("KAFKA-DISPATCHER", KafkaManager()->Logger().getChannel());
poco_information(Logger_, "Starting...");
Poco::AutoPtr<Poco::Notification> Note(Queue_.waitDequeueNotification());
Utils::SetThreadName("kafka:dispatch");
while (Note && Running_) {
auto Msg = dynamic_cast<KafkaMessage *>(Note.get());
if (Msg != nullptr) {
auto It = Notifiers_.find(Msg->Topic());
if (It != Notifiers_.end()) {
const auto &FL = It->second;
for (const auto &[CallbackFunc, _] : FL) {
CallbackFunc(Msg->Key(), Msg->Payload());
}
}
}
Note = Queue_.waitDequeueNotification();
}
poco_information(Logger_, "Stopped...");
}
void KafkaDispatcher::Topics(std::vector<std::string> &T) {
T.clear();
for (const auto &[TopicName, _] : Notifiers_)
T.push_back(TopicName);
}
int KafkaManager::Start() {
if (!KafkaEnabled_)
return 0;
ConsumerThr_.Start();
ProducerThr_.Start();
Dispatcher_.Start();
return 0;
}
void KafkaManager::Stop() {
if (KafkaEnabled_) {
poco_information(Logger(), "Stopping...");
Dispatcher_.Stop();
ProducerThr_.Stop();
ConsumerThr_.Stop();
poco_information(Logger(), "Stopped...");
@@ -333,39 +291,28 @@ namespace OpenWifi {
}
void KafkaManager::PostMessage(const char *topic, const std::string &key,
const std::shared_ptr<std::string> PayLoad, bool WrapMessage) {
const std::string & PayLoad, bool WrapMessage) {
if (KafkaEnabled_) {
ProducerThr_.Produce(topic, key, WrapMessage ? WrapSystemId(PayLoad) : PayLoad);
}
}
void KafkaManager::Dispatch(const char *Topic, const std::string &Key,
const std::shared_ptr<std::string> Payload) {
Dispatcher_.Dispatch(Topic, Key, Payload);
}
[[nodiscard]] const std::shared_ptr<std::string> KafkaManager::WrapSystemId(const std::shared_ptr<std::string> PayLoad) {
*PayLoad = SystemInfoWrapper_ + *PayLoad + "}";
return PayLoad;
}
uint64_t KafkaManager::RegisterTopicWatcher(const std::string &Topic,
Types::TopicNotifyFunction &F) {
void KafkaManager::PostMessage(const char *topic, const std::string &key,
const Poco::JSON::Object &Object, bool WrapMessage) {
if (KafkaEnabled_) {
return Dispatcher_.RegisterTopicWatcher(Topic, F);
} else {
return 0;
std::ostringstream ObjectStr;
Object.stringify(ObjectStr);
ProducerThr_.Produce(topic, key, WrapMessage ? WrapSystemId(ObjectStr.str()) : ObjectStr.str());
}
}
void KafkaManager::UnregisterTopicWatcher(const std::string &Topic, uint64_t Id) {
if (KafkaEnabled_) {
Dispatcher_.UnregisterTopicWatcher(Topic, Id);
}
[[nodiscard]] std::string KafkaManager::WrapSystemId(const std::string & PayLoad) {
return fmt::format( R"lit({{ "system" : {{ "id" : {},
"host" : "{}" }},
"payload" : {} }})lit", MicroServiceID(),
MicroServicePrivateEndPoint(), PayLoad ) ;
}
void KafkaManager::Topics(std::vector<std::string> &T) { Dispatcher_.Topics(T); }
void KafkaManager::PartitionAssignment(const cppkafka::TopicPartitionList &partitions) {
poco_information(
Logger(), fmt::format("Partition assigned: {}...", partitions.front().get_partition()));

View File

@@ -6,7 +6,7 @@
#include "Poco/Notification.h"
#include "Poco/NotificationQueue.h"
#include "Poco/JSON/Object.h"
#include "framework/KafkaTopics.h"
#include "framework/OpenWifiTypes.h"
#include "framework/SubSystemServer.h"
@@ -18,17 +18,17 @@ namespace OpenWifi {
class KafkaMessage : public Poco::Notification {
public:
KafkaMessage(const char * Topic, const std::string &Key, const std::shared_ptr<std::string> Payload)
: Topic_(Topic), Key_(Key), Payload_(std::move(Payload)) {}
KafkaMessage(const char * Topic, const std::string &Key, const std::string &Payload)
: Topic_(Topic), Key_(Key), Payload_(Payload) {}
inline const char * Topic() { return Topic_; }
inline const std::string &Key() { return Key_; }
inline const std::string &Payload() { return *Payload_; }
inline const std::string &Payload() { return Payload_; }
private:
const char *Topic_;
std::string Key_;
std::shared_ptr<std::string> Payload_;
std::string Payload_;
};
class KafkaProducer : public Poco::Runnable {
@@ -36,10 +36,10 @@ namespace OpenWifi {
void run() override;
void Start();
void Stop();
void Produce(const char *Topic, const std::string &Key, const std::shared_ptr<std::string> Payload);
void Produce(const char *Topic, const std::string &Key, const std::string & Payload);
private:
std::recursive_mutex Mutex_;
std::mutex Mutex_;
Poco::Thread Worker_;
mutable std::atomic_bool Running_ = false;
Poco::NotificationQueue Queue_;
@@ -47,33 +47,22 @@ namespace OpenWifi {
class KafkaConsumer : public Poco::Runnable {
public:
void run() override;
void Start();
void Stop();
private:
std::recursive_mutex Mutex_;
Poco::Thread Worker_;
std::mutex ConsumerMutex_;
Types::NotifyTable Notifiers_;
Poco::Thread Worker_;
mutable std::atomic_bool Running_ = false;
};
uint64_t FunctionId_ = 1;
std::unique_ptr<cppkafka::ConsumerDispatcher> Dispatcher_;
std::set<std::string> Topics_;
class KafkaDispatcher : public Poco::Runnable {
public:
void Start();
void Stop();
auto RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F);
void run() override;
friend class KafkaManager;
std::uint64_t RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F);
void UnregisterTopicWatcher(const std::string &Topic, int Id);
void Dispatch(const char *Topic, const std::string &Key, const std::shared_ptr<std::string> Payload);
void run() override;
void Topics(std::vector<std::string> &T);
private:
std::recursive_mutex Mutex_;
Types::NotifyTable Notifiers_;
Poco::Thread Worker_;
mutable std::atomic_bool Running_ = false;
uint64_t FunctionId_ = 1;
Poco::NotificationQueue Queue_;
};
class KafkaManager : public SubSystemServer {
@@ -92,20 +81,24 @@ namespace OpenWifi {
void Stop() override;
void PostMessage(const char *topic, const std::string &key,
const std::shared_ptr<std::string> PayLoad, bool WrapMessage = true);
void Dispatch(const char *Topic, const std::string &Key, const std::shared_ptr<std::string> Payload);
[[nodiscard]] const std::shared_ptr<std::string> WrapSystemId(const std::shared_ptr<std::string> PayLoad);
const std::string &PayLoad, bool WrapMessage = true);
void PostMessage(const char *topic, const std::string &key,
const Poco::JSON::Object &Object, bool WrapMessage = true);
[[nodiscard]] std::string WrapSystemId(const std::string & PayLoad);
[[nodiscard]] inline bool Enabled() const { return KafkaEnabled_; }
uint64_t RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F);
void UnregisterTopicWatcher(const std::string &Topic, uint64_t Id);
void Topics(std::vector<std::string> &T);
inline std::uint64_t RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F) {
return ConsumerThr_.RegisterTopicWatcher(Topic,F);
}
inline void UnregisterTopicWatcher(const std::string &Topic, uint64_t Id) {
return ConsumerThr_.UnregisterTopicWatcher(Topic,Id);
}
private:
bool KafkaEnabled_ = false;
std::string SystemInfoWrapper_;
KafkaProducer ProducerThr_;
KafkaConsumer ConsumerThr_;
KafkaDispatcher Dispatcher_;
void PartitionAssignment(const cppkafka::TopicPartitionList &partitions);
void PartitionRevocation(const cppkafka::TopicPartitionList &partitions);

View File

@@ -129,6 +129,8 @@ namespace OpenWifi {
}
} else {
poco_error(logger(), "Bad bus message.");
std::ostringstream os;
Object->stringify(std::cout);
}
auto i = Services_.begin();

View File

@@ -5,6 +5,8 @@
#include "framework/MicroServiceFuncs.h"
#include "framework/MicroService.h"
#include "framework/ALBserver.h"
namespace OpenWifi {
const std::string &MicroServiceDataDirectory() { return MicroService::instance().DataDir(); }
@@ -123,4 +125,8 @@ namespace OpenWifi {
return MicroService::instance().AllowExternalMicroServices();
}
void MicroServiceALBCallback( std::string Callback()) {
return ALBHealthCheckServer()->RegisterExtendedHealthMessage(Callback);
}
} // namespace OpenWifi

View File

@@ -53,4 +53,5 @@ namespace OpenWifi {
std::string MicroServiceGetPublicAPIEndPoint();
void MicroServiceDeleteOverrideConfiguration();
bool AllowExternalMicroServices();
void MicroServiceALBCallback( std::string Callback());
} // namespace OpenWifi

View File

@@ -28,6 +28,9 @@ namespace OpenWifi::Types {
typedef std::string UUID_t;
typedef std::vector<UUID_t> UUIDvec_t;
typedef std::map<std::string, std::map<uint32_t, uint64_t>> Counted3DMapSII;
typedef std::vector<int64_t> IntList;
typedef std::vector<uint64_t> UIntList;
typedef std::vector<double> DoubleList;
struct MicroServiceMeta {
uint64_t Id = 0;

View File

@@ -574,7 +574,37 @@ namespace OpenWifi {
Poco::JSON::Stringifier::stringify(Object, Answer);
}
inline void ReturnRawJSON(const std::string &json_doc) {
inline void ReturnObject(const std::vector<std::string> &Strings) {
Poco::JSON::Array Arr;
for(const auto &String:Strings) {
Arr.add(String);
}
std::ostringstream os;
Arr.stringify(os);
return ReturnRawJSON(os.str());
}
template<class T> void ReturnObject(const std::vector<T> &Objects) {
Poco::JSON::Array Arr;
for(const auto &Object:Objects) {
Poco::JSON::Object O;
Object.to_json(O);
Arr.add(O);
}
std::ostringstream os;
Arr.stringify(os);
return ReturnRawJSON(os.str());
}
template<class T> void ReturnObject(const T &Object) {
Poco::JSON::Object O;
Object.to_json(O);
std::ostringstream os;
O.stringify(os);
return ReturnRawJSON(os.str());
}
inline void ReturnRawJSON(const std::string &json_doc) {
PrepareResponse();
if (Request != nullptr) {
// can we compress ???

View File

@@ -24,50 +24,63 @@ namespace OpenWifi {
Server, TransactionId, Internal) {}
static auto PathName() { return std::list<std::string>{"/api/v1/system"}; }
inline void DoGet() {
inline void DoGet() final {
std::string Arg;
if (HasParameter("command", Arg) && Arg == "info") {
Poco::JSON::Object Answer;
Answer.set(RESTAPI::Protocol::VERSION, MicroServiceVersion());
Answer.set(RESTAPI::Protocol::UPTIME, MicroServiceUptimeTotalSeconds());
Answer.set(RESTAPI::Protocol::START, MicroServiceStartTimeEpochTime());
Answer.set(RESTAPI::Protocol::OS, Poco::Environment::osName());
Answer.set(RESTAPI::Protocol::PROCESSORS, Poco::Environment::processorCount());
Answer.set(RESTAPI::Protocol::HOSTNAME, Poco::Environment::nodeName());
Answer.set(RESTAPI::Protocol::UI, MicroServiceGetUIURI());
if (HasParameter("command", Arg)) {
if (Arg == "info") {
Poco::JSON::Object Answer;
Answer.set(RESTAPI::Protocol::VERSION, MicroServiceVersion());
Answer.set(RESTAPI::Protocol::UPTIME, MicroServiceUptimeTotalSeconds());
Answer.set(RESTAPI::Protocol::START, MicroServiceStartTimeEpochTime());
Answer.set(RESTAPI::Protocol::OS, Poco::Environment::osName());
Answer.set(RESTAPI::Protocol::PROCESSORS, Poco::Environment::processorCount());
Answer.set(RESTAPI::Protocol::HOSTNAME, Poco::Environment::nodeName());
Answer.set(RESTAPI::Protocol::UI, MicroServiceGetUIURI());
Poco::JSON::Array Certificates;
auto SubSystems = MicroServiceGetFullSubSystems();
std::set<std::string> CertNames;
Poco::JSON::Array Certificates;
auto SubSystems = MicroServiceGetFullSubSystems();
std::set<std::string> CertNames;
for (const auto &i : SubSystems) {
auto Hosts = i->HostSize();
for (uint64_t j = 0; j < Hosts; ++j) {
auto CertFileName = i->Host(j).CertFile();
if (!CertFileName.empty()) {
Poco::File F1(CertFileName);
if (F1.exists()) {
auto InsertResult = CertNames.insert(CertFileName);
if (InsertResult.second) {
Poco::JSON::Object Inner;
Poco::Path F(CertFileName);
Inner.set("filename", F.getFileName());
Poco::Crypto::X509Certificate C(CertFileName);
auto ExpiresOn = C.expiresOn();
Inner.set("expiresOn", ExpiresOn.timestamp().epochTime());
Certificates.add(Inner);
for (const auto &i : SubSystems) {
auto Hosts = i->HostSize();
for (uint64_t j = 0; j < Hosts; ++j) {
auto CertFileName = i->Host(j).CertFile();
if (!CertFileName.empty()) {
Poco::File F1(CertFileName);
if (F1.exists()) {
auto InsertResult = CertNames.insert(CertFileName);
if (InsertResult.second) {
Poco::JSON::Object Inner;
Poco::Path F(CertFileName);
Inner.set("filename", F.getFileName());
Poco::Crypto::X509Certificate C(CertFileName);
auto ExpiresOn = C.expiresOn();
Inner.set("expiresOn", ExpiresOn.timestamp().epochTime());
Certificates.add(Inner);
}
}
}
}
}
Answer.set("certificates", Certificates);
return ReturnObject(Answer);
}
if (Arg == "extraConfiguration") {
Poco::JSON::Object Answer;
MicroServiceGetExtraConfiguration(Answer);
return ReturnObject(Answer);
}
if (Arg == "resources") {
Poco::JSON::Object Answer;
Answer.set("numberOfFileDescriptors", Utils::get_open_fds());
std::uint64_t currRealMem, peakRealMem, currVirtMem, peakVirtMem;
Utils::getMemory(currRealMem, peakRealMem, currVirtMem, peakVirtMem);
Answer.set("currRealMem", currRealMem);
Answer.set("peakRealMem", peakRealMem);
Answer.set("currVirtMem", currVirtMem);
Answer.set("peakVirtMem", peakVirtMem);
return ReturnObject(Answer);
}
Answer.set("certificates", Certificates);
return ReturnObject(Answer);
}
if (GetBoolParameter("extraConfiguration")) {
Poco::JSON::Object Answer;
MicroServiceGetExtraConfiguration(Answer);
return ReturnObject(Answer);
}
BadRequest(RESTAPI::Errors::InvalidCommand);
}

View File

@@ -102,6 +102,20 @@ namespace OpenWifi::RESTAPI_utils {
Obj.set(Field, A);
}
inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, const Types::DoubleList &V) {
Poco::JSON::Array A;
for (const auto &i : V)
A.add(i);
Obj.set(Field, A);
}
inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, const Types::IntList &V) {
Poco::JSON::Array A;
for (const auto &i : V)
A.add(i);
Obj.set(Field, A);
}
inline void field_to_json(Poco::JSON::Object &Obj, const char *Field, const Types::TagList &V) {
Poco::JSON::Array A;
for (const auto &i : V)
@@ -284,6 +298,28 @@ namespace OpenWifi::RESTAPI_utils {
}
}
inline void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field,
Types::DoubleList &Value) {
if (Obj->isArray(Field) && !Obj->isNull(Field)) {
Value.clear();
Poco::JSON::Array::Ptr A = Obj->getArray(Field);
for (const auto &i : *A) {
Value.push_back(i);
}
}
}
inline void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field,
Types::IntList &Value) {
if (Obj->isArray(Field) && !Obj->isNull(Field)) {
Value.clear();
Poco::JSON::Array::Ptr A = Obj->getArray(Field);
for (const auto &i : *A) {
Value.push_back(i);
}
}
}
template <class T>
void field_from_json(const Poco::JSON::Object::Ptr &Obj, const char *Field,
std::vector<T> &Value) {

View File

@@ -22,9 +22,8 @@ namespace OpenWifi {
class StorageClass : public SubSystemServer {
public:
StorageClass() noexcept : SubSystemServer("StorageClass", "STORAGE-SVR", "storage") {}
int Start() override {
inline int Start() override {
std::lock_guard Guard(Mutex_);
Logger().notice("Starting.");
@@ -40,17 +39,22 @@ namespace OpenWifi {
return 0;
}
void Stop() override { Pool_->shutdown(); }
inline void Stop() override { Pool_->shutdown(); }
DBType Type() const { return dbType_; };
StorageClass() noexcept : SubSystemServer("StorageClass", "STORAGE-SVR", "storage") {
}
private:
inline int Setup_SQLite();
inline int Setup_MySQL();
inline int Setup_PostgreSQL();
protected:
std::unique_ptr<Poco::Data::SessionPool> Pool_;
protected:
std::shared_ptr<Poco::Data::SessionPool> Pool_;
Poco::Data::SQLite::Connector SQLiteConn_;
Poco::Data::PostgreSQL::Connector PostgresConn_;
Poco::Data::MySQL::Connector MySQLConn_;
@@ -81,7 +85,7 @@ namespace OpenWifi {
// Poco::Data::SessionPool(SQLiteConn_.name(), DBName, 8,
// (int)NumSessions,
// (int)IdleTime));
Pool_ = std::make_unique<Poco::Data::SessionPool>(SQLiteConn_.name(), DBName, 8,
Pool_ = std::make_shared<Poco::Data::SessionPool>(SQLiteConn_.name(), DBName, 8,
(int)NumSessions, (int)IdleTime);
return 0;
}
@@ -102,7 +106,7 @@ namespace OpenWifi {
";compress=true;auto-reconnect=true";
Poco::Data::MySQL::Connector::registerConnector();
Pool_ = std::make_unique<Poco::Data::SessionPool>(MySQLConn_.name(), ConnectionStr, 8,
Pool_ = std::make_shared<Poco::Data::SessionPool>(MySQLConn_.name(), ConnectionStr, 8,
NumSessions, IdleTime);
return 0;
@@ -126,7 +130,7 @@ namespace OpenWifi {
" connect_timeout=" + ConnectionTimeout;
Poco::Data::PostgreSQL::Connector::registerConnector();
Pool_ = std::make_unique<Poco::Data::SessionPool>(PostgresConn_.name(), ConnectionStr, 8,
Pool_ = std::make_shared<Poco::Data::SessionPool>(PostgresConn_.name(), ConnectionStr, 8,
NumSessions, IdleTime);
return 0;

View File

@@ -37,6 +37,7 @@ namespace OpenWifi {
P.cipherList = "ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH";
P.dhUse2048Bits = true;
P.caLocation = cas_;
// P.securityLevel =
auto Context = Poco::AutoPtr<Poco::Net::Context>(
new Poco::Net::Context(Poco::Net::Context::TLS_SERVER_USE, P));
@@ -53,7 +54,6 @@ namespace OpenWifi {
Context->useCertificate(Cert);
Context->addChainCertificate(Root);
Context->addCertificateAuthority(Root);
if (level_ == Poco::Net::Context::VERIFY_STRICT) {
@@ -76,18 +76,18 @@ namespace OpenWifi {
L.fatal(fmt::format("Wrong Certificate({}) for Key({})", cert_file_, key_file_));
}
SSL_CTX_set_verify(SSLCtx, SSL_VERIFY_PEER, nullptr);
SSL_CTX_set_verify(SSLCtx, level_==Poco::Net::Context::VERIFY_NONE ? SSL_VERIFY_NONE : SSL_VERIFY_PEER, nullptr);
if (level_ == Poco::Net::Context::VERIFY_STRICT) {
SSL_CTX_set_client_CA_list(SSLCtx, SSL_load_client_CA_file(client_cas_.c_str()));
SSL_CTX_enable_ct(SSLCtx, SSL_CT_VALIDATION_STRICT);
}
SSL_CTX_enable_ct(SSLCtx, SSL_CT_VALIDATION_STRICT);
SSL_CTX_dane_enable(SSLCtx);
Context->enableSessionCache();
Context->setSessionCacheSize(0);
Context->setSessionTimeout(60);
Context->enableExtendedCertificateVerification(true);
Context->enableExtendedCertificateVerification( level_!= Poco::Net::Context::VERIFY_NONE );
Context->disableStatelessSessionResumption();
}

View File

@@ -40,6 +40,7 @@ namespace OpenWifi {
};
}
#define DBGLINE std::cout << __LINE__ << ":" << __FILE__ << ", " << __func__ << std::endl;
namespace OpenWifi::RESTAPI::Errors {
struct msg {
uint64_t err_num;
@@ -401,6 +402,23 @@ namespace OpenWifi::RESTAPI::Errors {
1171, "Command not supported on simulated device."
};
static const struct msg VenuesNameAlreadyExists {
1172, "The venue name already exists."
};
static const struct msg InvalidGlobalReachAccount {
1173, "Invalid Global Reach account information."
};
static const struct msg CannotCreateCSR {
1174, "Cannot create a CSR certificate."
};
static const struct msg DefFirmwareNameExists { 1175, "Firmware name already exists." };
static const struct msg NotAValidECKey { 1176, "Not a valid Signing Key." };
static const struct msg NotAValidRadiusPoolType { 1177, "Not a valid RADIUS pool type." };
static const struct msg SimulationDoesNotExist {
7000, "Simulation Instance ID does not exist."
};

View File

@@ -3,10 +3,17 @@
//
#include "Poco/Path.h"
#include "Poco/TemporaryFile.h"
#include "Poco/Crypto/ECKey.h"
#include "framework/AppServiceRegistry.h"
#include "framework/utils.h"
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <string>
#include <algorithm>
namespace OpenWifi::Utils {
bool NormalizeMac(std::string &Mac) {
@@ -132,6 +139,15 @@ namespace OpenWifi::Utils {
return std::regex_match(Hostname, HostNameRegex);
}
[[nodiscard]] bool ValidNumber(const std::string &number, bool isSigned)
{
static std::regex IntRegex("^-?[0-9]\\d*(\\.\\d+)?$");
if(!isSigned) {
IntRegex = "^[0-9]\\d*(\\.\\d+)?$";
}
return std::regex_match(number, IntRegex);
}
[[nodiscard]] std::string ToHex(const std::vector<unsigned char> &B) {
std::string R;
R.reserve(B.size() * 2);
@@ -599,4 +615,251 @@ namespace OpenWifi::Utils {
return DT.timestamp().epochTime();
}
static std::string FileToString(const std::string &Filename) {
std::ifstream ifs(Filename.c_str(),std::ios_base::in|std::ios_base::binary);
std::ostringstream os;
Poco::StreamCopier::copyStream(ifs,os);
return os.str();
}
bool CreateX509CSR(const CSRCreationParameters & Parameters, CSRCreationResults & Results) {
int ret = 0;
RSA *r = nullptr;
BIGNUM *bne = nullptr;
int nVersion = 0;
unsigned long e = RSA_F4;
X509_REQ *x509_req = nullptr;
X509_NAME *x509_name = nullptr;
EVP_PKEY *pKey = nullptr;
// RSA *tem = nullptr;
// BIO *bio_err = nullptr;
const char *szCountry = Parameters.Country.c_str();
const char *szProvince = Parameters.Province.c_str();
const char *szCity = Parameters.City.c_str();
const char *szOrganization = Parameters.Organization.c_str();
const char *szCommon = Parameters.CommonName.c_str();
Poco::TemporaryFile CsrPath, PubKey, PrivateKey;
std::string Result;
std::ifstream ifs;
std::ostringstream ss;
BIO *bp_public = nullptr,
*bp_private = nullptr,
*bp_csr = nullptr;
// 1. generate rsa key
bne = BN_new();
ret = BN_set_word(bne,e);
if(ret != 1){
goto free_all;
}
r = RSA_new();
ret = RSA_generate_key_ex(r, Parameters.bits, bne, nullptr);
if(ret != 1){
goto free_all;
}
bp_public = BIO_new_file(PubKey.path().c_str(), "w+");
ret = PEM_write_bio_RSAPublicKey(bp_public, r);
if(ret != 1) {
goto free_all;
}
bp_private = BIO_new_file(PrivateKey.path().c_str(), "w+");
ret = PEM_write_bio_RSAPrivateKey(bp_private, r, NULL, NULL, 0, NULL, NULL);
if(ret != 1) {
goto free_all;
}
// 2. set version of x509 req
x509_req = X509_REQ_new();
ret = X509_REQ_set_version(x509_req, nVersion);
if (ret != 1){
goto free_all;
}
// 3. set subject of x509 req
x509_name = X509_REQ_get_subject_name(x509_req);
ret = X509_NAME_add_entry_by_txt(x509_name,"C", MBSTRING_ASC, (const unsigned char*)szCountry, -1, -1, 0);
if (ret != 1){
goto free_all;
}
ret = X509_NAME_add_entry_by_txt(x509_name,"ST", MBSTRING_ASC, (const unsigned char*)szProvince, -1, -1, 0);
if (ret != 1){
goto free_all;
}
ret = X509_NAME_add_entry_by_txt(x509_name,"L", MBSTRING_ASC, (const unsigned char*)szCity, -1, -1, 0);
if (ret != 1){
goto free_all;
}
ret = X509_NAME_add_entry_by_txt(x509_name,"O", MBSTRING_ASC, (const unsigned char*)szOrganization, -1, -1, 0);
if (ret != 1){
goto free_all;
}
ret = X509_NAME_add_entry_by_txt(x509_name,"CN", MBSTRING_ASC, (const unsigned char*)szCommon, -1, -1, 0);
if (ret != 1){
goto free_all;
}
// 4. set public key of x509 req
pKey = EVP_PKEY_new();
EVP_PKEY_assign_RSA(pKey, r);
r = nullptr; // will be free rsa when EVP_PKEY_free(pKey)
ret = X509_REQ_set_pubkey(x509_req, pKey);
if (ret != 1){
goto free_all;
}
// 5. set sign key of x509 req
ret = X509_REQ_sign(x509_req, pKey, EVP_sha1()); // return x509_req->signature->length
if (ret <= 0){
goto free_all;
}
bp_csr = BIO_new_file(CsrPath.path().c_str(),"w");
ret = PEM_write_bio_X509_REQ(bp_csr, x509_req);
// 6. free
free_all:
X509_REQ_free(x509_req);
BIO_free_all(bp_csr);
BIO_free_all(bp_public);
BIO_free_all(bp_private);
EVP_PKEY_free(pKey);
BN_free(bne);
if(ret==1) {
Results.CSR = FileToString(CsrPath.path());
Results.PrivateKey = FileToString(PrivateKey.path());
Results.PublicKey = FileToString(PubKey.path());
}
return ret;
}
bool VerifyECKey(const std::string &key) {
try {
Poco::TemporaryFile F;
std::ofstream of(F.path().c_str(), std::ios_base::trunc | std::ios_base::out | std::ios_base::binary);
of << key;
of.close();
auto Key = Poco::SharedPtr<Poco::Crypto::ECKey>(
new Poco::Crypto::ECKey("", F.path(),""));
return true;
} catch (const Poco::Exception &E) {
}
return false;
}
bool VerifyRSAKey([[
maybe_unused]] const std::string &key) {
try {
Poco::TemporaryFile F;
std::ofstream of(F.path().c_str(), std::ios_base::trunc | std::ios_base::out | std::ios_base::binary);
of << key;
of.close();
auto Key = Poco::SharedPtr<Poco::Crypto::RSAKey>(
new Poco::Crypto::RSAKey("", F.path(),""));
return true;
} catch (const Poco::Exception &E) {
}
return false;
}
bool ValidX509Certificate([[
maybe_unused]] const std::string &Cert) {
try {
Poco::TemporaryFile F;
std::ofstream of(F.path().c_str(), std::ios_base::trunc | std::ios_base::out | std::ios_base::binary);
of << Cert;
of.close();
auto Key = Poco::SharedPtr<Poco::Crypto::X509Certificate>(
new Poco::Crypto::X509Certificate(F.path()));
return true;
} catch (const Poco::Exception &E) {
}
return false;
}
bool ValidX509Certificate([[
maybe_unused]] const std::vector<std::string> &Certs) {
auto F = [](const std::string &C) -> bool { return ValidX509Certificate(C); };
return std::all_of(Certs.begin(),Certs.end(), F);
}
std::string generateStrongPassword(int minLength, int maxLength, int numDigits, int minLowercase, int minSpecial, int minUppercase) {
// Define character sets for each category
const std::string lowercaseChars = "abcdefghijklmnopqrstuvwxyz";
const std::string uppercaseChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const std::string digitChars = "0123456789";
const std::string specialChars = "!@#$%^&*()_+[]{}|;:,.<>?";
// Check if parameters are valid
if (minLength < 1 || minLength > maxLength || minLowercase + minUppercase + numDigits + minSpecial > maxLength) {
return "Invalid parameters";
}
// Initialize random seed
std::random_device rd;
std::mt19937 g(rd());
// Initialize the password string
std::string password;
// Generate the required number of each character type
for (int i = 0; i < minLowercase; ++i) {
password += lowercaseChars[g() % lowercaseChars.length()];
}
for (int i = 0; i < minUppercase; ++i) {
password += uppercaseChars[g() % uppercaseChars.length()];
}
for (int i = 0; i < numDigits; ++i) {
password += digitChars[g() % digitChars.length()];
}
for (int i = 0; i < minSpecial; ++i) {
password += specialChars[g() % specialChars.length()];
}
// Calculate how many more characters are needed
int remainingLength = maxLength - (int)password.length();
// Generate random characters to fill the remaining length
for (int i = 0; i < remainingLength; ++i) {
int category = g() % 4; // Randomly select a category
if (category == 0) {
password += lowercaseChars[g() % lowercaseChars.length()];
} else if (category == 1) {
password += uppercaseChars[g() % uppercaseChars.length()];
} else if (category == 2) {
password += digitChars[g() % digitChars.length()];
} else {
password += specialChars[g() % specialChars.length()];
}
}
// Shuffle the password to randomize the character order
std::shuffle(password.begin(), password.end(),g);
return password;
}
} // namespace OpenWifi::Utils

View File

@@ -13,6 +13,8 @@
#include <string>
#include <thread>
#include <dirent.h>
#include "Poco/Base64Decoder.h"
#include "Poco/Base64Encoder.h"
#include "Poco/File.h"
@@ -71,6 +73,7 @@ namespace OpenWifi::Utils {
[[nodiscard]] bool ValidSerialNumbers(const std::vector<std::string> &Serial);
[[nodiscard]] bool ValidUUID(const std::string &UUID);
[[nodiscard]] bool ValidHostname(const std::string &hostname);
[[nodiscard]] bool ValidNumber(const std::string &number, bool isSigned);
template <typename... Args> std::string ComputeHash(Args &&...args) {
Poco::SHA2Engine E;
@@ -181,4 +184,84 @@ namespace OpenWifi::Utils {
return false;
}
static inline std::uint64_t GetValue(FILE *file) {
unsigned long v=0;
char factor[32];
if(fscanf(file, " %lu %31s", &v, factor)==2) {
switch (factor[0]) {
case 'k':
return v * 1000;
case 'M':
return v * 1000000;
case 'G':
return v * 1000000000;
}
}
return v;
}
inline bool getMemory(
std::uint64_t &currRealMem, std::uint64_t &peakRealMem,
std::uint64_t &currVirtMem, std::uint64_t &peakVirtMem) {
// stores each word in status file
char buffer[1024] = "";
currRealMem = peakRealMem = currVirtMem = peakVirtMem = 0;
// linux file contains this-process info
FILE * file = std::fopen("/proc/self/status", "r");
if (file == nullptr) {
return false;
}
// read the entire file, recording mems in kB
while (fscanf(file, " %1023s", buffer) == 1) {
if (strcmp(buffer, "VmRSS:") == 0) {
currRealMem= GetValue(file);
} else if (strcmp(buffer, "VmHWM:") == 0) {
peakRealMem= GetValue(file);
} else if (strcmp(buffer, "VmSize:") == 0) {
currVirtMem= GetValue(file);
} else if (strcmp(buffer, "VmPeak:") == 0) {
peakVirtMem= GetValue(file);
}
}
fclose(file);
return true;
}
inline int get_open_fds() {
DIR *dp = opendir("/proc/self/fd");
struct dirent *de;
int count = -3; // '.', '..', dp
if (dp == nullptr)
return -1;
while ((de = readdir(dp)) != nullptr)
count++;
(void)closedir(dp);
return count;
}
struct CSRCreationParameters {
std::string Country, Province, City,
Organization, CommonName;
int bits=2048;
};
struct CSRCreationResults {
std::string CSR, PublicKey, PrivateKey;
};
bool CreateX509CSR(const CSRCreationParameters & Parameters, CSRCreationResults & Results);
std::string generateStrongPassword(int minLength, int maxLength, int numDigits, int minLowercase, int minSpecial, int minUppercase);
bool VerifyECKey(const std::string &key);
bool VerifyRSAKey(const std::string &key);
bool ValidX509Certificate(const std::string &Cert);
bool ValidX509Certificate(const std::vector<std::string> &Certs);
} // namespace OpenWifi::Utils

View File

@@ -21,9 +21,18 @@
#include "Poco/Net/SocketAcceptor.h"
#include <algorithm>
/*
#define DBGLINE \
{ std::cout << __LINE__ << std::endl; }
2023-09-25 14:57:48.963 RADSEC: radsec.openro.am@3.33.129.120:2084: [Error][thr:7] SSL connection unexpectedly closed
2023-09-25 14:57:48.964 RADSEC: radsec.openro.am@3.33.129.120:2084: [Information][thr:7] Disconnecting.
2023-09-25 14:57:50.965 RADSEC: radsec.openro.am@3.33.129.120:2084: [Information][thr:40] Attempting to connect
2023-09-25 14:57:51.675 RTTY-SVR: [Error][thr:6] Frame readable shutdown.
2023-09-25 14:57:51.675 RTTY-SVR: [Debug][thr:6] Closing connection onClientSocketReadable:646
2023-09-25 14:57:51.717 RADSEC: radsec.openro.am@3.33.129.120:2084: [Information][thr:40] Connected. CN=radsec.openro.am
2023-09-25 14:57:51.717 RADSEC: radsec.openro.am@3.33.129.120:2084: [Error][thr:7] SSL connection unexpectedly closed
2023-09-25 14:57:51.717 RADSEC: radsec.openro.am@3.33.129.120:2084: [Information][thr:7] Disconnecting.
*/
namespace OpenWifi {
@@ -440,11 +449,9 @@ namespace OpenWifi {
std::size_t agg_buf_pos=0;
try {
// std::cout << "Available: " << buffer.available() << " ";
Poco::Timespan TS(5,0);
received_bytes = hint->second->socket.receiveBytes(buffer);
if(received_bytes==0) {
// std::cout << hint->second->socket.lastError() << std::endl;
poco_warning(Logger(), "Device Closing connection - 0 bytes received.");
EndConnection( pNf->socket(), __func__, __LINE__ );
return;
@@ -485,9 +492,6 @@ namespace OpenWifi {
return;
}
// std::cout << line++ << " Available: " << buffer.available() << " Cmd: " << (int) LastCommand << " Received: " << received_bytes
// << " MsgLen: " << msg_len << " Data in buffer: " << buffer.used() << std::endl;
buffer.drain(RTTY_HDR_SIZE);
switch (LastCommand) {
@@ -537,8 +541,6 @@ namespace OpenWifi {
EmptyBuffer(fd, agg_buffer, agg_buf_pos);
}
// std::cout << "Empty: " << buffer.isEmpty() << std::endl;
if (!good) {
EndConnection(pNf->socket(), __func__, __LINE__);
}
@@ -583,7 +585,7 @@ namespace OpenWifi {
}
int flags;
unsigned char FrameBuffer[1024];
unsigned char FrameBuffer[64000];
auto ReceivedBytes = Connection->WSSocket_->receiveFrame(FrameBuffer, sizeof(FrameBuffer), flags);
auto Op = flags & Poco::Net::WebSocket::FRAME_OP_BITMASK;
@@ -1040,7 +1042,6 @@ namespace OpenWifi {
// buffer.drain(msg_len);
return true;
} catch (const Poco::Exception &E) {
std::cout << "Failed to send WS stuff" << std::endl;
Logger().log(E);
} catch (const std::exception &E) {
LogStdException(E, "Cannot send data to UI Client");

38
src/sdks/sdk_fms.h Normal file
View File

@@ -0,0 +1,38 @@
//
// Created by stephane bourque on 2023-07-12.
//
#pragma once
#include "RESTObjects/RESTAPI_FMSObjects.h"
#include "framework/MicroServiceNames.h"
#include "framework/OpenAPIRequests.h"
#include "framework/RESTAPI_utils.h"
#include "Poco/JSON/Parser.h"
#include "Poco/Logger.h"
#include "fmt/format.h"
namespace OpenWifi::SDK::FMS {
inline bool GetFirmwareAge( const std::string &deviceType, const std::string &revision, FMSObjects::FirmwareAgeDetails Age, Poco::Logger &Logger) {
OpenAPIRequestGet GetFirmwareAgeAPI(
uSERVICE_FIRMWARE, "/api/v1/firmwareAge" ,
{
{ RESTAPI::Protocol::DEVICETYPE, deviceType },
{ RESTAPI::Protocol::REVISION, revision }
}, 30000);
auto CallResponse = Poco::makeShared<Poco::JSON::Object>();
if (!GetFirmwareAgeAPI.Do(CallResponse, "")) {
Logger.error(fmt::format("{}: Cannot find revision.", revision));
return false;
}
if(Age.from_json(CallResponse)) {
return true;
}
return false;
}
} // namespace OpenWifi::SDK::Prov

View File

@@ -0,0 +1,248 @@
//
// License type: BSD 3-Clause License
// License copy: https://github.com/Telecominfraproject/wlan-cloud-ucentralgw/blob/master/LICENSE
//
// Created by stephane bourque on 2023-07-11.
// Arilia Wireless Inc.
//
#include "CentralConfig.h"
#include "StorageService.h"
#include "fmt/format.h"
#include "framework/RESTAPI_utils.h"
namespace OpenWifi {
const static std::string DB_DefFirmware_SelectFields_ForCreation{
"deviceType VARCHAR(128) PRIMARY KEY, "
"uri TEXT, "
"revision TEXT, "
"Description TEXT, "
"Created BIGINT , "
"imageCreationDate BIGINT , "
"LastModified BIGINT)" };
const static std::string DB_DefFirmware_SelectFields{
"deviceType, "
"uri, "
"revision, "
"Description, "
"Created, "
"imageCreationDate, "
"LastModified "};
const static std::string DB_DefFirmware_InsertValues{"?,?,?,?,?,?,?"};
typedef Poco::Tuple<std::string,
std::string,
std::string,
std::string,
uint64_t,
uint64_t,
uint64_t>
DefFirmwareRecordTuple;
typedef std::vector<DefFirmwareRecordTuple> DefFirmwareRecordList;
void Convert(const DefFirmwareRecordTuple &R, GWObjects::DefaultFirmware &T) {
T.deviceType = R.get<0>();
T.uri = R.get<1>();
T.revision = R.get<2>();
T.Description = R.get<3>();
T.Created = R.get<4>();
T.imageCreationDate = R.get<5>();
T.LastModified = R.get<6>();
}
void Convert(const GWObjects::DefaultFirmware &R, DefFirmwareRecordTuple &T) {
T.set<0>(R.deviceType);
T.set<1>(R.uri);
T.set<2>(R.revision);
T.set<3>(R.Description);
T.set<4>(R.Created);
T.set<5>(R.imageCreationDate);
T.set<6>(R.LastModified);
}
bool Storage::CreateDefaultFirmware(GWObjects::DefaultFirmware &DefFirmware) {
try {
std::string TmpName;
Poco::Data::Session Sess = Pool_->get();
Poco::Data::Statement Select(Sess);
Poco::toLowerInPlace(DefFirmware.deviceType);
std::string St{"SELECT DeviceType FROM DefaultFirmwares WHERE deviceType=?"};
Select << ConvertParams(St),
Poco::Data::Keywords::into(TmpName),
Poco::Data::Keywords::use(DefFirmware.deviceType);
Select.execute();
if (!TmpName.empty())
return false;
Poco::Data::Statement Insert(Sess);
std::string St2{"INSERT INTO DefaultFirmwares ( " + DB_DefFirmware_SelectFields +
" ) "
"VALUES(" +
DB_DefFirmware_InsertValues + ")"};
DefFirmwareRecordTuple R;
Convert(DefFirmware, R);
Insert << ConvertParams(St2),
Poco::Data::Keywords::use(R);
Insert.execute();
return true;
} catch (const Poco::Exception &E) {
poco_warning(Logger(), fmt::format("{}: Failed with: {}", std::string(__func__),
E.displayText()));
}
return false;
}
bool Storage::DeleteDefaultFirmware(std::string &deviceType) {
try {
Poco::Data::Session Sess = Pool_->get();
Poco::Data::Statement Delete(Sess);
Poco::toLowerInPlace(deviceType);
std::string St{"DELETE FROM DefaultFirmwares WHERE deviceType=?"};
Delete << ConvertParams(St), Poco::Data::Keywords::use(deviceType);
Delete.execute();
return true;
} catch (const Poco::Exception &E) {
poco_warning(Logger(), fmt::format("{}: Failed with: {}", std::string(__func__),
E.displayText()));
}
return false;
}
bool Storage::UpdateDefaultFirmware(GWObjects::DefaultFirmware &DefFirmware) {
try {
Poco::Data::Session Sess = Pool_->get();
uint64_t Now = time(nullptr);
Poco::Data::Statement Update(Sess);
DefFirmware.LastModified = Now;
Poco::toLowerInPlace(DefFirmware.deviceType);
std::string St{"UPDATE DefaultFirmwares SET deviceType=?, uri=?, revision=?, "
"Description=?, Created=? , imageCreationDate=?, LastModified=? WHERE deviceType=?"};
DefFirmwareRecordTuple R;
Convert(DefFirmware, R);
Update << ConvertParams(St),
Poco::Data::Keywords::use(R),
Poco::Data::Keywords::use(DefFirmware.deviceType);
Update.execute();
return true;
} catch (const Poco::Exception &E) {
poco_warning(Logger(), fmt::format("{}: Failed with: {}", std::string(__func__),
E.displayText()));
}
return false;
}
bool Storage::GetDefaultFirmware(std::string &deviceType,
GWObjects::DefaultFirmware &DefFirmware) {
try {
Poco::Data::Session Sess = Pool_->get();
Poco::Data::Statement Select(Sess);
Poco::toLowerInPlace(deviceType);
std::string St{"SELECT " + DB_DefFirmware_SelectFields +
" FROM DefaultFirmwares WHERE deviceType=?"};
DefFirmwareRecordTuple R;
Select << ConvertParams(St),
Poco::Data::Keywords::into(R),
Poco::Data::Keywords::use(deviceType);
Select.execute();
if (Select.rowsExtracted() == 1) {
Convert(R, DefFirmware);
return true;
}
return false;
} catch (const Poco::Exception &E) {
poco_warning(Logger(), fmt::format("{}: Failed with: {}", std::string(__func__),
E.displayText()));
}
return false;
}
bool Storage::DefaultFirmwareAlreadyExists(std::string &deviceType) {
try {
Poco::Data::Session Sess = Pool_->get();
Poco::Data::Statement Select(Sess);
Poco::toLowerInPlace(deviceType);
std::string St{"SELECT " + DB_DefFirmware_SelectFields +
" FROM DefaultFirmwares WHERE deviceType=?"};
DefFirmwareRecordTuple R;
Select << ConvertParams(St), Poco::Data::Keywords::into(R),
Poco::Data::Keywords::use(deviceType);
Select.execute();
return Select.rowsExtracted() == 1;
} catch (const Poco::Exception &E) {
poco_warning(Logger(), fmt::format("{}: Failed with: {}", std::string(__func__),
E.displayText()));
}
return false;
}
bool
Storage::GetDefaultFirmwares(uint64_t From, uint64_t HowMany,
std::vector<GWObjects::DefaultFirmware> &Firmwares) {
try {
Poco::Data::Session Sess = Pool_->get();
Poco::Data::Statement Select(Sess);
DefFirmwareRecordList Records;
Select << "SELECT " + DB_DefFirmware_SelectFields +
" FROM DefaultFirmwares ORDER BY deviceType ASC " + ComputeRange(From, HowMany),
Poco::Data::Keywords::into(Records);
Select.execute();
Firmwares.clear();
for (const auto &i : Records) {
GWObjects::DefaultFirmware R;
Convert(i, R);
Firmwares.push_back(R);
}
return true;
} catch (const Poco::Exception &E) {
poco_warning(Logger(), fmt::format("{}: Failed with: {}", std::string(__func__),
E.displayText()));
}
return false;
}
uint64_t Storage::GetDefaultFirmwaresCount() {
uint64_t Count = 0;
try {
Poco::Data::Session Sess = Pool_->get();
Poco::Data::Statement Select(Sess);
Select << "SELECT Count(*) from DefaultFirmwares", Poco::Data::Keywords::into(Count);
Select.execute();
return Count;
} catch (const Poco::Exception &E) {
poco_warning(Logger(), fmt::format("{}: Failed with: {}", std::string(__func__),
E.displayText()));
}
return Count;
}
} // namespace OpenWifi

View File

@@ -590,9 +590,7 @@ namespace OpenWifi {
Poco::JSON::Object Message;
Message.set("command", "device_deleted");
Message.set("timestamp", Utils::Now());
std::ostringstream StrPayload;
Message.stringify(StrPayload);
KafkaManager()->PostMessage(KafkaTopics::COMMAND, SerialNumber, std::make_shared<std::string>(StrPayload.str()));
KafkaManager()->PostMessage(KafkaTopics::COMMAND, SerialNumber, Message);
}
return true;

View File

@@ -21,6 +21,7 @@ namespace OpenWifi {
Create_CommandList();
Create_BlackList();
Create_FileUploads();
Create_DefaultFirmwares();
return 0;
}
@@ -275,6 +276,28 @@ namespace OpenWifi {
return -1;
}
int Storage::Create_DefaultFirmwares() {
try {
Poco::Data::Session Sess = Pool_->get();
if (dbType_ == pgsql || dbType_ == sqlite || dbType_ == mysql) {
Sess << "CREATE TABLE IF NOT EXISTS DefaultFirmwares ("
"deviceType VARCHAR(128) PRIMARY KEY, "
"uri TEXT, "
"revision TEXT, "
"Description TEXT, "
"Created BIGINT , "
"imageCreationDate BIGINT , "
"LastModified BIGINT)",
Poco::Data::Keywords::now;
}
return 0;
} catch (const Poco::Exception &E) {
Logger().log(E);
}
return -1;
}
// mysql = float
// sqlite, postgresql = real

View File

@@ -299,6 +299,14 @@ systeminfo() {
jq < ${result_file}
}
systemresources() {
curl ${FLAGS} -X GET "https://${OWGW}/api/v1/system?command=resources" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${token}" > ${result_file}
jq < ${result_file}
}
reloadsubsystem() {
payload="{ \"command\" : \"reload\", \"subsystems\" : [ \"$1\" ] }"
curl ${FLAGS} -X POST "https://${OWGW}/api/v1/system" \
@@ -900,6 +908,22 @@ radiuscoadm() {
jq < ${result_file}
}
listdefaultfirmwares() {
curl ${FLAGS} -X GET "https://${OWGW}/api/v1/default_firmwares" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${token}" > ${result_file}
jq < ${result_file}
}
getdefaultfirmware() {
curl ${FLAGS} -X GET "https://${OWGW}/api/v1/default_firmware/$1" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${token}" > ${result_file}
jq < ${result_file}
}
check_response() {
if [ -s "$1" ]; then
@@ -1150,6 +1174,7 @@ case "$1" in
"getsubsystemnames") login; getsubsystemnames; logout ;;
"reloadsubsystem") login; reloadsubsystem "$2"; logout ;;
"systeminfo") login; systeminfo ; logout;;
"systemresources") login; systemresources ; logout;;
"ouilookup") login; ouilookup "$2"; logout;;
"telemetry") login; telemetry "$2"; logout;;
"telemetry_to_kafka") login; telemetry_to_kafka "$2" "$3"; logout;;
@@ -1183,6 +1208,8 @@ case "$1" in
"radiussearchmac") login; radiussearchmac "$2"; logout;;
"deletesimdevices") login; deletesimdevices "$2"; logout;;
"deletebulkdevices") login; deletebulkdevices "$2"; logout;;
"listdefaultfirmwares") login; listdefaultfirmwares; logout;;
"getdefaultfirmware") login; getdefaultfirmware "$2"; logout;;
"testtoken") testtoken;;
*) help ;;
esac