Compare commits

...

12 Commits

Author SHA1 Message Date
i-chvets
19624b5a63 Merge pull request #365 from Telecominfraproject/WIFI-13597-fix-kafka-producer-using-poll
Wifi 13597 fix kafka producer using poll
2024-07-12 10:36:20 -04:00
TIP Automation User
1d2e943071 Chg: update image tag in helm values to v3.1.0 2024-06-29 16:50:23 +00:00
Ivan Chvets
3c15c6dc4f fix: modified code to use flush() when internal queue is not loaded
https://telecominfraproject.atlassian.net/browse/WIFI-13597

Signed-off-by: Ivan Chvets <ivan.chvets@kinarasystems.com>
2024-06-19 16:29:24 -04:00
Ivan Chvets
b118dcbcec fix: added flush() for proper shutdown
https://telecominfraproject.atlassian.net/browse/WIFI-13597

Signed-off-by: Ivan Chvets <ivan.chvets@kinarasystems.com>
2024-06-14 16:30:23 -04:00
Ivan Chvets
c7ed7fb264 fix: modified kafka manager to use poll in producer
https://telecominfraproject.atlassian.net/browse/WIFI-13597

Summary of changes:
- Modified code in KafkaManager to use poll instead of flush for every
  messages sent. flush is used only on empty internal notification queue
in idle times.

Signed-off-by: Ivan Chvets <ivan.chvets@kinarasystems.com>
2024-06-11 11:15:42 -04:00
TIP Automation User
5d259a5f68 Chg: update image tag in helm values to v3.1.0-RC1 2024-06-09 17:01:41 +00:00
Gopi Raga
1d88bb50d9 Merge pull request #359 from Telecominfraproject/WIFI-431-fix-update-internal-schema-validation
fix: modified code to use final as default for fingerprint mode
2024-06-06 11:10:46 +05:30
Stephane Bourque
d00d409fca Merge pull request #358 from Telecominfraproject/OLS-84
https://telecominfraproject.atlassian.net/browse/OLS-84
2024-06-04 20:49:16 -07:00
stephb9959
8382818e2d https://telecominfraproject.atlassian.net/browse/OLS-84
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2024-06-04 20:48:14 -07:00
Stephane Bourque
ed4670d239 Merge pull request #357 from Telecominfraproject/OLS-84
https://telecominfraproject.atlassian.net/browse/OLS-84
2024-06-04 13:32:32 -07:00
stephb9959
cca3619e91 https://telecominfraproject.atlassian.net/browse/OLS-84
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
2024-06-04 12:55:54 -07:00
Stephane Bourque
9a834c29a2 Merge pull request #355 from Telecominfraproject/WIFI-431-fix-update-internal-schema-validation
fix: modified code to use proper fingerprint defintion
2024-06-04 09:41:34 -07:00
9 changed files with 46 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.13)
project(owgw VERSION 3.0.2)
project(owgw VERSION 3.1.0)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)

2
build
View File

@@ -1 +1 @@
97
3

View File

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

View File

@@ -83,7 +83,7 @@ namespace OpenWifi {
State_.Address = Utils::FormatIPv6(WS_->peerAddress().toString());
CId_ = SerialNumber_ + "@" + CId_;
auto &Platform = Caps.Platform();
auto Platform = Poco::toLower(Caps.Platform());
if(ParamsObj->has("reason")) {
State_.connectReason = ParamsObj->get("reason").toString();

View File

@@ -265,7 +265,11 @@ namespace OpenWifi::Config {
Model_ = Caps->get("model").toString();
if (Caps->has("platform"))
Platform_ = Caps->get("platform").toString();
Platform_ = Poco::toLower(Caps->get("platform").toString());
if(Compatible_.empty()) {
Compatible_ = Model_;
}
std::ostringstream OS;
Caps->stringify(OS);

View File

@@ -30,7 +30,7 @@ namespace OpenWifi::GWObjects {
void Device::to_json(Poco::JSON::Object &Obj) const {
field_to_json(Obj, "serialNumber", SerialNumber);
#ifdef TIP_GATEWAY_SERVICE
field_to_json(Obj, "deviceType", CapabilitiesCache::instance()->GetPlatform(Compatible));
field_to_json(Obj, "deviceType", StorageService()->GetPlatform(SerialNumber));
field_to_json(Obj, "blackListed", StorageService()->IsBlackListed(Utils::MACToInt(SerialNumber)));
#endif
field_to_json(Obj, "macAddress", MACAddress);

View File

@@ -155,6 +155,7 @@ namespace OpenWifi {
bool DeleteDevice(std::string &SerialNumber);
bool DeleteDevices(std::string &SerialPattern, bool SimulatedOnly);
bool DeleteDevices(std::uint64_t OlderContact, bool SimulatedOnly);
std::string GetPlatform(const std::string &SerialNumber);
bool UpdateDevice(GWObjects::Device &);
bool UpdateDevice(LockedDbSession &Session, GWObjects::Device &);

View File

@@ -107,7 +107,16 @@ namespace OpenWifi {
NewMessage.partition(0);
NewMessage.payload(Msg->Payload());
Producer.produce(NewMessage);
Producer.flush();
if (Queue_.size() < 100) {
// use flush when internal queue is lightly loaded, i.e. flush after each
// message
Producer.flush();
}
else {
// use poll when internal queue is loaded to allow messages to be sent in
// batches
Producer.poll((std::chrono::milliseconds) 0);
}
}
} catch (const cppkafka::HandleException &E) {
poco_warning(Logger_,
@@ -117,8 +126,13 @@ namespace OpenWifi {
} catch (...) {
poco_error(Logger_, "std::exception");
}
if (Queue_.size() == 0) {
// message queue is empty, flush all previously sent messages
Producer.flush();
}
Note = Queue_.waitDequeueNotification();
}
Producer.flush();
poco_information(Logger_, "Stopped...");
}
@@ -324,4 +338,4 @@ namespace OpenWifi {
partitions.front().get_partition()));
}
} // namespace OpenWifi
} // namespace OpenWifi

View File

@@ -615,7 +615,9 @@ namespace OpenWifi {
D.locale = InsertRadiosCountyRegulation(D.Configuration, IPAddress);
D.SerialNumber = Poco::toLower(SerialNumber);
D.Compatible = Caps.Compatible();
D.DeviceType = Caps.Platform();
if(D.Compatible.empty())
D.Compatible = Caps.Model();
D.DeviceType = Poco::toLower(Caps.Platform());
D.MACAddress = Utils::SerialToMAC(SerialNumber);
D.Manufacturer = Caps.Model();
D.Firmware = Firmware;
@@ -664,6 +666,22 @@ namespace OpenWifi {
return false;
}
std::string Storage::GetPlatform(const std::string &SerialNumber) {
try {
Poco::Data::Session Sess = Pool_->get();
Poco::Data::Statement Select(Sess);
std::string St = fmt::format("SELECT DeviceType FROM Devices WHERE SerialNumber='{}'", SerialNumber);
std::string Platform;
Select << ConvertParams(St), Poco::Data::Keywords::into(Platform);
Select.execute();
return Platform;
} catch (const Poco::Exception &E) {
Logger().log(E);
}
return "";
}
bool Storage::DeleteDevice(std::string &SerialNumber) {
try {
std::vector<std::string> TableNames{"Devices", "Statistics", "CommandList",