From 7240b891c2f86dfb106dee145c0de4efcfa214c1 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Wed, 8 Mar 2023 09:35:19 -0800 Subject: [PATCH 1/3] https://telecominfraproject.atlassian.net/browse/WIFI-12361 Signed-off-by: stephb9959 --- build | 2 +- src/framework/ConfigurationValidator.cpp | 51 +++++++++++++++++++++++- 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/build b/build index 9d60796..3cacc0b 100644 --- a/build +++ b/build @@ -1 +1 @@ -11 \ No newline at end of file +12 \ No newline at end of file diff --git a/src/framework/ConfigurationValidator.cpp b/src/framework/ConfigurationValidator.cpp index 85ba6b3..42f0831 100644 --- a/src/framework/ConfigurationValidator.cpp +++ b/src/framework/ConfigurationValidator.cpp @@ -3092,6 +3092,20 @@ static std::string DefaultUCentralSchema = R"foo( } } }, + "metrics.wifi-scan": { + "type": "object", + "properties": { + "interval": { + "type": "integer" + }, + "verbose": { + "type": "boolean" + }, + "information-elements": { + "type": "boolean" + } + } + }, "metrics.telemetry": { "type": "object", "properties": { @@ -3101,7 +3115,22 @@ static std::string DefaultUCentralSchema = R"foo( "types": { "type": "array", "items": { - "type": "string" + "type": "string", + "enum": [ + "ssh", + "health", + "health.dns", + "health.dhcp", + "health.radius", + "health.memory", + "client", + "client.join", + "client.leave", + "client.key-mismatch", + "wifi", + "wifi.start", + "wifi.stop" + ] } } } @@ -3112,7 +3141,22 @@ static std::string DefaultUCentralSchema = R"foo( "types": { "type": "array", "items": { - "type": "string" + "type": "string", + "enum": [ + "ssh", + "health", + "health.dns", + "health.dhcp", + "health.radius", + "health.memory", + "client", + "client.join", + "client.leave", + "client.key-mismatch", + "wifi", + "wifi.start", + "wifi.stop" + ] } } } @@ -3132,6 +3176,9 @@ static std::string DefaultUCentralSchema = R"foo( "dhcp-snooping": { "$ref": "#/$defs/metrics.dhcp-snooping" }, + "wifi-scan": { + "$ref": "#/$defs/metrics.wifi-scan" + }, "telemetry": { "$ref": "#/$defs/metrics.telemetry" }, From c73168520cb229c7fd40e03f18ae2352c7c8d59a Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Mon, 13 Mar 2023 10:49:55 -0700 Subject: [PATCH 2/3] https://telecominfraproject.atlassian.net/browse/WIFI-12068 Signed-off-by: stephb9959 --- build | 2 +- src/framework/RESTAPI_Handler.h | 6 ++++-- src/framework/utils.cpp | 9 +++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/build b/build index 3cacc0b..ca7bf83 100644 --- a/build +++ b/build @@ -1 +1 @@ -12 \ No newline at end of file +13 \ No newline at end of file diff --git a/src/framework/RESTAPI_Handler.h b/src/framework/RESTAPI_Handler.h index 232958c..a7ed681 100644 --- a/src/framework/RESTAPI_Handler.h +++ b/src/framework/RESTAPI_Handler.h @@ -483,6 +483,7 @@ namespace OpenWifi { Response->set("Content-Transfer-Encoding", "binary"); Response->set("Accept-Ranges", "bytes"); } + Response->set("Access-Control-Expose-Headers", "Content-Disposition"); Response->set("Content-Disposition", "attachment; filename=" + Name); Response->set("Accept-Ranges", "bytes"); Response->set("Cache-Control", "no-store"); @@ -491,7 +492,7 @@ namespace OpenWifi { Response->sendFile(TempAvatar.path(), MT.ContentType); } - inline void SendFileContent(const std::string &Content, const std::string &Type, + inline void SendFileContent(const std::string &Content, [[maybe_unused]] const std::string &Type, const std::string &Name) { Response->setStatus(Poco::Net::HTTPResponse::HTTPStatus::HTTP_OK); SetCommonHeaders(); @@ -500,12 +501,13 @@ namespace OpenWifi { Response->set("Content-Transfer-Encoding", "binary"); Response->set("Accept-Ranges", "bytes"); } + Response->set("Access-Control-Expose-Headers", "Content-Disposition"); Response->set("Content-Disposition", "attachment; filename=" + Name); Response->set("Accept-Ranges", "bytes"); Response->set("Cache-Control", "no-store"); Response->set("Expires", "Mon, 26 Jul 2027 05:00:00 GMT"); Response->setContentLength(Content.size()); - Response->setContentType(Type); + Response->setContentType(MT.ContentType); auto &OutputStream = Response->send(); OutputStream << Content; } diff --git a/src/framework/utils.cpp b/src/framework/utils.cpp index 976bcc6..55e0b55 100644 --- a/src/framework/utils.cpp +++ b/src/framework/utils.cpp @@ -437,6 +437,15 @@ namespace OpenWifi::Utils { return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "text/css"}; if (E == "js") return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "application/javascript"}; + if (E == "pcap") + return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/vnd.tcpdump.pcap"}; + if (E == "txt") + return MediaTypeEncoding{.Encoding = PLAIN, .ContentType = "text/plain"}; + if (E == "tgz") + return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/tar+gzip"}; + if (E == "gz" || E=="gzip") + return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/gzip"}; + return MediaTypeEncoding{.Encoding = BINARY, .ContentType = "application/octet-stream"}; } From 9d95a41d142b9eb448b00ece9c9e2fbcd610fc65 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Mon, 13 Mar 2023 12:02:56 -0700 Subject: [PATCH 3/3] https://telecominfraproject.atlassian.net/browse/WIFI-12068 Signed-off-by: stephb9959 --- src/framework/ConfigurationValidator.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/framework/ConfigurationValidator.cpp b/src/framework/ConfigurationValidator.cpp index 42f0831..db7cc3c 100644 --- a/src/framework/ConfigurationValidator.cpp +++ b/src/framework/ConfigurationValidator.cpp @@ -3129,7 +3129,12 @@ static std::string DefaultUCentralSchema = R"foo( "client.key-mismatch", "wifi", "wifi.start", - "wifi.stop" + "wifi.stop", + "wired", + "wired.carrier-up", + "wired.carrier-down", + "unit", + "unit.boot-up" ] } } @@ -3155,7 +3160,12 @@ static std::string DefaultUCentralSchema = R"foo( "client.key-mismatch", "wifi", "wifi.start", - "wifi.stop" + "wifi.stop", + "wired", + "wired.carrier-up", + "wired.carrier-down", + "unit", + "unit.boot-up" ] } }