Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-7831
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Oct 4, 2023
1 parent 14efffa commit aec3144
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
11 changes: 10 additions & 1 deletion src/RadiusEndpointUpdater.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <StorageService.h>
#include <RadiusEndpointTypes/OrionWifi.h>
#include <RadiusEndpointTypes/GlobalReach.h>
#include <sdks/SDK_gw.h>
#include <RESTObjects/RESTAPI_GWobjects.h>

namespace OpenWifi {
class RadiusEndpointUpdater {
Expand Down Expand Up @@ -163,7 +165,14 @@ namespace OpenWifi {
RadiusConfig.set("pools", RadiusPools);
RadiusConfig.stringify(std::cout,4,2);

AppServiceRegistry().Set("radiusEndpointLastUpdate", Utils::Now());
GWObjects::RadiusProxyPoolList NewPools;
if(SDK::GW::RADIUS::SetConfiguration(nullptr,RadiusConfig,NewPools)) {
AppServiceRegistry().Set("radiusEndpointLastUpdate", Utils::Now());
return true;
}
Error = "Could not update the controller.";
ErrorNum = 1;

return false;
}
private:
Expand Down
14 changes: 9 additions & 5 deletions src/sdks/SDK_gw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,10 @@ namespace OpenWifi::SDK::GW {
return false;
}

bool SetConfiguration(RESTAPIHandler *client, const GWObjects::RadiusProxyPoolList &Pools,
bool SetConfiguration(RESTAPIHandler *client, const Poco::JSON::Object &Configuration,
GWObjects::RadiusProxyPoolList &NewPools) {
Poco::JSON::Object Body;
Pools.to_json(Body);

OpenWifi::OpenAPIRequestPut R(OpenWifi::uSERVICE_GATEWAY,
"/api/v1/radiusProxyConfig", {}, Body,
"/api/v1/radiusProxyConfig", {}, Configuration,
60000);
auto CallResponse = Poco::makeShared<Poco::JSON::Object>();
auto ResponseStatus =
Expand All @@ -271,6 +268,13 @@ namespace OpenWifi::SDK::GW {
return false;
}

bool SetConfiguration(RESTAPIHandler *client, const GWObjects::RadiusProxyPoolList &Pools,
GWObjects::RadiusProxyPoolList &NewPools) {
Poco::JSON::Object Body;
Pools.to_json(Body);
return SetConfiguration(client,Body,NewPools);
}

}

} // namespace OpenWifi::SDK::GW
2 changes: 2 additions & 0 deletions src/sdks/SDK_gw.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ namespace OpenWifi::SDK::GW {
bool GetConfiguration(RESTAPIHandler *client, GWObjects::RadiusProxyPoolList &Pools);
bool SetConfiguration(RESTAPIHandler *client, const GWObjects::RadiusProxyPoolList &Pools,
GWObjects::RadiusProxyPoolList &NewPools);
bool SetConfiguration(RESTAPIHandler *client, const Poco::JSON::Object &Configuration,
GWObjects::RadiusProxyPoolList &NewPools);
}
} // namespace OpenWifi::SDK::GW

0 comments on commit aec3144

Please sign in to comment.