From e2e5687b47ffe23694fd9401a01b498835fb7517 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Wed, 1 Mar 2023 10:11:06 -0800 Subject: [PATCH 1/5] https://telecominfraproject.atlassian.net/browse/WIFI-12068 Signed-off-by: stephb9959 --- build | 2 +- openapi/owprov.yaml | 24 ++++++++++++++-------- src/RESTAPI/RESTAPI_venue_list_handler.cpp | 11 +++++++++- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/build b/build index dec2bf5..2edeafb 100644 --- a/build +++ b/build @@ -1 +1 @@ -19 \ No newline at end of file +20 \ No newline at end of file diff --git a/openapi/owprov.yaml b/openapi/owprov.yaml index 55705ef..a3b032b 100644 --- a/openapi/owprov.yaml +++ b/openapi/owprov.yaml @@ -2066,19 +2066,12 @@ paths: default: false required: false - in: query - description: return the list of devices under RRM + description: return the list of devices for a subscriber name: subscriber schema: type: string format: uuid required: false - - in: query - description: return RRM settings for a specific device - name: rrmSettings - schema: - type: boolean - default: false - required: false - in: query description: return the resolved configuration for a specific device name: resolveConfig @@ -2144,6 +2137,13 @@ paths: type: string format: uuid required: false + - in: query + description: return RRM settings for a specific device + name: rrmSettings + schema: + type: boolean + default: false + required: false responses: 200: description: Succesful retrieve configuratiopn or part of the configuration @@ -2416,6 +2416,14 @@ paths: type: boolean default: false required: false + - in: query + description: list venues that use a specific RRM vendor + name: RRMvendor + schema: + type: string + example: + - this is the shortname of the RRM vendor + required: false responses: 200: description: Return a list of venues. diff --git a/src/RESTAPI/RESTAPI_venue_list_handler.cpp b/src/RESTAPI/RESTAPI_venue_list_handler.cpp index 3baaffa..52d5884 100644 --- a/src/RESTAPI/RESTAPI_venue_list_handler.cpp +++ b/src/RESTAPI/RESTAPI_venue_list_handler.cpp @@ -7,5 +7,14 @@ #include "StorageService.h" namespace OpenWifi { - void RESTAPI_venue_list_handler::DoGet() { return ListHandler("venues", DB_, *this); } + void RESTAPI_venue_list_handler::DoGet() { + auto RRMvendor = GetParameter("RRMvendor",""); + if(RRMvendor.empty()) { + return ListHandler("venues", DB_, *this); + } + VenueDB::RecordVec Venues; + auto Where = fmt::format(" deviceRules LIKE '%{}%' ", RRMvendor); + DB_.GetRecords(QB_.Offset, QB_.Limit, Venues, Where, " ORDER BY name "); + return ReturnObject("venues",Venues); + } } // namespace OpenWifi \ No newline at end of file From ecea2a1fb47b6cb2a89d337390a651dfe5d415f4 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Thu, 2 Mar 2023 09:10:29 -0800 Subject: [PATCH 2/5] https://telecominfraproject.atlassian.net/browse/WIFI-12068 Signed-off-by: stephb9959 --- src/storage/storage_inventory.cpp | 9 ++++++++- test_scripts/curl/cli | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/storage/storage_inventory.cpp b/src/storage/storage_inventory.cpp index 1e97acb..6e977ec 100644 --- a/src/storage/storage_inventory.cpp +++ b/src/storage/storage_inventory.cpp @@ -85,7 +85,8 @@ namespace OpenWifi { ProvObjects::InventoryTag ExistingDevice; auto SerialNumber = Poco::toLower(SerialNumberRaw); if (!GetRecord("serialNumber", SerialNumber, ExistingDevice)) { - ProvObjects::InventoryTag NewDevice; + std::cout << __LINE__ << std::endl; + ProvObjects::InventoryTag NewDevice; uint64_t Now = Utils::Now(); auto Tokens = Poco::StringTokenizer(ConnectionInfo, "@:"); @@ -113,7 +114,9 @@ namespace OpenWifi { } } + std::cout << __LINE__ << std::endl; if (CreateRecord(NewDevice)) { + std::cout << __LINE__ << std::endl; SerialNumberCache()->AddSerialNumber(SerialNumber, DeviceType); std::string FullUUID; if (!NewDevice.entity.empty()) { @@ -143,6 +146,7 @@ namespace OpenWifi { } } else { // Device already exists, do we need to modify anything? + std::cout << __LINE__ << std::endl; bool modified = false; if (ExistingDevice.deviceType != DeviceType) { ExistingDevice.deviceType = DeviceType; @@ -176,10 +180,13 @@ namespace OpenWifi { modified = true; } + std::cout << __LINE__ << std::endl; if (modified) { ExistingDevice.info.modified = Utils::Now(); + std::cout << __LINE__ << std::endl; StorageService()->InventoryDB().UpdateRecord("serialNumber", SerialNumber, ExistingDevice); + std::cout << __LINE__ << std::endl; } } return false; diff --git a/test_scripts/curl/cli b/test_scripts/curl/cli index ae2f258..a45f37e 100755 --- a/test_scripts/curl/cli +++ b/test_scripts/curl/cli @@ -528,6 +528,14 @@ getvenuedevices() { jq < ${result_file} } +getvenuesperrrm() { + curl ${FLAGS} -X GET "https://${OWPROV}/api/v1/venue?RRMvendor=$1" \ + -H "Content-Type: application/json" \ + -H "Authorization: Bearer ${token}" \ + -H "Accept: application/json" > ${result_file} + jq < ${result_file} +} + listrrmalgos() { setrrm curl ${FLAGS} -X GET "http://${OWRRM}/api/v1/algorithms" \ @@ -546,6 +554,7 @@ rrmprovider() { jq < ${result_file} } + notifications() { if [[ -z "$1" ]] then @@ -664,6 +673,7 @@ case "$1" in "deleteoverride") login; deleteoverride "$2"; logout;; "venueupgraderevisions") login; venueupgraderevisions "$2"; logout;; "getsystemconfiguration") login; getsystemconfiguration "$2"; logout;; + "getvenuesperrrm") login; getvenuesperrrm "$2"; logout;; *) help ;; esac From ba526f85a8d66b034ecb3d87a4d6a5434da608fb Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Thu, 2 Mar 2023 09:16:14 -0800 Subject: [PATCH 3/5] https://telecominfraproject.atlassian.net/browse/WIFI-12068 Signed-off-by: stephb9959 --- src/storage/storage_inventory.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage/storage_inventory.cpp b/src/storage/storage_inventory.cpp index 6e977ec..4782881 100644 --- a/src/storage/storage_inventory.cpp +++ b/src/storage/storage_inventory.cpp @@ -184,7 +184,7 @@ namespace OpenWifi { if (modified) { ExistingDevice.info.modified = Utils::Now(); std::cout << __LINE__ << std::endl; - StorageService()->InventoryDB().UpdateRecord("serialNumber", SerialNumber, + StorageService()->InventoryDB().UpdateRecord("id", ExistingDevice.info.id, ExistingDevice); std::cout << __LINE__ << std::endl; } From ba3607bd87bc75dad146c6e0c579cf3d531546f9 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Thu, 2 Mar 2023 09:54:00 -0800 Subject: [PATCH 4/5] https://telecominfraproject.atlassian.net/browse/WIFI-12068 Signed-off-by: stephb9959 --- src/APConfig.cpp | 11 ++++------- src/storage/storage_inventory.cpp | 9 --------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/src/APConfig.cpp b/src/APConfig.cpp index e696b26..b1cd2fe 100644 --- a/src/APConfig.cpp +++ b/src/APConfig.cpp @@ -132,11 +132,10 @@ namespace OpenWifi { if (StorageService()->InventoryDB().GetRecord("serialNumber", SerialNumber_, D)) { if (!D.deviceConfiguration.empty()) { - std::cout << "Adding device specific configuration: " - << D.deviceConfiguration.size() << std::endl; + // std::cout << "Adding device specific configuration: " << D.deviceConfiguration.size() << std::endl; AddConfiguration(D.deviceConfiguration); } else { - std::cout << "No device specific configuration." << std::endl; + // std::cout << "No device specific configuration." << std::endl; } if (!D.entity.empty()) { AddEntityConfig(D.entity); @@ -196,8 +195,7 @@ namespace OpenWifi { ReplaceVariablesInObject(OriginalSection, ExpandedSection); Configuration->set(SectionName, ExpandedSection); } else { - std::cout << " --- unknown element type --- " - << O->get(SectionName).toString() << std::endl; + poco_warning(Logger(), fmt::format("Unknown config element type: {}",O->get(SectionName).toString())); } } else { if (Explain_) { @@ -248,8 +246,7 @@ namespace OpenWifi { "channel", std::strtoull(col.parameterValue.c_str(), nullptr, 10)); } - std::cout << "Setting channel in radio " << RadioIndex - << std::endl; + // std::cout << "Setting channel in radio " << RadioIndex << std::endl; if (Explain_) { Poco::JSON::Object ExObj; ExObj.set("from-name", "overrides"); diff --git a/src/storage/storage_inventory.cpp b/src/storage/storage_inventory.cpp index 4782881..7f6ef56 100644 --- a/src/storage/storage_inventory.cpp +++ b/src/storage/storage_inventory.cpp @@ -85,7 +85,6 @@ namespace OpenWifi { ProvObjects::InventoryTag ExistingDevice; auto SerialNumber = Poco::toLower(SerialNumberRaw); if (!GetRecord("serialNumber", SerialNumber, ExistingDevice)) { - std::cout << __LINE__ << std::endl; ProvObjects::InventoryTag NewDevice; uint64_t Now = Utils::Now(); @@ -114,9 +113,7 @@ namespace OpenWifi { } } - std::cout << __LINE__ << std::endl; if (CreateRecord(NewDevice)) { - std::cout << __LINE__ << std::endl; SerialNumberCache()->AddSerialNumber(SerialNumber, DeviceType); std::string FullUUID; if (!NewDevice.entity.empty()) { @@ -130,11 +127,9 @@ namespace OpenWifi { if (!FullUUID.empty()) { if (SDK::GW::Device::SetVenue(nullptr, NewDevice.serialNumber, FullUUID)) { - // std::cout << "Set GW done " << SerialNumber << std::endl; Logger().information(Poco::format("%s: GW set entity/venue property.", NewDevice.serialNumber)); } else { - // std::cout << "Could not set GW " << SerialNumber << std::endl; Logger().information(Poco::format( "%s: could not set GW entity/venue property.", NewDevice.serialNumber)); } @@ -146,7 +141,6 @@ namespace OpenWifi { } } else { // Device already exists, do we need to modify anything? - std::cout << __LINE__ << std::endl; bool modified = false; if (ExistingDevice.deviceType != DeviceType) { ExistingDevice.deviceType = DeviceType; @@ -180,13 +174,10 @@ namespace OpenWifi { modified = true; } - std::cout << __LINE__ << std::endl; if (modified) { ExistingDevice.info.modified = Utils::Now(); - std::cout << __LINE__ << std::endl; StorageService()->InventoryDB().UpdateRecord("id", ExistingDevice.info.id, ExistingDevice); - std::cout << __LINE__ << std::endl; } } return false; From c5e63ce95b1a5fb66d6440d085d85d8da8f26421 Mon Sep 17 00:00:00 2001 From: stephb9959 Date: Thu, 2 Mar 2023 11:12:46 -0800 Subject: [PATCH 5/5] https://telecominfraproject.atlassian.net/browse/WIFI-12068 Signed-off-by: stephb9959 --- build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build b/build index 2edeafb..b5045cc 100644 --- a/build +++ b/build @@ -1 +1 @@ -20 \ No newline at end of file +21 \ No newline at end of file