diff --git a/SELFCARE_PARTICIPATION.md b/SELFCARE_PARTICIPATION.md index 81ced85..de9c1ed 100644 --- a/SELFCARE_PARTICIPATION.md +++ b/SELFCARE_PARTICIPATION.md @@ -33,13 +33,44 @@ is a sample "org_color_1" : "#3399ff", "access_policy" : "https://www.example.com/policies/selfcare_program_policy.html", "password_policy_regex" : "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$", - "password_policy" : "https://www.example.com/policies/selfcare_password_policy.html" - }, + "password_policy" : "https://www.example.com/policies/selfcare_password_policy.html", + "operator_id" : "oper1" + } ... ] } ``` +#### `org_uri` +The URI the subscriber can use to visit a website describing the operator + +#### `org_name` +The legal name of the operator. + +#### `subscriber_portal` +The location of the subscriber self-care service + +#### `small_org_logo` +URL of a small logo to be used for branding the mobile app. + +#### `large_org_logo` +URL of a larger logo to be used for branding the mobile app. + +#### `org_color_1` +A color to be used for branding + +#### `access_policy` +URL of the system access policy + +#### `password_policy_regex` +The regex of the password requirement + +#### `password_policy` +URL of the description of what the password policy is + +#### `operator_id` +A single word to link the registration with an existing Operator in the Operator DB. + ### The SelfCare application The application is available on AppCenter by following this link. diff --git a/build b/build index 4800c7d..2b82dfe 100644 --- a/build +++ b/build @@ -1 +1 @@ -58 \ No newline at end of file +60 \ No newline at end of file diff --git a/openapi/userportal.yaml b/openapi/userportal.yaml index 30ea2f4..75cf96c 100644 --- a/openapi/userportal.yaml +++ b/openapi/userportal.yaml @@ -1286,6 +1286,11 @@ paths: schema: type: string required: false + - in: query + name: registrationId + schema: + type: string + required: true responses: 200: $ref: '#/components/schemas/SignupEntry' diff --git a/src/RESTAPI/RESTAPI_signup_handler.cpp b/src/RESTAPI/RESTAPI_signup_handler.cpp index da667b7..5223ead 100644 --- a/src/RESTAPI/RESTAPI_signup_handler.cpp +++ b/src/RESTAPI/RESTAPI_signup_handler.cpp @@ -14,6 +14,8 @@ namespace OpenWifi { Poco::toLowerInPlace(UserName); auto SerialNumber = GetParameter("macAddress",""); Poco::toLowerInPlace(SerialNumber); + auto registrationId = GetParameter("registrationId",""); + Poco::toLowerInPlace(registrationId); if(!Utils::ValidSerialNumber(SerialNumber)) { return BadRequest(RESTAPI::Errors::InvalidSerialNumber); @@ -23,6 +25,9 @@ namespace OpenWifi { return BadRequest(RESTAPI::Errors::InvalidEmailAddress); } + if(registrationId.empty()) { + return BadRequest(RESTAPI::Errors::InvalidRegistrationOperatorName); + } return API_Proxy(Logger(), Request, Response, uSERVICE_PROVISIONING.c_str(), "/api/v1/signup", 60000); } diff --git a/src/RESTObjects/RESTAPI_AnalyticsObjects.cpp b/src/RESTObjects/RESTAPI_AnalyticsObjects.cpp new file mode 100644 index 0000000..77d8ea1 --- /dev/null +++ b/src/RESTObjects/RESTAPI_AnalyticsObjects.cpp @@ -0,0 +1,360 @@ +// +// Created by stephane bourque on 2022-01-10. +// + +#include "RESTAPI_AnalyticsObjects.h" +#include "RESTAPI_ProvObjects.h" +#include "framework/MicroService.h" + +using OpenWifi::RESTAPI_utils::field_to_json; +using OpenWifi::RESTAPI_utils::field_from_json; + +namespace OpenWifi::AnalyticsObjects { + + void Report::reset() { + } + + void Report::to_json(Poco::JSON::Object &Obj) const { + } + + void VenueInfo::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"id",id); + field_to_json(Obj,"name",name); + field_to_json(Obj,"description",description); + field_to_json(Obj,"retention",retention); + field_to_json(Obj,"interval",interval); + field_to_json(Obj,"monitorSubVenues",monitorSubVenues); + } + + bool VenueInfo::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"id",id); + field_from_json(Obj,"name",name); + field_from_json(Obj,"description",description); + field_from_json(Obj,"retention",retention); + field_from_json(Obj,"interval",interval); + field_from_json(Obj,"monitorSubVenues",monitorSubVenues); + return true; + } catch(...) { + + } + return false; + } + + void BoardInfo::to_json(Poco::JSON::Object &Obj) const { + info.to_json(Obj); + field_to_json(Obj,"venueList",venueList); + } + + bool BoardInfo::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + info.from_json(Obj); + field_from_json(Obj,"venueList",venueList); + return true; + } catch(...) { + + } + return false; + } + + void DeviceInfo::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"boardId",boardId); + field_to_json(Obj,"type",type); + field_to_json(Obj,"serialNumber",serialNumber); + field_to_json(Obj,"deviceType",deviceType); + field_to_json(Obj,"lastContact",lastContact); + field_to_json(Obj,"lastPing",lastPing); + field_to_json(Obj,"lastState",lastState); + field_to_json(Obj,"lastFirmware",lastFirmware); + field_to_json(Obj,"lastFirmwareUpdate",lastFirmwareUpdate); + field_to_json(Obj,"lastConnection",lastConnection); + field_to_json(Obj,"lastDisconnection",lastDisconnection); + field_to_json(Obj,"pings",pings); + field_to_json(Obj,"states",states); + field_to_json(Obj,"connected",connected); + field_to_json(Obj,"connectionIp",connectionIp); + field_to_json(Obj,"associations_2g",associations_2g); + field_to_json(Obj,"associations_5g",associations_5g); + field_to_json(Obj,"associations_6g",associations_6g); + field_to_json(Obj,"health",health); + field_to_json(Obj,"lastHealth",lastHealth); + field_to_json(Obj,"locale",locale); + field_to_json(Obj,"uptime",uptime); + field_to_json(Obj,"memory",memory); + } + + bool DeviceInfo::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"boardId",boardId); + field_from_json(Obj,"type",type); + field_from_json(Obj,"serialNumber",serialNumber); + field_from_json(Obj,"deviceType",deviceType); + field_from_json(Obj,"lastContact",lastContact); + field_from_json(Obj,"lastPing",lastPing); + field_from_json(Obj,"lastState",lastState); + field_from_json(Obj,"lastFirmware",lastFirmware); + field_from_json(Obj,"lastFirmwareUpdate",lastFirmwareUpdate); + field_from_json(Obj,"lastConnection",lastConnection); + field_from_json(Obj,"lastDisconnection",lastDisconnection); + field_from_json(Obj,"pings",pings); + field_from_json(Obj,"states",states); + field_from_json(Obj,"connected",connected); + field_from_json(Obj,"connectionIp",connectionIp); + field_from_json(Obj,"associations_2g",associations_2g); + field_from_json(Obj,"associations_5g",associations_5g); + field_from_json(Obj,"associations_6g",associations_6g); + field_from_json(Obj,"health",health); + field_from_json(Obj,"lastHealth",lastHealth); + field_from_json(Obj,"locale",locale); + field_from_json(Obj,"uptime",uptime); + field_from_json(Obj,"memory",memory); + return true; + } catch(...) { + + } + return false; + } + + void DeviceInfoList::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"devices",devices); + } + + bool DeviceInfoList::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"devices",devices); + return true; + } catch(...) { + + } + return false; + } + + void UE_rate::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"bitrate",bitrate); + field_to_json(Obj,"mcs",mcs); + field_to_json(Obj,"nss",nss); + field_to_json(Obj,"ht",ht); + field_to_json(Obj,"sgi",sgi); + field_to_json(Obj,"chwidth",chwidth); + } + + bool UE_rate::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"bitrate",bitrate); + field_from_json(Obj,"mcs",mcs); + field_from_json(Obj,"nss",nss); + field_from_json(Obj,"ht",ht); + field_from_json(Obj,"sgi",sgi); + field_from_json(Obj,"chwidth",chwidth); + return true; + } catch(...) { + + } + return false; + } + + void UETimePoint::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"station",station); + field_to_json(Obj,"rssi",rssi); + field_to_json(Obj,"tx_bytes",tx_bytes); + field_to_json(Obj,"rx_bytes",rx_bytes); + field_to_json(Obj,"tx_duration",tx_duration); + field_to_json(Obj,"rx_packets",rx_packets); + field_to_json(Obj,"tx_packets",tx_packets); + field_to_json(Obj,"tx_retries",tx_retries); + field_to_json(Obj,"tx_failed",tx_failed); + field_to_json(Obj,"connected",connected); + field_to_json(Obj,"inactive",inactive); + field_to_json(Obj,"tx_rate",tx_rate); + field_to_json(Obj,"rx_rate",rx_rate); + } + + bool UETimePoint::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"station",station); + field_from_json(Obj,"rssi",rssi); + field_from_json(Obj,"tx_bytes",tx_bytes); + field_from_json(Obj,"rx_bytes",rx_bytes); + field_from_json(Obj,"tx_duration",tx_duration); + field_from_json(Obj,"rx_packets",rx_packets); + field_from_json(Obj,"tx_packets",tx_packets); + field_from_json(Obj,"tx_retries",tx_retries); + field_from_json(Obj,"tx_failed",tx_failed); + field_from_json(Obj,"connected",connected); + field_from_json(Obj,"inactive",inactive); + field_from_json(Obj,"tx_rate",tx_rate); + field_from_json(Obj,"rx_rate",rx_rate); + return true; + } catch(...) { + + } + return false; + } + + void APTimePoint::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"collisions",collisions); + field_to_json(Obj,"multicast",multicast); + field_to_json(Obj,"rx_bytes",rx_bytes); + field_to_json(Obj,"rx_dropped",rx_dropped); + field_to_json(Obj,"rx_errors",rx_errors); + field_to_json(Obj,"rx_packets",rx_packets); + field_to_json(Obj,"tx_bytes",tx_bytes); + field_to_json(Obj,"tx_packets",tx_packets); + field_to_json(Obj,"tx_dropped",tx_dropped); + field_to_json(Obj,"tx_errors",tx_errors); + field_to_json(Obj,"tx_packets",tx_packets); + } + + bool APTimePoint::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"collisions",collisions); + field_from_json(Obj,"multicast",multicast); + field_from_json(Obj,"rx_bytes",rx_bytes); + field_from_json(Obj,"rx_dropped",rx_dropped); + field_from_json(Obj,"rx_errors",rx_errors); + field_from_json(Obj,"rx_packets",rx_packets); + field_from_json(Obj,"tx_bytes",tx_bytes); + field_from_json(Obj,"tx_packets",tx_packets); + field_from_json(Obj,"tx_dropped",tx_dropped); + field_from_json(Obj,"tx_errors",tx_errors); + field_from_json(Obj,"tx_packets",tx_packets); + return true; + } catch(...) { + + } + return false; + } + + void TIDstat_entry::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"rx_msdu",rx_msdu); + field_to_json(Obj,"tx_msdu",tx_msdu); + field_to_json(Obj,"tx_msdu_failed",tx_msdu_failed); + field_to_json(Obj,"tx_msdu_retries",tx_msdu_retries); + } + + bool TIDstat_entry::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"rx_msdu",rx_msdu); + field_from_json(Obj,"tx_msdu",tx_msdu); + field_from_json(Obj,"tx_msdu_failed",tx_msdu_failed); + field_from_json(Obj,"tx_msdu_retries",tx_msdu_retries); + return true; + } catch(...) { + + } + return false; + } + + void RadioTimePoint::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"band",band); + field_to_json(Obj,"radio_channel",radio_channel); + field_to_json(Obj,"active_ms",active_ms); + field_to_json(Obj,"busy_ms",busy_ms); + field_to_json(Obj,"receive_ms",receive_ms); + field_to_json(Obj,"transmit_ms",transmit_ms); + field_to_json(Obj,"tx_power",tx_power); + field_to_json(Obj,"channel",channel); + field_to_json(Obj,"temperature",temperature); + field_to_json(Obj,"noise",noise); + } + + bool RadioTimePoint::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"band",band); + field_from_json(Obj,"radio_channel",radio_channel); + field_from_json(Obj,"active_ms",active_ms); + field_from_json(Obj,"busy_ms",busy_ms); + field_from_json(Obj,"receive_ms",receive_ms); + field_from_json(Obj,"transmit_ms",transmit_ms); + field_from_json(Obj,"tx_power",tx_power); + field_from_json(Obj,"channel",channel); + field_from_json(Obj,"temperature",temperature); + field_from_json(Obj,"noise",noise); + return true; + } catch(...) { + + } + return false; + } + + void SSIDTimePoint::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"bssid",bssid); + field_to_json(Obj,"mode",mode); + field_to_json(Obj,"ssid",ssid); + field_to_json(Obj,"band",band); + field_to_json(Obj,"associations",associations); + } + + bool SSIDTimePoint::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"bssid",bssid); + field_from_json(Obj,"mode",mode); + field_from_json(Obj,"ssid",ssid); + field_from_json(Obj,"band",band); + field_from_json(Obj,"associations",associations); + return true; + } catch(...) { + + } + return false; + } + + void DeviceTimePoint::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"id",id); + field_to_json(Obj,"boardId",boardId); + field_to_json(Obj,"timestamp",timestamp); + field_to_json(Obj,"ap_data",ap_data); + field_to_json(Obj,"ssid_data",ssid_data); + field_to_json(Obj,"radio_data",radio_data); + field_to_json(Obj,"device_info",device_info); + } + + bool DeviceTimePoint::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"id",id); + field_from_json(Obj,"boardId",boardId); + field_from_json(Obj,"timestamp",timestamp); + field_from_json(Obj,"ap_data",ap_data); + field_from_json(Obj,"ssid_data",ssid_data); + field_from_json(Obj,"radio_data",radio_data); + field_from_json(Obj,"device_info",device_info); + return true; + } catch(...) { + + } + return false; + } + + void DeviceTimePointList::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"points",points); + } + + bool DeviceTimePointList::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"points",points); + return true; + } catch(...) { + + } + return false; + } + + void DeviceTimePointStats::to_json(Poco::JSON::Object &Obj) const { + field_to_json(Obj,"firstPoint",firstPoint); + field_to_json(Obj,"lastPoint",lastPoint); + field_to_json(Obj,"count",count); + } + + bool DeviceTimePointStats::from_json(const Poco::JSON::Object::Ptr &Obj) { + try { + field_from_json(Obj,"firstPoint",firstPoint); + field_from_json(Obj,"lastPoint",lastPoint); + field_from_json(Obj,"count",count); + return true; + } catch(...) { + + } + return false; + } + +} \ No newline at end of file diff --git a/src/RESTObjects/RESTAPI_AnalyticsObjects.h b/src/RESTObjects/RESTAPI_AnalyticsObjects.h new file mode 100644 index 0000000..487acab --- /dev/null +++ b/src/RESTObjects/RESTAPI_AnalyticsObjects.h @@ -0,0 +1,290 @@ +// +// Created by stephane bourque on 2022-01-10. +// + +#pragma once + +#include "RESTAPI_ProvObjects.h" +#include + +namespace OpenWifi { + + namespace AnalyticsObjects { + + struct Report { + uint64_t snapShot = 0; + + void reset(); + + void to_json(Poco::JSON::Object &Obj) const; + }; + + struct VenueInfo { + OpenWifi::Types::UUID_t id; + std::string name; + std::string description; + uint64_t retention = 0; + uint64_t interval = 0; + bool monitorSubVenues = false; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + struct BoardInfo { + ProvObjects::ObjectInfo info; + std::vector venueList; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + + inline bool operator<(const BoardInfo &bb) const { + return info.id < bb.info.id; + } + + inline bool operator==(const BoardInfo &bb) const { + return info.id == bb.info.id; + } + }; + + struct DeviceInfo { + std::string boardId; + std::string type; + std::string serialNumber; + std::string deviceType; + uint64_t lastContact = 0 ; + uint64_t lastPing = 0; + uint64_t lastState = 0; + std::string lastFirmware; + uint64_t lastFirmwareUpdate = 0; + uint64_t lastConnection = 0; + uint64_t lastDisconnection = 0; + uint64_t pings = 0; + uint64_t states = 0; + bool connected = false; + std::string connectionIp; + uint64_t associations_2g = 0; + uint64_t associations_5g = 0; + uint64_t associations_6g = 0; + uint64_t health = 0; + uint64_t lastHealth = 0; + std::string locale; + uint64_t uptime = 0; + double memory = 0.0; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + struct DeviceInfoList { + std::vector devices; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + enum wifi_band { + band_2g = 0, band_5g = 1, band_6g = 2 + }; + + struct TIDstat_entry { + uint64_t rx_msdu = 0, + tx_msdu = 0, + tx_msdu_failed = 0, + tx_msdu_retries = 0; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + struct UE_rate { + uint64_t bitrate=0; + uint64_t mcs=0; + uint64_t nss=0; + bool ht=false; + bool sgi=false; + uint64_t chwidth=0; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + struct UETimePoint { + std::string station; + int64_t rssi = 0; + uint64_t tx_bytes = 0, + rx_bytes = 0, + tx_duration = 0, + rx_packets = 0, + tx_packets = 0, + tx_retries = 0, + tx_failed = 0, + connected = 0, + inactive = 0; + UE_rate tx_rate, + rx_rate; + std::vector tidstat; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + enum SSID_MODES { + unknown = 0, + ap, + mesh, + sta, + wds_ap, + wds_sta, + wds_repeater + }; + + inline SSID_MODES SSID_Mode(const std::string &m) { + if (m == "ap") + return ap; + if (m == "sta") + return sta; + if (m == "mesh") + return mesh; + if (m == "wds-ap") + return wds_ap; + if (m == "wds-sta") + return wds_sta; + if (m == "wds-repeater") + return wds_repeater; + return unknown; + } + + struct SSIDTimePoint { + std::string bssid, + mode, + ssid; + uint64_t band=0; + std::vector associations; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + + struct APTimePoint { + uint64_t collisions = 0, + multicast = 0, + rx_bytes = 0, + rx_dropped = 0, + rx_errors = 0, + rx_packets = 0, + tx_bytes = 0, + tx_dropped = 0, + tx_errors = 0, + tx_packets = 0; + + double tx_bytes_bw = 0.0 , + rx_bytes_bw = 0.0 , + rx_dropped_pct = 0.0, + tx_dropped_pct = 0.0, + rx_packets_bw = 0.0, + tx_packets_bw = 0.0; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + struct RadioTimePoint { + uint64_t band = 0, + radio_channel = 0; + uint64_t active_ms = 0, + busy_ms = 0, + receive_ms = 0, + transmit_ms = 0, + tx_power = 0, + channel = 0; + int64_t temperature = 0, + noise = 0; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + + struct DeviceTimePoint { + std::string id; + std::string boardId; + uint64_t timestamp = 0; + APTimePoint ap_data; + std::vector ssid_data; + std::vector radio_data; + AnalyticsObjects::DeviceInfo device_info; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + + inline bool operator<(const DeviceTimePoint &rhs) const { + if(timestamp < rhs.timestamp) + return true; + if(timestamp > rhs.timestamp) + return false; + if(device_info.serialNumber < rhs.device_info.serialNumber) + return true; + return false; + } + + inline bool operator==(const DeviceTimePoint &rhs) const { + return timestamp==rhs.timestamp && device_info.serialNumber==rhs.device_info.serialNumber; + } + + inline bool operator>(const DeviceTimePoint &rhs) const { + if(timestamp > rhs.timestamp) + return true; + if(timestamp < rhs.timestamp) + return false; + if(device_info.serialNumber > rhs.device_info.serialNumber) + return true; + return false; + } + + }; + + struct DeviceTimePointList { + std::vector points; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + + struct BandwidthAnalysisEntry { + uint64_t timestamp = 0; + + }; + + struct BandwidthAnalysis { + + }; + + struct AverageValueSigned { + int64_t peak=0, avg=0, low=0; + }; + + struct AverageValueUnsigned { + uint64_t peak=0, avg=0, low=0; + }; + + struct RadioAnalysis { + uint64_t timestamp=0; + AverageValueSigned noise, temperature; + AverageValueUnsigned active_ms, + busy_ms, + transmit_ms, + receive_ms; + }; + + struct DeviceTimePointStats { + uint64_t firstPoint=0; + uint64_t lastPoint=0; + uint64_t count=0; + + void to_json(Poco::JSON::Object &Obj) const; + bool from_json(const Poco::JSON::Object::Ptr &Obj); + }; + } +} \ No newline at end of file diff --git a/src/RESTObjects/RESTAPI_ProvObjects.cpp b/src/RESTObjects/RESTAPI_ProvObjects.cpp index 8969b03..6720636 100644 --- a/src/RESTObjects/RESTAPI_ProvObjects.cpp +++ b/src/RESTObjects/RESTAPI_ProvObjects.cpp @@ -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(...) { diff --git a/src/RESTObjects/RESTAPI_ProvObjects.h b/src/RESTObjects/RESTAPI_ProvObjects.h index 18711d1..091e31c 100644 --- a/src/RESTObjects/RESTAPI_ProvObjects.h +++ b/src/RESTObjects/RESTAPI_ProvObjects.h @@ -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 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); diff --git a/src/framework/ow_constants.h b/src/framework/ow_constants.h index 71ec00c..7311c28 100644 --- a/src/framework/ow_constants.h +++ b/src/framework/ow_constants.h @@ -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 { diff --git a/tip_selfcare_registry.json b/tip_selfcare_registry.json index e30b93c..5aae036 100644 --- a/tip_selfcare_registry.json +++ b/tip_selfcare_registry.json @@ -10,7 +10,8 @@ "org_color_1":"#0f5eaa", "access_policy":"https://14oranges.arilia.com:16001/wwwassets/access_policy.html", "password_policy_regex":"^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$", - "password_policy":"https://14oranges.arilia.com:16001/wwwassets/password_policy.html" + "password_policy":"https://14oranges.arilia.com:16001/wwwassets/password_policy.html", + "operator_id" : "14oranges" }, { "org_uri" : "https://www.arilia.com" , @@ -21,7 +22,8 @@ "org_color_1" : "#3399ff", "access_policy" : "https://ucentral.dpaas.arilia.com:16001/wwwassets/access_policy.html", "password_policy_regex" : "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$", - "password_policy" : "https://ucentral.dpaas.arilia.com:16001/wwwassets/password_policy.html" + "password_policy" : "https://ucentral.dpaas.arilia.com:16001/wwwassets/password_policy.html", + "operator_id" : "arilia" }, { "org_uri" : "https://www.arilia.com" , @@ -32,7 +34,8 @@ "org_color_1" : "#3399ff", "access_policy" : "https://livinglab.arilia.com:16001/wwwassets/access_policy.html", "password_policy_regex" : "^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$", - "password_policy" : "https://livinglab.arilia.com:16001/wwwassets/password_policy.html" + "password_policy" : "https://livinglab.arilia.com:16001/wwwassets/password_policy.html", + "operator_id" : "livinglab" } ] } \ No newline at end of file