Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://telecominfraproject.atlassian.net/browse/WIFI-13147 #336

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
63
65
2 changes: 1 addition & 1 deletion src/AP_WS_Process_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace OpenWifi {
}

StateUtils::ComputeAssociations(StateObj, State_.Associations_2G,
State_.Associations_5G, State_.Associations_6G);
State_.Associations_5G, State_.Associations_6G, State_.uptime);

if (KafkaManager()->Enabled() && !AP_WS_Server()->KafkaDisableState()) {
KafkaManager()->PostMessage(KafkaTopics::STATE, SerialNumber_, *ParamsObj);
Expand Down
1 change: 1 addition & 0 deletions src/RESTObjects/RESTAPI_GWobjects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ namespace OpenWifi::GWObjects {
field_to_json(Obj, "totalConnectionTime", Utils::Now() - started);
field_to_json(Obj, "certificateExpiryDate", certificateExpiryDate);
field_to_json(Obj, "connectReason", connectReason);
field_to_json(Obj, "uptime", uptime);

#ifdef TIP_GATEWAY_SERVICE
hasRADIUSSessions = RADIUSSessionTracker()->HasSessions(SerialNumber);
Expand Down
1 change: 1 addition & 0 deletions src/RESTObjects/RESTAPI_GWobjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ namespace OpenWifi::GWObjects {
std::double_t load=0.0;
std::double_t temperature=0.0;
std::string connectReason;
std::uint64_t uptime=0;

void to_json(const std::string &SerialNumber, Poco::JSON::Object &Obj) ;
};
Expand Down
10 changes: 8 additions & 2 deletions src/StateUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace OpenWifi::StateUtils {
}

bool ComputeAssociations(const Poco::JSON::Object::Ptr RawObject, uint64_t &Radios_2G,
uint64_t &Radios_5G, uint64_t &Radios_6G) {
uint64_t &Radios_5G, uint64_t &Radios_6G, uint64_t &UpTime ) {
Radios_2G = 0;
Radios_5G = 0;
Radios_6G = 0;
Expand Down Expand Up @@ -90,9 +90,15 @@ namespace OpenWifi::StateUtils {
}
}
}
// std::cout << Radios_2G << " " << Radios_5G << " " << Radios_6G << std::endl;
return true;
}

if(RawObject->has("unit") && !RawObject->isNull("unit") && RawObject->isObject("unit")) {
auto unit = RawObject->getObject("unit");
if(unit->has("uptime")) {
UpTime = unit->get("uptime");
}
}
return false;
}
} // namespace OpenWifi::StateUtils
2 changes: 1 addition & 1 deletion src/StateUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

namespace OpenWifi::StateUtils {
bool ComputeAssociations(const Poco::JSON::Object::Ptr RawObject, uint64_t &Radios_2G,
uint64_t &Radios_5G, uint64_t &Radio_6G);
uint64_t &Radios_5G, uint64_t &Radio_6G, uint64_t &UpTime);
}
4 changes: 2 additions & 2 deletions src/storage/storage_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,9 @@ namespace OpenWifi {
}
}

uint64_t Associations_2G, Associations_5G, Associations_6G;
uint64_t Associations_2G, Associations_5G, Associations_6G, uptime;
StateUtils::ComputeAssociations(RawObject, Associations_2G, Associations_5G,
Associations_6G);
Associations_6G, uptime);
UpdateCountedMap(Dashboard.associations, "2G", Associations_2G);
UpdateCountedMap(Dashboard.associations, "5G", Associations_5G);
UpdateCountedMap(Dashboard.associations, "6G", Associations_6G);
Expand Down
Loading