mirror of
https://github.com/Telecominfraproject/wlan-cloud-analytics.git
synced 2026-01-27 10:22:33 +00:00
Framework update.
This commit is contained in:
@@ -20,7 +20,7 @@ namespace OpenWifi {
|
||||
TransactionId,
|
||||
Internal){}
|
||||
|
||||
static const std::list<const char *> PathName() { return std::list<const char *>{"/api/v1/board/{id}/devices"}; };
|
||||
static auto PathName() { return std::list<std::string>{"/api/v1/board/{id}/devices"}; };
|
||||
|
||||
private:
|
||||
BoardsDB & DB_=StorageService()->BoardsDB();
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenWifi {
|
||||
TransactionId,
|
||||
Internal){}
|
||||
|
||||
static const std::list<const char *> PathName() { return std::list<const char *>{"/api/v1/board/{id}"}; };
|
||||
static auto PathName() { return std::list<std::string>{"/api/v1/board/{id}"}; };
|
||||
|
||||
private:
|
||||
BoardsDB & DB_=StorageService()->BoardsDB();
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenWifi {
|
||||
TransactionId,
|
||||
Internal){}
|
||||
|
||||
static const std::list<const char *> PathName() { return std::list<const char *>{"/api/v1/boards"}; };
|
||||
static auto PathName() { return std::list<std::string>{"/api/v1/boards"}; };
|
||||
|
||||
private:
|
||||
BoardsDB & DB_=StorageService()->BoardsDB();
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenWifi {
|
||||
TransactionId,
|
||||
Internal){}
|
||||
|
||||
static const std::list<const char *> PathName() { return std::list<const char *>{"/api/v1/board/{id}/timepoints"}; };
|
||||
static auto PathName() { return std::list<std::string>{"/api/v1/board/{id}/timepoints"}; };
|
||||
|
||||
private:
|
||||
TimePointDB & DB_=StorageService()->TimePointsDB();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace OpenWifi {
|
||||
|
||||
Poco::Net::HTTPRequestHandler * RESTAPI_ExtRouter(const char *Path, RESTAPIHandler::BindingMap &Bindings,
|
||||
Poco::Net::HTTPRequestHandler * RESTAPI_ExtRouter(const std::string &Path, RESTAPIHandler::BindingMap &Bindings,
|
||||
Poco::Logger & L, RESTAPI_GenericServer & S,
|
||||
uint64_t TransactionId) {
|
||||
return RESTAPI_Router<
|
||||
@@ -22,7 +22,7 @@ namespace OpenWifi {
|
||||
>(Path,Bindings,L, S, TransactionId);
|
||||
}
|
||||
|
||||
Poco::Net::HTTPRequestHandler * RESTAPI_IntRouter(const char *Path, RESTAPIHandler::BindingMap &Bindings,
|
||||
Poco::Net::HTTPRequestHandler * RESTAPI_IntRouter(const std::string &Path, RESTAPIHandler::BindingMap &Bindings,
|
||||
Poco::Logger & L, RESTAPI_GenericServer & S,
|
||||
uint64_t TransactionId) {
|
||||
return RESTAPI_Router_I<
|
||||
|
||||
@@ -203,6 +203,7 @@ namespace OpenWifi::ProvObjects {
|
||||
field_to_json( Obj,"variables",variables);
|
||||
field_to_json( Obj,"defaultOperator",defaultOperator);
|
||||
field_to_json( Obj,"sourceIP",sourceIP);
|
||||
field_to_json( Obj,"registrationId",registrationId);
|
||||
}
|
||||
|
||||
bool Operator::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||
@@ -216,6 +217,7 @@ namespace OpenWifi::ProvObjects {
|
||||
field_from_json( Obj,"variables",variables);
|
||||
field_from_json( Obj,"defaultOperator",defaultOperator);
|
||||
field_from_json( Obj,"sourceIP",sourceIP);
|
||||
field_from_json( Obj,"registrationId",registrationId);
|
||||
return true;
|
||||
} catch(...) {
|
||||
}
|
||||
@@ -893,6 +895,7 @@ namespace OpenWifi::ProvObjects {
|
||||
field_to_json( Obj,"error", error);
|
||||
field_to_json( Obj,"statusCode", statusCode);
|
||||
field_to_json( Obj,"deviceID", deviceID);
|
||||
field_to_json( Obj,"registrationId",registrationId);
|
||||
}
|
||||
|
||||
bool SignupEntry::from_json(const Poco::JSON::Object::Ptr &Obj) {
|
||||
@@ -908,6 +911,7 @@ namespace OpenWifi::ProvObjects {
|
||||
field_from_json( Obj,"error", error);
|
||||
field_from_json( Obj,"statusCode", statusCode);
|
||||
field_from_json( Obj,"deviceID", deviceID);
|
||||
field_from_json( Obj,"registrationId",registrationId);
|
||||
return true;
|
||||
} catch(...) {
|
||||
|
||||
|
||||
@@ -533,6 +533,7 @@ namespace OpenWifi::ProvObjects {
|
||||
uint64_t error=0;
|
||||
uint64_t statusCode=0;
|
||||
std::string deviceID;
|
||||
std::string registrationId;
|
||||
|
||||
void to_json(Poco::JSON::Object &Obj) const;
|
||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||
@@ -586,6 +587,7 @@ namespace OpenWifi::ProvObjects {
|
||||
std::vector<Variable> variables;
|
||||
bool defaultOperator=false;
|
||||
Types::StringVec sourceIP;
|
||||
std::string registrationId;
|
||||
|
||||
void to_json(Poco::JSON::Object &Obj) const;
|
||||
bool from_json(const Poco::JSON::Object::Ptr &Obj);
|
||||
|
||||
@@ -1849,7 +1849,7 @@ namespace OpenWifi {
|
||||
}
|
||||
|
||||
|
||||
inline static bool ParseBindings(const std::string & Request, const std::list<const char *> & EndPoints, BindingMap &bindings) {
|
||||
inline static bool ParseBindings(const std::string & Request, const std::list<std::string> & EndPoints, BindingMap &bindings) {
|
||||
bindings.clear();
|
||||
std::vector<std::string> PathItems = Utils::Split(Request, '/');
|
||||
|
||||
@@ -2889,10 +2889,10 @@ namespace OpenWifi {
|
||||
|
||||
inline auto ALBHealthCheckServer() { return ALBHealthCheckServer::instance(); }
|
||||
|
||||
Poco::Net::HTTPRequestHandler * RESTAPI_ExtRouter(const char *Path, RESTAPIHandler::BindingMap &Bindings,
|
||||
Poco::Net::HTTPRequestHandler * RESTAPI_ExtRouter(const std::string &Path, RESTAPIHandler::BindingMap &Bindings,
|
||||
Poco::Logger & L, RESTAPI_GenericServer & S, uint64_t Id);
|
||||
|
||||
Poco::Net::HTTPRequestHandler * RESTAPI_IntRouter(const char *Path, RESTAPIHandler::BindingMap &Bindings,
|
||||
Poco::Net::HTTPRequestHandler * RESTAPI_IntRouter(const std::string &Path, RESTAPIHandler::BindingMap &Bindings,
|
||||
Poco::Logger & L, RESTAPI_GenericServer & S, uint64_t Id);
|
||||
|
||||
|
||||
@@ -2914,8 +2914,9 @@ namespace OpenWifi {
|
||||
|
||||
inline void reinitialize(Poco::Util::Application &self) override;
|
||||
|
||||
inline Poco::Net::HTTPRequestHandler *CallServer(const char *Path, uint64_t Id) {
|
||||
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
||||
RESTAPIHandler::BindingMap Bindings;
|
||||
Poco::Thread::current()->setName(fmt::format("RESTAPI_ExtServer_{}",Id));
|
||||
return RESTAPI_ExtRouter(Path, Bindings, Logger(), Server_, Id);
|
||||
}
|
||||
|
||||
@@ -2939,9 +2940,8 @@ namespace OpenWifi {
|
||||
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &Request) override {
|
||||
try {
|
||||
Poco::URI uri(Request.getURI());
|
||||
auto *Path = uri.getPath().c_str();
|
||||
Poco::Thread::current()->setName("ExtWebServer_" + std::to_string(TransactionId_));
|
||||
return RESTAPI_ExtServer()->CallServer(Path, TransactionId_++);
|
||||
Poco::Thread::current()->setName(fmt::format("ExtWebServer_{}",TransactionId_));
|
||||
return RESTAPI_ExtServer()->CallServer(uri.getPath(), TransactionId_++);
|
||||
} catch (...) {
|
||||
|
||||
}
|
||||
@@ -3047,8 +3047,9 @@ namespace OpenWifi {
|
||||
|
||||
inline void reinitialize(Poco::Util::Application &self) override;
|
||||
|
||||
inline Poco::Net::HTTPRequestHandler *CallServer(const char *Path, uint64_t Id) {
|
||||
inline Poco::Net::HTTPRequestHandler *CallServer(const std::string &Path, uint64_t Id) {
|
||||
RESTAPIHandler::BindingMap Bindings;
|
||||
Poco::Thread::current()->setName(fmt::format("RESTAPI_IntServer_{}",Id));
|
||||
return RESTAPI_IntRouter(Path, Bindings, Logger(), Server_, Id);
|
||||
}
|
||||
private:
|
||||
@@ -3070,8 +3071,7 @@ namespace OpenWifi {
|
||||
inline IntRequestHandlerFactory() = default;
|
||||
inline Poco::Net::HTTPRequestHandler *createRequestHandler(const Poco::Net::HTTPServerRequest &Request) override {
|
||||
Poco::URI uri(Request.getURI());
|
||||
auto *Path = uri.getPath().c_str();
|
||||
return RESTAPI_IntServer()->CallServer(Path, TransactionId_);
|
||||
return RESTAPI_IntServer()->CallServer(uri.getPath(), TransactionId_);
|
||||
}
|
||||
private:
|
||||
static inline std::atomic_uint64_t TransactionId_ = 1;
|
||||
@@ -4170,7 +4170,7 @@ namespace OpenWifi {
|
||||
Server,
|
||||
TransactionId,
|
||||
Internal) {}
|
||||
static const std::list<const char *> PathName() { return std::list<const char *>{"/api/v1/system"};}
|
||||
static auto PathName() { return std::list<std::string>{"/api/v1/system"};}
|
||||
|
||||
inline void DoGet() {
|
||||
std::string Arg;
|
||||
|
||||
@@ -91,14 +91,17 @@ namespace OpenWifi::RESTAPI::Errors {
|
||||
static const std::string InvalidIPAddresses{"Invalid IP addresses."};
|
||||
static const std::string InvalidBillingCode{"Empty of invalid billing code."};
|
||||
static const std::string InvalidBillingPeriod{"Invalid billing period."};
|
||||
static const std::string InvalidSubscriberId{"Invalid subscriber ID"};
|
||||
static const std::string InvalidContactId{"Invalid contact ID"};
|
||||
static const std::string InvalidLocationId{"Invalid location ID"};
|
||||
static const std::string InvalidContactType{"Invalid contact type"};
|
||||
static const std::string InvalidLocationType{"Invalid location type"};
|
||||
static const std::string InvalidOperatorId{"Invalid operator ID"};
|
||||
static const std::string InvalidServiceClassId{"Invalid service class ID"};
|
||||
static const std::string InvalidSubscriberDeviceId{"Invalid subscriber device ID"};
|
||||
static const std::string InvalidSubscriberId{"Invalid subscriber ID."};
|
||||
static const std::string InvalidContactId{"Invalid contact ID."};
|
||||
static const std::string InvalidLocationId{"Invalid location ID."};
|
||||
static const std::string InvalidContactType{"Invalid contact type."};
|
||||
static const std::string InvalidLocationType{"Invalid location type."};
|
||||
static const std::string InvalidOperatorId{"Invalid operator ID."};
|
||||
static const std::string InvalidServiceClassId{"Invalid service class ID."};
|
||||
static const std::string InvalidSubscriberDeviceId{"Invalid subscriber device ID."};
|
||||
static const std::string InvalidRegistrationOperatorId{"Invalid registration operator ID."};
|
||||
static const std::string InvalidRegistrationOperatorName{"Invalid registration operator name."};
|
||||
static const std::string RegistrationNameDuplicate{"Registration name must be unique."};
|
||||
}
|
||||
|
||||
namespace OpenWifi::RESTAPI::Protocol {
|
||||
|
||||
Reference in New Issue
Block a user