mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralfms.git
synced 2025-10-29 18:02:20 +00:00
Compare commits
11 Commits
v2.9.0-RC2
...
release/v2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8eea15ae7d | ||
|
|
3ddfb01961 | ||
|
|
bd5ae332bd | ||
|
|
28dcf0085c | ||
|
|
f1a687f6e1 | ||
|
|
d2bae99b3c | ||
|
|
180d8d1502 | ||
|
|
bd7eca32f4 | ||
|
|
43658550df | ||
|
|
c113fc24c5 | ||
|
|
5ddbd0bad3 |
@@ -1,5 +1,5 @@
|
|||||||
cmake_minimum_required(VERSION 3.13)
|
cmake_minimum_required(VERSION 3.13)
|
||||||
project(owfms VERSION 2.9.0)
|
project(owfms VERSION 2.10.0)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
@@ -117,6 +117,7 @@ add_executable( owfms
|
|||||||
src/framework/RESTAPI_PartHandler.h
|
src/framework/RESTAPI_PartHandler.h
|
||||||
src/framework/MicroService.cpp
|
src/framework/MicroService.cpp
|
||||||
src/framework/MicroServiceExtra.h
|
src/framework/MicroServiceExtra.h
|
||||||
|
src/framework/default_device_types.h
|
||||||
src/RESTObjects/RESTAPI_SecurityObjects.h src/RESTObjects/RESTAPI_SecurityObjects.cpp
|
src/RESTObjects/RESTAPI_SecurityObjects.h src/RESTObjects/RESTAPI_SecurityObjects.cpp
|
||||||
src/RESTObjects/RESTAPI_GWobjects.h src/RESTObjects/RESTAPI_GWobjects.cpp
|
src/RESTObjects/RESTAPI_GWobjects.h src/RESTObjects/RESTAPI_GWobjects.cpp
|
||||||
src/RESTObjects/RESTAPI_FMSObjects.h src/RESTObjects/RESTAPI_FMSObjects.cpp
|
src/RESTObjects/RESTAPI_FMSObjects.h src/RESTObjects/RESTAPI_FMSObjects.cpp
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ s3.secret = *******************************************
|
|||||||
s3.key = *******************************************
|
s3.key = *******************************************
|
||||||
s3.retry = 60
|
s3.retry = 60
|
||||||
s3.bucket.uri = ucentral-ap-firmware.s3.amazonaws.com
|
s3.bucket.uri = ucentral-ap-firmware.s3.amazonaws.com
|
||||||
|
s3.endpoint.https = true
|
||||||
|
s3.endpointOverride = ""
|
||||||
|
s3.useVirtualAdressing = true
|
||||||
```
|
```
|
||||||
|
|
||||||
#### s3.bucketname
|
#### s3.bucketname
|
||||||
@@ -44,6 +47,12 @@ The AWS key for access for this S3 bucket
|
|||||||
The AWS retry window in seconds.
|
The AWS retry window in seconds.
|
||||||
#### s3.bucket.uri = ucentral-ap-firmware.s3.amazonaws.com
|
#### s3.bucket.uri = ucentral-ap-firmware.s3.amazonaws.com
|
||||||
The URI to the S3 bucket
|
The URI to the S3 bucket
|
||||||
|
#### s3.endpointOverride = ""
|
||||||
|
The Endpoint Address to override if you using a different provider that not AWS.
|
||||||
|
#### s3.endpoint.https = true
|
||||||
|
The Endpoint Method if you using a HTTP endpoint
|
||||||
|
#### s3.useVirtualAdressing = true
|
||||||
|
In a virtual-hosted–style URI, the bucket name is part of the domain name in the URL. (Not supported by all providers)
|
||||||
|
|
||||||
## Generic OpenWiFi SDK parameters
|
## Generic OpenWiFi SDK parameters
|
||||||
### REST API External parameters
|
### REST API External parameters
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ if [[ "$TEMPLATE_CONFIG" = 'true' ]]; then
|
|||||||
SECURITY_RESTAPI_DISABLE=${SECURITY_RESTAPI_DISABLE:-"false"} \
|
SECURITY_RESTAPI_DISABLE=${SECURITY_RESTAPI_DISABLE:-"false"} \
|
||||||
FIRMWAREDB_REFRESH=${FIRMWAREDB_REFRESH:-"86400"} \
|
FIRMWAREDB_REFRESH=${FIRMWAREDB_REFRESH:-"86400"} \
|
||||||
FIRMWAREDB_MAXAGE=${FIRMWAREDB_MAXAGE:-"90"} \
|
FIRMWAREDB_MAXAGE=${FIRMWAREDB_MAXAGE:-"90"} \
|
||||||
|
S3_VIRTUAL_ADRESSING=${S3_VIRTUAL_ADRESSING:-"true"} \
|
||||||
|
S3_HTTPS=${S3_HTTPS:-"true"} \
|
||||||
|
S3_ENDPOINT=${S3_ENDPOINT:-""} \
|
||||||
S3_BUCKETNAME=${S3_BUCKETNAME:-"ucentral-ap-firmware"} \
|
S3_BUCKETNAME=${S3_BUCKETNAME:-"ucentral-ap-firmware"} \
|
||||||
S3_REGION=${S3_REGION:-"us-east-1"} \
|
S3_REGION=${S3_REGION:-"us-east-1"} \
|
||||||
S3_SECRET=${S3_SECRET:-"*******************************************"} \
|
S3_SECRET=${S3_SECRET:-"*******************************************"} \
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ fullnameOverride: ""
|
|||||||
images:
|
images:
|
||||||
owfms:
|
owfms:
|
||||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owfms
|
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owfms
|
||||||
tag: main
|
tag: v2.10.0
|
||||||
pullPolicy: Always
|
pullPolicy: Always
|
||||||
# regcred:
|
# regcred:
|
||||||
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
||||||
@@ -143,6 +143,9 @@ configProperties:
|
|||||||
openwifi.internal.restapi.host.0.cert: $OWFMS_ROOT/certs/restapi-cert.pem
|
openwifi.internal.restapi.host.0.cert: $OWFMS_ROOT/certs/restapi-cert.pem
|
||||||
openwifi.internal.restapi.host.0.key: $OWFMS_ROOT/certs/restapi-key.pem
|
openwifi.internal.restapi.host.0.key: $OWFMS_ROOT/certs/restapi-key.pem
|
||||||
# Firmware Microservice Specific Section
|
# Firmware Microservice Specific Section
|
||||||
|
s3.endpointOverride: ""
|
||||||
|
s3.useVirtualAdressing: true
|
||||||
|
s3.endpoint.https: true
|
||||||
s3.bucketname: ucentral-ap-firmware
|
s3.bucketname: ucentral-ap-firmware
|
||||||
s3.region: us-east-1
|
s3.region: us-east-1
|
||||||
s3.retry: 60
|
s3.retry: 60
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ firmwaredb.maxage = 90
|
|||||||
#
|
#
|
||||||
# Firmware Microservice Specific Section
|
# Firmware Microservice Specific Section
|
||||||
#
|
#
|
||||||
|
s3.useVirtualAdressing = true
|
||||||
|
s3.endpoint.https = true
|
||||||
s3.bucketname = ucentral-ap-firmware
|
s3.bucketname = ucentral-ap-firmware
|
||||||
s3.region = us-east-1
|
s3.region = us-east-1
|
||||||
s3.secret = *******************************************
|
s3.secret = *******************************************
|
||||||
|
|||||||
@@ -44,6 +44,9 @@ firmwaredb.maxage = ${FIRMWAREDB_MAXAGE}
|
|||||||
#
|
#
|
||||||
# Firmware Microservice Specific Section
|
# Firmware Microservice Specific Section
|
||||||
#
|
#
|
||||||
|
s3.useVirtualAdressing = ${S3_VIRTUAL_ADRESSING}
|
||||||
|
s3.endpointOverride = ${S3_ENDPOINT}
|
||||||
|
s3.endpoint.https = ${S3_HTTPS}
|
||||||
s3.bucketname = ${S3_BUCKETNAME}
|
s3.bucketname = ${S3_BUCKETNAME}
|
||||||
s3.region = ${S3_REGION}
|
s3.region = ${S3_REGION}
|
||||||
s3.secret = ${S3_SECRET}
|
s3.secret = ${S3_SECRET}
|
||||||
|
|||||||
@@ -148,6 +148,9 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
int ManifestCreator::Start() {
|
int ManifestCreator::Start() {
|
||||||
Running_ = true;
|
Running_ = true;
|
||||||
|
S3EndpointOverride_ = MicroServiceConfigGetString("s3.endpointOverride", "");
|
||||||
|
S3EndpointHttps_ = MicroServiceConfigGetBool("s3.endpoint.https", true);
|
||||||
|
S3UseVirtualAdressing_ = MicroServiceConfigGetBool("s3.useVirtualAdressing", true);
|
||||||
S3BucketName_ = MicroServiceConfigGetString("s3.bucketname", "");
|
S3BucketName_ = MicroServiceConfigGetString("s3.bucketname", "");
|
||||||
S3Region_ = MicroServiceConfigGetString("s3.region", "");
|
S3Region_ = MicroServiceConfigGetString("s3.region", "");
|
||||||
S3Secret_ = MicroServiceConfigGetString("s3.secret", "");
|
S3Secret_ = MicroServiceConfigGetString("s3.secret", "");
|
||||||
@@ -160,6 +163,12 @@ namespace OpenWifi {
|
|||||||
AwsConfig_.enableTcpKeepAlive = true;
|
AwsConfig_.enableTcpKeepAlive = true;
|
||||||
AwsConfig_.enableEndpointDiscovery = true;
|
AwsConfig_.enableEndpointDiscovery = true;
|
||||||
AwsConfig_.useDualStack = true;
|
AwsConfig_.useDualStack = true;
|
||||||
|
if(!S3EndpointHttps_)
|
||||||
|
AwsConfig_.scheme = Aws::Http::Scheme::HTTP;
|
||||||
|
if(!S3EndpointOverride_.empty()) {
|
||||||
|
AwsConfig_.endpointOverride = Aws::String(S3EndpointOverride_);
|
||||||
|
AwsConfig_.useDualStack = false;
|
||||||
|
}
|
||||||
if (!S3Region_.empty())
|
if (!S3Region_.empty())
|
||||||
AwsConfig_.region = S3Region_;
|
AwsConfig_.region = S3Region_;
|
||||||
AwsCreds_.SetAWSAccessKeyId(S3Key_);
|
AwsCreds_.SetAWSAccessKeyId(S3Key_);
|
||||||
@@ -214,7 +223,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
Aws::S3::Model::ListObjectsV2Request Request;
|
Aws::S3::Model::ListObjectsV2Request Request;
|
||||||
Request.WithBucket(S3BucketName_.c_str());
|
Request.WithBucket(S3BucketName_.c_str());
|
||||||
Aws::S3::S3Client S3Client(AwsCreds_, AwsConfig_);
|
Aws::S3::S3Client S3Client(AwsCreds_, AwsConfig_, Aws::Client::AWSAuthV4Signer::PayloadSigningPolicy::Never, S3UseVirtualAdressing_);
|
||||||
Request.SetMaxKeys(100);
|
Request.SetMaxKeys(100);
|
||||||
Aws::S3::Model::ListObjectsV2Outcome Outcome;
|
Aws::S3::Model::ListObjectsV2Outcome Outcome;
|
||||||
|
|
||||||
@@ -317,7 +326,8 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
// std::cout << "Count:" << Count << " Runs:" << Runs << std::endl;
|
// std::cout << "Count:" << Count << " Runs:" << Runs << std::endl;
|
||||||
if (!Outcome.IsSuccess()) {
|
if (!Outcome.IsSuccess()) {
|
||||||
poco_error(Logger(), fmt::format("Error while doing ListObjectsV2: {}, {}",
|
poco_error(Logger(), fmt::format("Run({},{}) Error while doing ListObjectsV2: {}, {}",
|
||||||
|
Runs, Count,
|
||||||
std::string{Outcome.GetError().GetExceptionName()},
|
std::string{Outcome.GetError().GetExceptionName()},
|
||||||
std::string{Outcome.GetError().GetMessage()}));
|
std::string{Outcome.GetError().GetMessage()}));
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
std::atomic_bool Running_ = false;
|
std::atomic_bool Running_ = false;
|
||||||
|
Aws::String S3EndpointOverride_;
|
||||||
|
bool S3EndpointHttps_;
|
||||||
|
bool S3UseVirtualAdressing_;
|
||||||
Aws::String S3BucketName_;
|
Aws::String S3BucketName_;
|
||||||
Aws::String S3Region_;
|
Aws::String S3Region_;
|
||||||
Aws::String S3Key_;
|
Aws::String S3Key_;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#ifdef TIP_GATEWAY_SERVICE
|
#ifdef TIP_GATEWAY_SERVICE
|
||||||
#include "AP_WS_Server.h"
|
#include "AP_WS_Server.h"
|
||||||
#include "CapabilitiesCache.h"
|
#include "CapabilitiesCache.h"
|
||||||
|
#include "RADIUSSessionTracker.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "RESTAPI_GWobjects.h"
|
#include "RESTAPI_GWobjects.h"
|
||||||
@@ -29,6 +30,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj, "serialNumber", SerialNumber);
|
field_to_json(Obj, "serialNumber", SerialNumber);
|
||||||
#ifdef TIP_GATEWAY_SERVICE
|
#ifdef TIP_GATEWAY_SERVICE
|
||||||
field_to_json(Obj, "deviceType", CapabilitiesCache::instance()->GetPlatform(Compatible));
|
field_to_json(Obj, "deviceType", CapabilitiesCache::instance()->GetPlatform(Compatible));
|
||||||
|
field_to_json(Obj, "hasRADIUSSessions", RADIUSSessionTracker()->HasSessions(SerialNumber));
|
||||||
#endif
|
#endif
|
||||||
field_to_json(Obj, "macAddress", MACAddress);
|
field_to_json(Obj, "macAddress", MACAddress);
|
||||||
field_to_json(Obj, "manufacturer", Manufacturer);
|
field_to_json(Obj, "manufacturer", Manufacturer);
|
||||||
@@ -54,6 +56,9 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj, "pendingConfiguration", pendingConfiguration);
|
field_to_json(Obj, "pendingConfiguration", pendingConfiguration);
|
||||||
field_to_json(Obj, "pendingConfigurationCmd", pendingConfigurationCmd);
|
field_to_json(Obj, "pendingConfigurationCmd", pendingConfigurationCmd);
|
||||||
field_to_json(Obj, "restrictionDetails", restrictionDetails);
|
field_to_json(Obj, "restrictionDetails", restrictionDetails);
|
||||||
|
field_to_json(Obj, "pendingUUID", pendingUUID);
|
||||||
|
field_to_json(Obj, "simulated", simulated);
|
||||||
|
field_to_json(Obj, "lastRecordedContact", lastRecordedContact);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Device::to_json_with_status(Poco::JSON::Object &Obj) const {
|
void Device::to_json_with_status(Poco::JSON::Object &Obj) const {
|
||||||
@@ -63,7 +68,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
ConnectionState ConState;
|
ConnectionState ConState;
|
||||||
|
|
||||||
if (AP_WS_Server()->GetState(SerialNumber, ConState)) {
|
if (AP_WS_Server()->GetState(SerialNumber, ConState)) {
|
||||||
ConState.to_json(Obj);
|
ConState.to_json(SerialNumber,Obj);
|
||||||
} else {
|
} else {
|
||||||
field_to_json(Obj, "ipAddress", "");
|
field_to_json(Obj, "ipAddress", "");
|
||||||
field_to_json(Obj, "txBytes", (uint64_t)0);
|
field_to_json(Obj, "txBytes", (uint64_t)0);
|
||||||
@@ -75,6 +80,13 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj, "associations_2G", (uint64_t)0);
|
field_to_json(Obj, "associations_2G", (uint64_t)0);
|
||||||
field_to_json(Obj, "associations_5G", (uint64_t)0);
|
field_to_json(Obj, "associations_5G", (uint64_t)0);
|
||||||
field_to_json(Obj, "associations_6G", (uint64_t)0);
|
field_to_json(Obj, "associations_6G", (uint64_t)0);
|
||||||
|
field_to_json(Obj, "hasRADIUSSessions", false);
|
||||||
|
field_to_json(Obj, "hasGPS", ConState.hasGPS);
|
||||||
|
field_to_json(Obj, "sanity", ConState.sanity);
|
||||||
|
field_to_json(Obj, "memoryUsed", ConState.memoryUsed);
|
||||||
|
field_to_json(Obj, "sanity", ConState.sanity);
|
||||||
|
field_to_json(Obj, "load", ConState.load);
|
||||||
|
field_to_json(Obj, "temperature", ConState.temperature);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -84,20 +96,32 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_from_json(Obj, "serialNumber", SerialNumber);
|
field_from_json(Obj, "serialNumber", SerialNumber);
|
||||||
field_from_json(Obj, "deviceType", DeviceType);
|
field_from_json(Obj, "deviceType", DeviceType);
|
||||||
field_from_json(Obj, "macAddress", MACAddress);
|
field_from_json(Obj, "macAddress", MACAddress);
|
||||||
|
field_from_json(Obj, "manufacturer", Manufacturer);
|
||||||
|
field_from_json(Obj, "UUID", UUID);
|
||||||
field_from_json(Obj, "configuration", Configuration);
|
field_from_json(Obj, "configuration", Configuration);
|
||||||
field_from_json(Obj, "notes", Notes);
|
field_from_json(Obj, "notes", Notes);
|
||||||
field_from_json(Obj, "manufacturer", Manufacturer);
|
field_from_json(Obj, "createdTimestamp", CreationTimestamp);
|
||||||
|
field_from_json(Obj, "lastConfigurationChange", LastConfigurationChange);
|
||||||
|
field_from_json(Obj, "lastConfigurationDownload", LastConfigurationDownload);
|
||||||
|
field_from_json(Obj, "lastFWUpdate", LastFWUpdate);
|
||||||
field_from_json(Obj, "owner", Owner);
|
field_from_json(Obj, "owner", Owner);
|
||||||
field_from_json(Obj, "location", Location);
|
field_from_json(Obj, "location", Location);
|
||||||
field_from_json(Obj, "venue", Venue);
|
field_from_json(Obj, "venue", Venue);
|
||||||
|
field_from_json(Obj, "firmware", Firmware);
|
||||||
field_from_json(Obj, "compatible", Compatible);
|
field_from_json(Obj, "compatible", Compatible);
|
||||||
|
field_from_json(Obj, "fwUpdatePolicy", FWUpdatePolicy);
|
||||||
|
field_from_json(Obj, "devicePassword", DevicePassword);
|
||||||
field_from_json(Obj, "subscriber", subscriber);
|
field_from_json(Obj, "subscriber", subscriber);
|
||||||
field_from_json(Obj, "entity", entity);
|
field_from_json(Obj, "entity", entity);
|
||||||
|
field_from_json(Obj, "modified", modified);
|
||||||
field_from_json(Obj, "locale", locale);
|
field_from_json(Obj, "locale", locale);
|
||||||
field_from_json(Obj, "restrictedDevice", restrictedDevice);
|
field_from_json(Obj, "restrictedDevice", restrictedDevice);
|
||||||
field_from_json(Obj, "pendingConfiguration", pendingConfiguration);
|
field_from_json(Obj, "pendingConfiguration", pendingConfiguration);
|
||||||
field_from_json(Obj, "pendingConfigurationCmd", pendingConfigurationCmd);
|
field_from_json(Obj, "pendingConfigurationCmd", pendingConfigurationCmd);
|
||||||
field_from_json(Obj, "restrictionDetails", restrictionDetails);
|
field_from_json(Obj, "restrictionDetails", restrictionDetails);
|
||||||
|
field_from_json(Obj, "pendingUUID", pendingUUID);
|
||||||
|
field_from_json(Obj, "simulated", simulated);
|
||||||
|
field_from_json(Obj, "lastRecordedContact", lastRecordedContact);
|
||||||
return true;
|
return true;
|
||||||
} catch (const Poco::Exception &E) {
|
} catch (const Poco::Exception &E) {
|
||||||
}
|
}
|
||||||
@@ -165,6 +189,8 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj, "waitingForFile", WaitingForFile);
|
field_to_json(Obj, "waitingForFile", WaitingForFile);
|
||||||
field_to_json(Obj, "attachFile", AttachDate);
|
field_to_json(Obj, "attachFile", AttachDate);
|
||||||
field_to_json(Obj, "executionTime", executionTime);
|
field_to_json(Obj, "executionTime", executionTime);
|
||||||
|
field_to_json(Obj, "lastTry", lastTry);
|
||||||
|
field_to_json(Obj, "deferred", deferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DefaultConfiguration::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
bool DefaultConfiguration::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
@@ -198,7 +224,7 @@ namespace OpenWifi::GWObjects {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConnectionState::to_json(Poco::JSON::Object &Obj) const {
|
void ConnectionState::to_json([[maybe_unused]] const std::string &SerialNumber, Poco::JSON::Object &Obj) {
|
||||||
field_to_json(Obj, "ipAddress", Address);
|
field_to_json(Obj, "ipAddress", Address);
|
||||||
field_to_json(Obj, "txBytes", TX);
|
field_to_json(Obj, "txBytes", TX);
|
||||||
field_to_json(Obj, "rxBytes", RX);
|
field_to_json(Obj, "rxBytes", RX);
|
||||||
@@ -220,6 +246,20 @@ namespace OpenWifi::GWObjects {
|
|||||||
field_to_json(Obj, "connectionCompletionTime", connectionCompletionTime);
|
field_to_json(Obj, "connectionCompletionTime", connectionCompletionTime);
|
||||||
field_to_json(Obj, "totalConnectionTime", Utils::Now() - started);
|
field_to_json(Obj, "totalConnectionTime", Utils::Now() - started);
|
||||||
field_to_json(Obj, "certificateExpiryDate", certificateExpiryDate);
|
field_to_json(Obj, "certificateExpiryDate", certificateExpiryDate);
|
||||||
|
#ifdef TIP_GATEWAY_SERVICE
|
||||||
|
hasRADIUSSessions = RADIUSSessionTracker()->HasSessions(SerialNumber);
|
||||||
|
AP_WS_Server()->ExtendedAttributes(SerialNumber, hasGPS, sanity,
|
||||||
|
memoryUsed,
|
||||||
|
load,
|
||||||
|
temperature);
|
||||||
|
#endif
|
||||||
|
field_to_json(Obj, "hasRADIUSSessions", hasRADIUSSessions );
|
||||||
|
field_to_json(Obj, "hasGPS", hasGPS);
|
||||||
|
field_to_json(Obj, "sanity", sanity);
|
||||||
|
field_to_json(Obj, "memoryUsed", memoryUsed);
|
||||||
|
field_to_json(Obj, "sanity", sanity);
|
||||||
|
field_to_json(Obj, "load", load);
|
||||||
|
field_to_json(Obj, "temperature", temperature);
|
||||||
|
|
||||||
switch (VerifiedCertificate) {
|
switch (VerifiedCertificate) {
|
||||||
case NO_CERTIFICATE:
|
case NO_CERTIFICATE:
|
||||||
@@ -234,6 +274,9 @@ namespace OpenWifi::GWObjects {
|
|||||||
case VERIFIED:
|
case VERIFIED:
|
||||||
field_to_json(Obj, "verifiedCertificate", "VERIFIED");
|
field_to_json(Obj, "verifiedCertificate", "VERIFIED");
|
||||||
break;
|
break;
|
||||||
|
case SIMULATED:
|
||||||
|
field_to_json(Obj, "verifiedCertificate", "SIMULATED");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
field_to_json(Obj, "verifiedCertificate", "NO_CERTIFICATE");
|
field_to_json(Obj, "verifiedCertificate", "NO_CERTIFICATE");
|
||||||
break;
|
break;
|
||||||
@@ -490,6 +533,29 @@ namespace OpenWifi::GWObjects {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RangeOptions::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj, "NO_IR", NO_IR);
|
||||||
|
field_to_json(Obj, "AUTO_BW", AUTO_BW);
|
||||||
|
field_to_json(Obj, "DFS", DFS);
|
||||||
|
field_to_json(Obj, "NO_OUTDOOR", NO_OUTDOOR);
|
||||||
|
field_to_json(Obj, "wmmrule_ETSI", wmmrule_ETSI);
|
||||||
|
field_to_json(Obj, "NO_OFDM", NO_OFDM);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FrequencyRange::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj, "from", from);
|
||||||
|
field_to_json(Obj, "to", to);
|
||||||
|
field_to_json(Obj, "channelWidth", channelWidth);
|
||||||
|
field_to_json(Obj, "powerDb", powerDb);
|
||||||
|
field_to_json(Obj, "options", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RegulatoryCountryInfo::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj, "country", country);
|
||||||
|
field_to_json(Obj, "domain", domain);
|
||||||
|
field_to_json(Obj, "ranges", ranges);
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceRestrictionsKeyInfo::to_json(Poco::JSON::Object &Obj) const {
|
void DeviceRestrictionsKeyInfo::to_json(Poco::JSON::Object &Obj) const {
|
||||||
field_to_json(Obj, "vendor", vendor);
|
field_to_json(Obj, "vendor", vendor);
|
||||||
field_to_json(Obj, "algo", algo);
|
field_to_json(Obj, "algo", algo);
|
||||||
@@ -544,4 +610,42 @@ namespace OpenWifi::GWObjects {
|
|||||||
(T.commands != commands) || (T.developer != developer) || (T.ssh != ssh) ||
|
(T.commands != commands) || (T.developer != developer) || (T.ssh != ssh) ||
|
||||||
(T.key_info != key_info) || (T.country != country));
|
(T.key_info != key_info) || (T.country != country));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RADIUSSession::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj, "started", started);
|
||||||
|
field_to_json(Obj, "lastTransaction", lastTransaction);
|
||||||
|
field_to_json(Obj, "destination", destination);
|
||||||
|
field_to_json(Obj, "serialNumber", serialNumber);
|
||||||
|
field_to_json(Obj, "userName", userName);
|
||||||
|
field_to_json(Obj, "accountingSessionId", accountingSessionId);
|
||||||
|
field_to_json(Obj, "accountingMultiSessionId", accountingMultiSessionId);
|
||||||
|
field_to_json(Obj, "inputPackets", inputPackets);
|
||||||
|
field_to_json(Obj, "outputPackets", outputPackets);
|
||||||
|
field_to_json(Obj, "inputOctets", inputOctets);
|
||||||
|
field_to_json(Obj, "outputOctets", outputOctets);
|
||||||
|
field_to_json(Obj, "inputGigaWords", inputGigaWords);
|
||||||
|
field_to_json(Obj, "outputGigaWords", outputGigaWords);
|
||||||
|
field_to_json(Obj, "sessionTime", sessionTime);
|
||||||
|
field_to_json(Obj, "callingStationId", callingStationId);
|
||||||
|
field_to_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
|
||||||
|
field_to_json(Obj, "interface", interface);
|
||||||
|
field_to_json(Obj, "secret", secret);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RADIUSSessionList::to_json(Poco::JSON::Object &Obj) const {
|
||||||
|
field_to_json(Obj, "sessions", sessions);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool RadiusCoADMParameters::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||||
|
try {
|
||||||
|
field_from_json(Obj, "accountingSessionId", accountingSessionId);
|
||||||
|
field_from_json(Obj, "accountingMultiSessionId", accountingMultiSessionId);
|
||||||
|
field_from_json(Obj, "callingStationId", callingStationId);
|
||||||
|
field_from_json(Obj, "chargeableUserIdentity", chargeableUserIdentity);
|
||||||
|
return true;
|
||||||
|
} catch (const Poco::Exception &E) {
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace OpenWifi::GWObjects
|
} // namespace OpenWifi::GWObjects
|
||||||
|
|||||||
@@ -11,9 +11,13 @@
|
|||||||
#include "Poco/JSON/Object.h"
|
#include "Poco/JSON/Object.h"
|
||||||
#include "RESTAPI_SecurityObjects.h"
|
#include "RESTAPI_SecurityObjects.h"
|
||||||
|
|
||||||
|
#ifdef TIP_GATEWAY_SERVICE
|
||||||
|
#include <RADIUS_helpers.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace OpenWifi::GWObjects {
|
namespace OpenWifi::GWObjects {
|
||||||
|
|
||||||
enum CertificateValidation { NO_CERTIFICATE, VALID_CERTIFICATE, MISMATCH_SERIAL, VERIFIED };
|
enum CertificateValidation { NO_CERTIFICATE, VALID_CERTIFICATE, MISMATCH_SERIAL, VERIFIED, SIMULATED };
|
||||||
|
|
||||||
struct ConnectionState {
|
struct ConnectionState {
|
||||||
uint64_t MessageCount = 0;
|
uint64_t MessageCount = 0;
|
||||||
@@ -38,8 +42,14 @@ namespace OpenWifi::GWObjects {
|
|||||||
uint64_t sessionId = 0;
|
uint64_t sessionId = 0;
|
||||||
double connectionCompletionTime = 0.0;
|
double connectionCompletionTime = 0.0;
|
||||||
std::uint64_t certificateExpiryDate = 0;
|
std::uint64_t certificateExpiryDate = 0;
|
||||||
|
bool hasRADIUSSessions = false;
|
||||||
|
bool hasGPS = false;
|
||||||
|
std::uint64_t sanity=0;
|
||||||
|
std::double_t memoryUsed=0.0;
|
||||||
|
std::double_t load=0.0;
|
||||||
|
std::double_t temperature=0.0;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(const std::string &SerialNumber, Poco::JSON::Object &Obj) ;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DeviceRestrictionsKeyInfo {
|
struct DeviceRestrictionsKeyInfo {
|
||||||
@@ -96,6 +106,9 @@ namespace OpenWifi::GWObjects {
|
|||||||
std::string pendingConfiguration;
|
std::string pendingConfiguration;
|
||||||
std::string pendingConfigurationCmd;
|
std::string pendingConfigurationCmd;
|
||||||
DeviceRestrictions restrictionDetails;
|
DeviceRestrictions restrictionDetails;
|
||||||
|
std::uint64_t pendingUUID = 0;
|
||||||
|
bool simulated=false;
|
||||||
|
std::uint64_t lastRecordedContact=0;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
void to_json_with_status(Poco::JSON::Object &Obj) const;
|
void to_json_with_status(Poco::JSON::Object &Obj) const;
|
||||||
@@ -188,7 +201,11 @@ namespace OpenWifi::GWObjects {
|
|||||||
uint64_t AttachSize = 0;
|
uint64_t AttachSize = 0;
|
||||||
std::string AttachType;
|
std::string AttachType;
|
||||||
double executionTime = 0.0;
|
double executionTime = 0.0;
|
||||||
|
std::uint64_t lastTry = 0;
|
||||||
|
bool deferred = false;
|
||||||
|
|
||||||
void to_json(Poco::JSON::Object &Obj) const;
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BlackListedDevice {
|
struct BlackListedDevice {
|
||||||
@@ -334,4 +351,76 @@ namespace OpenWifi::GWObjects {
|
|||||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct RangeOptions {
|
||||||
|
bool NO_IR=false;
|
||||||
|
bool AUTO_BW=false;
|
||||||
|
bool DFS=false;
|
||||||
|
bool NO_OUTDOOR=false;
|
||||||
|
bool wmmrule_ETSI=false;
|
||||||
|
bool NO_OFDM=false;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FrequencyRange {
|
||||||
|
float from = 0.0;
|
||||||
|
float to = 0.0;
|
||||||
|
int channelWidth = 0;
|
||||||
|
int powerDb = 0;
|
||||||
|
RangeOptions options;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RegulatoryCountryInfo {
|
||||||
|
std::string country;
|
||||||
|
std::string domain;
|
||||||
|
std::vector<FrequencyRange> ranges;
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
using RegulatoryInfoCountryMap = std::map<std::string,RegulatoryCountryInfo>;
|
||||||
|
|
||||||
|
struct RADIUSSession {
|
||||||
|
std::uint64_t started=0,
|
||||||
|
lastTransaction=0;
|
||||||
|
std::string serialNumber,
|
||||||
|
destination,
|
||||||
|
userName,
|
||||||
|
accountingSessionId,
|
||||||
|
accountingMultiSessionId,
|
||||||
|
callingStationId,
|
||||||
|
chargeableUserIdentity,
|
||||||
|
secret,
|
||||||
|
interface;
|
||||||
|
std::uint64_t inputPackets = 0,
|
||||||
|
outputPackets = 0,
|
||||||
|
inputOctets = 0,
|
||||||
|
outputOctets = 0,
|
||||||
|
inputGigaWords = 0,
|
||||||
|
outputGigaWords = 0;
|
||||||
|
std::uint32_t sessionTime = 0;
|
||||||
|
|
||||||
|
#ifdef TIP_GATEWAY_SERVICE
|
||||||
|
RADIUS::RadiusPacket accountingPacket;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RADIUSSessionList {
|
||||||
|
std::vector<RADIUSSession> sessions;
|
||||||
|
void to_json(Poco::JSON::Object &Obj) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RadiusCoADMParameters {
|
||||||
|
std::string accountingSessionId,
|
||||||
|
accountingMultiSessionId,
|
||||||
|
callingStationId,
|
||||||
|
chargeableUserIdentity;
|
||||||
|
|
||||||
|
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace OpenWifi::GWObjects
|
} // namespace OpenWifi::GWObjects
|
||||||
|
|||||||
@@ -14,18 +14,18 @@ namespace OpenWifi {
|
|||||||
void EventBusManager::run() {
|
void EventBusManager::run() {
|
||||||
Running_ = true;
|
Running_ = true;
|
||||||
Utils::SetThreadName("fmwk:EventMgr");
|
Utils::SetThreadName("fmwk:EventMgr");
|
||||||
auto Msg = MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_JOIN);
|
auto Msg = std::make_shared<std::string>(MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_JOIN));
|
||||||
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg,
|
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg,
|
||||||
false);
|
false);
|
||||||
while (Running_) {
|
while (Running_) {
|
||||||
Poco::Thread::trySleep((unsigned long)MicroServiceDaemonBusTimer());
|
Poco::Thread::trySleep((unsigned long)MicroServiceDaemonBusTimer());
|
||||||
if (!Running_)
|
if (!Running_)
|
||||||
break;
|
break;
|
||||||
Msg = MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE);
|
Msg = std::make_shared<std::string>(MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_KEEP_ALIVE));
|
||||||
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(),
|
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(),
|
||||||
Msg, false);
|
Msg, false);
|
||||||
}
|
}
|
||||||
Msg = MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_LEAVE);
|
Msg = std::make_shared<std::string>(MicroServiceMakeSystemEventMessage(KafkaTopics::ServiceEvents::EVENT_LEAVE));
|
||||||
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg,
|
KafkaManager()->PostMessage(KafkaTopics::SERVICE_EVENTS, MicroServicePrivateEndPoint(), Msg,
|
||||||
false);
|
false);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -180,7 +180,7 @@ namespace OpenWifi {
|
|||||||
Consumer.async_commit(Msg);
|
Consumer.async_commit(Msg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
KafkaManager()->Dispatch(Msg.get_topic(), Msg.get_key(), Msg.get_payload());
|
KafkaManager()->Dispatch(Msg.get_topic().c_str(), Msg.get_key(), std::make_shared<std::string>(Msg.get_payload()));
|
||||||
if (!AutoCommit)
|
if (!AutoCommit)
|
||||||
Consumer.async_commit(Msg);
|
Consumer.async_commit(Msg);
|
||||||
}
|
}
|
||||||
@@ -212,8 +212,8 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KafkaProducer::Produce(const std::string &Topic, const std::string &Key,
|
void KafkaProducer::Produce(const char *Topic, const std::string &Key,
|
||||||
const std::string &Payload) {
|
const std::shared_ptr<std::string> Payload) {
|
||||||
std::lock_guard G(Mutex_);
|
std::lock_guard G(Mutex_);
|
||||||
Queue_.enqueueNotification(new KafkaMessage(Topic, Key, Payload));
|
Queue_.enqueueNotification(new KafkaMessage(Topic, Key, Payload));
|
||||||
}
|
}
|
||||||
@@ -275,8 +275,8 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KafkaDispatcher::Dispatch(const std::string &Topic, const std::string &Key,
|
void KafkaDispatcher::Dispatch(const char *Topic, const std::string &Key,
|
||||||
const std::string &Payload) {
|
const std::shared_ptr<std::string> Payload) {
|
||||||
std::lock_guard G(Mutex_);
|
std::lock_guard G(Mutex_);
|
||||||
auto It = Notifiers_.find(Topic);
|
auto It = Notifiers_.find(Topic);
|
||||||
if (It != Notifiers_.end()) {
|
if (It != Notifiers_.end()) {
|
||||||
@@ -332,20 +332,21 @@ namespace OpenWifi {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KafkaManager::PostMessage(const std::string &topic, const std::string &key,
|
void KafkaManager::PostMessage(const char *topic, const std::string &key,
|
||||||
const std::string &PayLoad, bool WrapMessage) {
|
const std::shared_ptr<std::string> PayLoad, bool WrapMessage) {
|
||||||
if (KafkaEnabled_) {
|
if (KafkaEnabled_) {
|
||||||
ProducerThr_.Produce(topic, key, WrapMessage ? WrapSystemId(PayLoad) : PayLoad);
|
ProducerThr_.Produce(topic, key, WrapMessage ? WrapSystemId(PayLoad) : PayLoad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void KafkaManager::Dispatch(const std::string &Topic, const std::string &Key,
|
void KafkaManager::Dispatch(const char *Topic, const std::string &Key,
|
||||||
const std::string &Payload) {
|
const std::shared_ptr<std::string> Payload) {
|
||||||
Dispatcher_.Dispatch(Topic, Key, Payload);
|
Dispatcher_.Dispatch(Topic, Key, Payload);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] std::string KafkaManager::WrapSystemId(const std::string &PayLoad) {
|
[[nodiscard]] const std::shared_ptr<std::string> KafkaManager::WrapSystemId(const std::shared_ptr<std::string> PayLoad) {
|
||||||
return SystemInfoWrapper_ + PayLoad + "}";
|
*PayLoad = SystemInfoWrapper_ + *PayLoad + "}";
|
||||||
|
return PayLoad;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t KafkaManager::RegisterTopicWatcher(const std::string &Topic,
|
uint64_t KafkaManager::RegisterTopicWatcher(const std::string &Topic,
|
||||||
|
|||||||
@@ -18,17 +18,17 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
class KafkaMessage : public Poco::Notification {
|
class KafkaMessage : public Poco::Notification {
|
||||||
public:
|
public:
|
||||||
KafkaMessage(const std::string &Topic, const std::string &Key, const std::string &Payload)
|
KafkaMessage(const char * Topic, const std::string &Key, const std::shared_ptr<std::string> Payload)
|
||||||
: Topic_(Topic), Key_(Key), Payload_(Payload) {}
|
: Topic_(Topic), Key_(Key), Payload_(std::move(Payload)) {}
|
||||||
|
|
||||||
inline const std::string &Topic() { return Topic_; }
|
inline const char * Topic() { return Topic_; }
|
||||||
inline const std::string &Key() { return Key_; }
|
inline const std::string &Key() { return Key_; }
|
||||||
inline const std::string &Payload() { return Payload_; }
|
inline const std::string &Payload() { return *Payload_; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string Topic_;
|
const char *Topic_;
|
||||||
std::string Key_;
|
std::string Key_;
|
||||||
std::string Payload_;
|
std::shared_ptr<std::string> Payload_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class KafkaProducer : public Poco::Runnable {
|
class KafkaProducer : public Poco::Runnable {
|
||||||
@@ -36,7 +36,7 @@ namespace OpenWifi {
|
|||||||
void run() override;
|
void run() override;
|
||||||
void Start();
|
void Start();
|
||||||
void Stop();
|
void Stop();
|
||||||
void Produce(const std::string &Topic, const std::string &Key, const std::string &Payload);
|
void Produce(const char *Topic, const std::string &Key, const std::shared_ptr<std::string> Payload);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::recursive_mutex Mutex_;
|
std::recursive_mutex Mutex_;
|
||||||
@@ -63,7 +63,7 @@ namespace OpenWifi {
|
|||||||
void Stop();
|
void Stop();
|
||||||
auto RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F);
|
auto RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F);
|
||||||
void UnregisterTopicWatcher(const std::string &Topic, int Id);
|
void UnregisterTopicWatcher(const std::string &Topic, int Id);
|
||||||
void Dispatch(const std::string &Topic, const std::string &Key, const std::string &Payload);
|
void Dispatch(const char *Topic, const std::string &Key, const std::shared_ptr<std::string> Payload);
|
||||||
void run() override;
|
void run() override;
|
||||||
void Topics(std::vector<std::string> &T);
|
void Topics(std::vector<std::string> &T);
|
||||||
|
|
||||||
@@ -91,10 +91,10 @@ namespace OpenWifi {
|
|||||||
int Start() override;
|
int Start() override;
|
||||||
void Stop() override;
|
void Stop() override;
|
||||||
|
|
||||||
void PostMessage(const std::string &topic, const std::string &key,
|
void PostMessage(const char *topic, const std::string &key,
|
||||||
const std::string &PayLoad, bool WrapMessage = true);
|
const std::shared_ptr<std::string> PayLoad, bool WrapMessage = true);
|
||||||
void Dispatch(const std::string &Topic, const std::string &Key, const std::string &Payload);
|
void Dispatch(const char *Topic, const std::string &Key, const std::shared_ptr<std::string> Payload);
|
||||||
[[nodiscard]] std::string WrapSystemId(const std::string &PayLoad);
|
[[nodiscard]] const std::shared_ptr<std::string> WrapSystemId(const std::shared_ptr<std::string> PayLoad);
|
||||||
[[nodiscard]] inline bool Enabled() const { return KafkaEnabled_; }
|
[[nodiscard]] inline bool Enabled() const { return KafkaEnabled_; }
|
||||||
uint64_t RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F);
|
uint64_t RegisterTopicWatcher(const std::string &Topic, Types::TopicNotifyFunction &F);
|
||||||
void UnregisterTopicWatcher(const std::string &Topic, uint64_t Id);
|
void UnregisterTopicWatcher(const std::string &Topic, uint64_t Id);
|
||||||
|
|||||||
@@ -10,32 +10,32 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
namespace OpenWifi::KafkaTopics {
|
namespace OpenWifi::KafkaTopics {
|
||||||
static const std::string HEALTHCHECK{"healthcheck"};
|
inline const char * HEALTHCHECK = "healthcheck";
|
||||||
static const std::string STATE{"state"};
|
inline const char * STATE = "state";
|
||||||
static const std::string CONNECTION{"connection"};
|
inline const char * CONNECTION = "connection";
|
||||||
static const std::string WIFISCAN{"wifiscan"};
|
inline const char * WIFISCAN = "wifiscan";
|
||||||
static const std::string ALERTS{"alerts"};
|
inline const char * ALERTS = "alerts";
|
||||||
static const std::string COMMAND{"command"};
|
inline const char * COMMAND = "command";
|
||||||
static const std::string SERVICE_EVENTS{"service_events"};
|
inline const char * SERVICE_EVENTS = "service_events";
|
||||||
static const std::string DEVICE_EVENT_QUEUE{"device_event_queue"};
|
inline const char * DEVICE_EVENT_QUEUE = "device_event_queue";
|
||||||
static const std::string DEVICE_TELEMETRY{"device_telemetry"};
|
inline const char * DEVICE_TELEMETRY = "device_telemetry";
|
||||||
static const std::string PROVISIONING_CHANGE{"provisioning_change"};
|
inline const char * PROVISIONING_CHANGE = "provisioning_change";
|
||||||
|
|
||||||
namespace ServiceEvents {
|
namespace ServiceEvents {
|
||||||
static const std::string EVENT_JOIN{"join"};
|
inline const char * EVENT_JOIN = "join";
|
||||||
static const std::string EVENT_LEAVE{"leave"};
|
inline const char * EVENT_LEAVE = "leave";
|
||||||
static const std::string EVENT_KEEP_ALIVE{"keep-alive"};
|
inline const char * EVENT_KEEP_ALIVE = "keep-alive";
|
||||||
static const std::string EVENT_REMOVE_TOKEN{"remove-token"};
|
inline const char * EVENT_REMOVE_TOKEN = "remove-token";
|
||||||
|
|
||||||
namespace Fields {
|
namespace Fields {
|
||||||
static const std::string EVENT{"event"};
|
inline const char * EVENT = "event";
|
||||||
static const std::string ID{"id"};
|
inline const char * ID = "id";
|
||||||
static const std::string TYPE{"type"};
|
inline const char * TYPE = "type";
|
||||||
static const std::string PUBLIC{"publicEndPoint"};
|
inline const char * PUBLIC = "publicEndPoint";
|
||||||
static const std::string PRIVATE{"privateEndPoint"};
|
inline const char * PRIVATE = "privateEndPoint";
|
||||||
static const std::string KEY{"key"};
|
inline const char * KEY = "key";
|
||||||
static const std::string VRSN{"version"};
|
inline const char * VRSN = "version";
|
||||||
static const std::string TOKEN{"token"};
|
inline const char * TOKEN = "token";
|
||||||
} // namespace Fields
|
} // namespace Fields
|
||||||
} // namespace ServiceEvents
|
} // namespace ServiceEvents
|
||||||
} // namespace OpenWifi::KafkaTopics
|
} // namespace OpenWifi::KafkaTopics
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
void MicroServiceReload(const std::string &Type) { MicroService::instance().Reload(Type); }
|
void MicroServiceReload(const std::string &Type) { MicroService::instance().Reload(Type); }
|
||||||
|
|
||||||
const Types::StringVec MicroServiceGetLogLevelNames() {
|
Types::StringVec MicroServiceGetLogLevelNames() {
|
||||||
return MicroService::instance().GetLogLevelNames();
|
return MicroService::instance().GetLogLevelNames();
|
||||||
}
|
}
|
||||||
|
|
||||||
const Types::StringVec MicroServiceGetSubSystems() {
|
Types::StringVec MicroServiceGetSubSystems() {
|
||||||
return MicroService::instance().GetSubSystems();
|
return MicroService::instance().GetSubSystems();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
std::string MicroServiceGetUIURI() { return MicroService::instance().GetUIURI(); }
|
std::string MicroServiceGetUIURI() { return MicroService::instance().GetUIURI(); }
|
||||||
|
|
||||||
const SubSystemVec MicroServiceGetFullSubSystems() {
|
SubSystemVec MicroServiceGetFullSubSystems() {
|
||||||
return MicroService::instance().GetFullSubSystems();
|
return MicroService::instance().GetFullSubSystems();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ namespace OpenWifi {
|
|||||||
|
|
||||||
std::uint64_t MicroServiceDaemonBusTimer() { return MicroService::instance().DaemonBusTimer(); }
|
std::uint64_t MicroServiceDaemonBusTimer() { return MicroService::instance().DaemonBusTimer(); }
|
||||||
|
|
||||||
std::string MicroServiceMakeSystemEventMessage(const std::string &Type) {
|
std::string MicroServiceMakeSystemEventMessage(const char *Type) {
|
||||||
return MicroService::instance().MakeSystemEventMessage(Type);
|
return MicroService::instance().MakeSystemEventMessage(Type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ namespace OpenWifi {
|
|||||||
void MicroServiceLoadConfigurationFile();
|
void MicroServiceLoadConfigurationFile();
|
||||||
void MicroServiceReload();
|
void MicroServiceReload();
|
||||||
void MicroServiceReload(const std::string &Type);
|
void MicroServiceReload(const std::string &Type);
|
||||||
const Types::StringVec MicroServiceGetLogLevelNames();
|
Types::StringVec MicroServiceGetLogLevelNames();
|
||||||
const Types::StringVec MicroServiceGetSubSystems();
|
Types::StringVec MicroServiceGetSubSystems();
|
||||||
Types::StringPairVec MicroServiceGetLogLevels();
|
Types::StringPairVec MicroServiceGetLogLevels();
|
||||||
bool MicroServiceSetSubsystemLogLevel(const std::string &SubSystem, const std::string &Level);
|
bool MicroServiceSetSubsystemLogLevel(const std::string &SubSystem, const std::string &Level);
|
||||||
void MicroServiceGetExtraConfiguration(Poco::JSON::Object &Answer);
|
void MicroServiceGetExtraConfiguration(Poco::JSON::Object &Answer);
|
||||||
@@ -40,10 +40,10 @@ namespace OpenWifi {
|
|||||||
std::uint64_t MicroServiceUptimeTotalSeconds();
|
std::uint64_t MicroServiceUptimeTotalSeconds();
|
||||||
std::uint64_t MicroServiceStartTimeEpochTime();
|
std::uint64_t MicroServiceStartTimeEpochTime();
|
||||||
std::string MicroServiceGetUIURI();
|
std::string MicroServiceGetUIURI();
|
||||||
const SubSystemVec MicroServiceGetFullSubSystems();
|
SubSystemVec MicroServiceGetFullSubSystems();
|
||||||
std::string MicroServiceCreateUUID();
|
std::string MicroServiceCreateUUID();
|
||||||
std::uint64_t MicroServiceDaemonBusTimer();
|
std::uint64_t MicroServiceDaemonBusTimer();
|
||||||
std::string MicroServiceMakeSystemEventMessage(const std::string &Type);
|
std::string MicroServiceMakeSystemEventMessage(const char *Type);
|
||||||
Poco::ThreadPool &MicroServiceTimerPool();
|
Poco::ThreadPool &MicroServiceTimerPool();
|
||||||
std::string MicroServiceConfigPath(const std::string &Key, const std::string &DefaultValue);
|
std::string MicroServiceConfigPath(const std::string &Key, const std::string &DefaultValue);
|
||||||
std::string MicroServiceWWWAssetsDir();
|
std::string MicroServiceWWWAssetsDir();
|
||||||
|
|||||||
63
src/framework/default_device_types.h
Normal file
63
src/framework/default_device_types.h
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
//
|
||||||
|
// Created by stephane bourque on 2023-04-19.
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace OpenWifi {
|
||||||
|
inline const std::vector<std::pair<std::string, std::string>> DefaultDeviceTypeList{
|
||||||
|
{"actiontec_web7200", "AP"},
|
||||||
|
{"cig_wf186w", "AP"},
|
||||||
|
{"cig_wf188n", "AP"},
|
||||||
|
{"cig_wf194c4", "AP"},
|
||||||
|
{"cig_wf196", "AP"},
|
||||||
|
{"cig_wf196-ca", "AP"},
|
||||||
|
{"cig_wf196-ca-ath12", "AP"},
|
||||||
|
{"cig_wf196-us", "AP"},
|
||||||
|
{"cig_wf610d", "AP"},
|
||||||
|
{"cig_wf660a", "AP"},
|
||||||
|
{"cig_wf808", "AP"},
|
||||||
|
{"cybertan_eww622-a1", "AP"},
|
||||||
|
{"edgecore_eap101", "AP"},
|
||||||
|
{"edgecore_eap101-ath12", "AP"},
|
||||||
|
{"edgecore_eap102", "AP"},
|
||||||
|
{"edgecore_eap104", "AP"},
|
||||||
|
{"edgecore_eap104-ath12", "AP"},
|
||||||
|
{"edgecore_ecs4100-12ph", "AP"},
|
||||||
|
{"edgecore_ecw5211", "AP"},
|
||||||
|
{"edgecore_ecw5410", "AP"},
|
||||||
|
{"edgecore_oap100", "AP"},
|
||||||
|
{"edgecore_spw2ac1200", "SWITCH"},
|
||||||
|
{"edgecore_spw2ac1200-lan-poe", "SWITCH"},
|
||||||
|
{"edgecore_ssw2ac2600", "SWITCH"},
|
||||||
|
{"hfcl_ion4", "AP"},
|
||||||
|
{"hfcl_ion4x", "AP"},
|
||||||
|
{"hfcl_ion4x_2", "AP"},
|
||||||
|
{"hfcl_ion4xe", "AP"},
|
||||||
|
{"hfcl_ion4xi", "AP"},
|
||||||
|
{"indio_um-305ac", "AP"},
|
||||||
|
{"indio_um-305ax", "AP"},
|
||||||
|
{"indio_um-310ax-v1", "AP"},
|
||||||
|
{"indio_um-325ac", "AP"},
|
||||||
|
{"indio_um-510ac-v3", "AP"},
|
||||||
|
{"indio_um-510axm-v1", "AP"},
|
||||||
|
{"indio_um-510axp-v1", "AP"},
|
||||||
|
{"indio_um-550ac", "AP"},
|
||||||
|
{"linksys_e8450-ubi", "AP"},
|
||||||
|
{"linksys_ea6350-v4", "AP"},
|
||||||
|
{"linksys_ea8300", "AP"},
|
||||||
|
{"liteon_wpx8324", "AP"},
|
||||||
|
{"meshpp_s618_cp01", "AP"},
|
||||||
|
{"meshpp_s618_cp03", "AP"},
|
||||||
|
{"udaya_a5-id2", "AP"},
|
||||||
|
{"wallys_dr40x9", "AP"},
|
||||||
|
{"wallys_dr6018", "AP"},
|
||||||
|
{"wallys_dr6018_v4", "AP"},
|
||||||
|
{"x64_vm", "AP"},
|
||||||
|
{"yuncore_ax840", "AP"},
|
||||||
|
{"yuncore_fap640", "AP"},
|
||||||
|
{"yuncore_fap650", "AP"}};
|
||||||
|
}
|
||||||
@@ -397,6 +397,18 @@ namespace OpenWifi::RESTAPI::Errors {
|
|||||||
static const struct msg FirmwareBDInProgress {
|
static const struct msg FirmwareBDInProgress {
|
||||||
1170, "Firmware DB update already in progress."
|
1170, "Firmware DB update already in progress."
|
||||||
};
|
};
|
||||||
|
static const struct msg SimulatedDeviceNotSupported {
|
||||||
|
1171, "Command not supported on simulated device."
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct msg SimulationDoesNotExist {
|
||||||
|
7000, "Simulation Instance ID does not exist."
|
||||||
|
};
|
||||||
|
|
||||||
|
static const struct msg SimulationIsAlreadyRunning {
|
||||||
|
7001, "There is an instance of this simulation already running.."
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
} // namespace OpenWifi::RESTAPI::Errors
|
} // namespace OpenWifi::RESTAPI::Errors
|
||||||
|
|
||||||
@@ -554,6 +566,7 @@ namespace OpenWifi::uCentralProtocol {
|
|||||||
static const char *HEALTHCHECK = "healthcheck";
|
static const char *HEALTHCHECK = "healthcheck";
|
||||||
static const char *LOG = "log";
|
static const char *LOG = "log";
|
||||||
static const char *CRASHLOG = "crashlog";
|
static const char *CRASHLOG = "crashlog";
|
||||||
|
static const char *REBOOTLOG = "rebootLog";
|
||||||
static const char *PING = "ping";
|
static const char *PING = "ping";
|
||||||
static const char *CFGPENDING = "cfgpending";
|
static const char *CFGPENDING = "cfgpending";
|
||||||
static const char *RECOVERY = "recovery";
|
static const char *RECOVERY = "recovery";
|
||||||
@@ -612,6 +625,8 @@ namespace OpenWifi::uCentralProtocol {
|
|||||||
static const char *DEVICEUPDATE = "deviceupdate";
|
static const char *DEVICEUPDATE = "deviceupdate";
|
||||||
static const char *FWSIGNATURE = "FWsignature";
|
static const char *FWSIGNATURE = "FWsignature";
|
||||||
static const char *SIGNATURE = "signature";
|
static const char *SIGNATURE = "signature";
|
||||||
|
static const char *INFO = "info";
|
||||||
|
static const char *DATE = "date";
|
||||||
|
|
||||||
static const char *SERIALNUMBER = "serialNumber";
|
static const char *SERIALNUMBER = "serialNumber";
|
||||||
static const char *COMPATIBLE = "compatible";
|
static const char *COMPATIBLE = "compatible";
|
||||||
@@ -642,6 +657,7 @@ namespace OpenWifi::uCentralProtocol::Events {
|
|||||||
static const char *HEALTHCHECK = "healthcheck";
|
static const char *HEALTHCHECK = "healthcheck";
|
||||||
static const char *LOG = "log";
|
static const char *LOG = "log";
|
||||||
static const char *CRASHLOG = "crashlog";
|
static const char *CRASHLOG = "crashlog";
|
||||||
|
static const char *REBOOTLOG = "rebootLog";
|
||||||
static const char *PING = "ping";
|
static const char *PING = "ping";
|
||||||
static const char *CFGPENDING = "cfgpending";
|
static const char *CFGPENDING = "cfgpending";
|
||||||
static const char *RECOVERY = "recovery";
|
static const char *RECOVERY = "recovery";
|
||||||
@@ -665,7 +681,8 @@ namespace OpenWifi::uCentralProtocol::Events {
|
|||||||
ET_VENUEBROADCAST,
|
ET_VENUEBROADCAST,
|
||||||
ET_EVENT,
|
ET_EVENT,
|
||||||
ET_WIFISCAN,
|
ET_WIFISCAN,
|
||||||
ET_ALARM
|
ET_ALARM,
|
||||||
|
ET_REBOOTLOG
|
||||||
};
|
};
|
||||||
|
|
||||||
inline EVENT_MSG EventFromString(const std::string &Method) {
|
inline EVENT_MSG EventFromString(const std::string &Method) {
|
||||||
@@ -696,8 +713,10 @@ namespace OpenWifi::uCentralProtocol::Events {
|
|||||||
else if (strcmp(WIFISCAN, Method.c_str()) == 0)
|
else if (strcmp(WIFISCAN, Method.c_str()) == 0)
|
||||||
return ET_WIFISCAN;
|
return ET_WIFISCAN;
|
||||||
else if (strcmp(ALARM, Method.c_str()) == 0)
|
else if (strcmp(ALARM, Method.c_str()) == 0)
|
||||||
return ET_WIFISCAN;
|
return ET_ALARM;
|
||||||
return ET_ALARM;
|
else if (strcmp(REBOOTLOG, Method.c_str()) == 0)
|
||||||
|
return ET_REBOOTLOG;
|
||||||
|
return ET_UNKNOWN;
|
||||||
};
|
};
|
||||||
} // namespace OpenWifi::uCentralProtocol::Events
|
} // namespace OpenWifi::uCentralProtocol::Events
|
||||||
|
|
||||||
|
|||||||
@@ -146,4 +146,38 @@ namespace OpenWifi::Utils {
|
|||||||
|
|
||||||
bool ExtractBase64CompressedData(const std::string &CompressedData,
|
bool ExtractBase64CompressedData(const std::string &CompressedData,
|
||||||
std::string &UnCompressedData, uint64_t compress_sz);
|
std::string &UnCompressedData, uint64_t compress_sz);
|
||||||
|
|
||||||
|
inline bool match(const char* first, const char* second)
|
||||||
|
{
|
||||||
|
// If we reach at the end of both strings, we are done
|
||||||
|
if (*first == '\0' && *second == '\0')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Make sure to eliminate consecutive '*'
|
||||||
|
if (*first == '*') {
|
||||||
|
while (*(first + 1) == '*')
|
||||||
|
first++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure that the characters after '*' are present
|
||||||
|
// in second string. This function assumes that the
|
||||||
|
// first string will not contain two consecutive '*'
|
||||||
|
if (*first == '*' && *(first + 1) != '\0'
|
||||||
|
&& *second == '\0')
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// If the first string contains '?', or current
|
||||||
|
// characters of both strings match
|
||||||
|
if (*first == '?' || *first == *second)
|
||||||
|
return match(first + 1, second + 1);
|
||||||
|
|
||||||
|
// If there is *, then there are two possibilities
|
||||||
|
// a) We consider current character of second string
|
||||||
|
// b) We ignore current character of second string.
|
||||||
|
if (*first == '*')
|
||||||
|
return match(first + 1, second)
|
||||||
|
|| match(first, second + 1);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace OpenWifi::Utils
|
} // namespace OpenWifi::Utils
|
||||||
|
|||||||
@@ -39,6 +39,9 @@ ucentral.system.commandchannel = /tmp/app.ucentralfms
|
|||||||
#
|
#
|
||||||
# Firmware Microservice Specific Section
|
# Firmware Microservice Specific Section
|
||||||
#
|
#
|
||||||
|
s3.endpointOverride = 172.31.30.127:9000
|
||||||
|
s3.endpoint.https = false
|
||||||
|
s3.useVirtualAdressing = false
|
||||||
s3.bucketname = ucentral-ap-firmware
|
s3.bucketname = ucentral-ap-firmware
|
||||||
s3.region = us-east-1
|
s3.region = us-east-1
|
||||||
s3.secret = ****************************
|
s3.secret = ****************************
|
||||||
|
|||||||
Reference in New Issue
Block a user