mirror of
https://github.com/Telecominfraproject/wlan-cloud-owprov.git
synced 2025-10-29 17:52:28 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -5,113 +5,7 @@
|
||||
#pragma once
|
||||
#include <framework/AppServiceRegistry.h>
|
||||
#include <framework/utils.h>
|
||||
|
||||
/*
|
||||
|
||||
"request-attribute": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"vendor-id": {
|
||||
"type": "integer",
|
||||
"maximum": 65535,
|
||||
"minimum": 1
|
||||
},
|
||||
"vendor-attributes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"maximum": 255,
|
||||
"minimum": 1
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"maximum": 255,
|
||||
"minimum": 1
|
||||
},
|
||||
"value": {
|
||||
"type": "integer",
|
||||
"maximum": 4294967295,
|
||||
"minimum": 0
|
||||
}
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"id": 27,
|
||||
"value": 900
|
||||
},
|
||||
{
|
||||
"id": 56,
|
||||
"value": 1004
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"maximum": 255,
|
||||
"minimum": 1
|
||||
},
|
||||
"value": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"id": 32,
|
||||
"value": "My NAS ID"
|
||||
},
|
||||
{
|
||||
"id": 126,
|
||||
"value": "Example Operator"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"maximum": 255,
|
||||
"minimum": 1
|
||||
},
|
||||
"hex-value": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"examples": [
|
||||
{
|
||||
"id": 32,
|
||||
"value": "0a0b0c0d"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
*/
|
||||
#include <string>
|
||||
#include <StorageService.h>
|
||||
|
||||
namespace OpenWifi {
|
||||
class RadiusEndpointUpdater {
|
||||
@@ -119,6 +13,31 @@ namespace OpenWifi {
|
||||
inline bool UpdateEndpoints( [[maybe_unused]] std::string & Error,
|
||||
[[maybe_unused]] uint64_t &ErrorNum ) {
|
||||
|
||||
std::vector<ProvObjects::RADIUSEndPoint> Endpoints;
|
||||
StorageService()->RadiusEndpointDB().GetRecords(0,500,Endpoints);
|
||||
Poco::JSON::Array RadiusPools;
|
||||
|
||||
for(const auto &Endpoint:Endpoints) {
|
||||
Poco::JSON::Object PoolEntry;
|
||||
PoolEntry.set("description", Endpoint.info.description);
|
||||
PoolEntry.set("name", Endpoint.info.name);
|
||||
PoolEntry.set("useByDefault", false);
|
||||
PoolEntry.set("poolProxyIp", Endpoint.Index);
|
||||
PoolEntry.set("radsecPoolKeepAlive",25);
|
||||
if(Endpoint.Type=="orion") {
|
||||
PoolEntry.set("radsecPoolType","orion");
|
||||
} else if(Endpoint.Type=="radsec") {
|
||||
PoolEntry.set("radsecPoolType","radsec");
|
||||
} else if(Endpoint.Type=="radius") {
|
||||
PoolEntry.set("radsecPoolType","generic");
|
||||
} else if(Endpoint.Type=="globalreach") {
|
||||
PoolEntry.set("radsecPoolType","globalreach");
|
||||
}
|
||||
RadiusPools.add(PoolEntry);
|
||||
}
|
||||
Poco::JSON::Object RadiusConfig;
|
||||
RadiusConfig.set("pools", RadiusPools);
|
||||
|
||||
AppServiceRegistry().Set("radiusEndpointLastUpdate", Utils::Now());
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user