stephb9959
2023-10-04 15:38:49 -07:00
parent 14efffa612
commit aec31441d4
3 changed files with 21 additions and 6 deletions

View File

@@ -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 {
@@ -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:

View File

@@ -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 =
@@ -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

View File

@@ -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