| Description | A MaintenanceManager method that does a proper subscription to Network state changes coming from Network Plugin, we use internetStatusChangeEventHandler() Event handler | |
|---|---|---|
| Prototype | bool MaintenanceManager::subscribeForInternetStatusEvent(string event) | |
| Input Args | string event | |
| Return | true | returned if Thunder Plaugin Handle is obtained and Network Plugin Event is subscribed with ERROR_NONE |
| false | returned if there is a failure to get Thunder Plugin Handle or if the Event Subscription fails (with Status not ERROR_NONE) | |
| Description | This is triggered by the MaintenanceonBootup and startMaintenance to execute all maintenance tasks in a specific order with all preconditions asserted like Network Status, reboot flags, critical update, etc |
|---|---|
| Prototype | void MaintenanceManager::task_execution_thread() |
| Input Args | None |
| Return | void |
| Description | A Plugin method to get a plugin handler for a Plugin with a Callsign. It creates a Toke on runtime to get the Plugin handle |
|---|---|
| Prototype | WPEFramework::JSONRPC::LinkType<WPEFramework::Core::JSON::IElement>* MaintenanceManager::getThunderPluginHandle(const char* callsign) |
| Input Args | const char* callsign |
| Return | WPEFramework::JSONRPC::LinkType<WPEFramework::Core::JSON::IElement>* |
| Description | This is an event handler method that is triggered subscribeForInternetStatusEvent() when there is a network state change from the Network Plugin. |
|---|---|
| Prototype | void MaintenanceManager::internetStatusChangeEventHandler(const JsonObject& parameters) |
| Input Args | const JsonObject& parameters |
| Return | void |
| Description | A Maintenance Manager method to trigger Critical tasks via 3 Scripts
These are triggered in case if the network is reconnected after there is no active network connection available during an Unsolicited Maintenance and network retry fails with Maintenance Status with MAINTENANCE_ERROR |
|---|---|
| Prototype | void MaintenanceManager::startCriticalTasks |
| Input Args | NA |
| Return | void |
| Description | This method checks if Network Plugin is active and subscribes to Network state change; This uses runtime token creation to communicate with Thunder | |
|---|---|---|
| Prototype | bool MaintenanceManager::checkNetwork() | |
| Input Args | None | |
| Return | false | returns when Plugin is not active or the network plugin connection check fails |
| true | other cases | |
| Description | This utility method brings in a network retry mechanism with MAX_NETWORK_RETRIES retries (4) for a retry delay NETWORK_RETRY_INTERVAL (30 seconds). This uses checkNetwork() to get the state of network plugin state change. | |
|---|---|---|
| Prototype | bool MaintenanceManager::isDeviceOnline() | |
| Input Args | None | |
| Return | true | returns if any try or retry of network check gives true |
| false | returns if the network is not available even after 4 retries | |
| Description | This method initializes Maintenance Manager service and instance and also calls subscribeToDeviceInitializationEvent() in WhoAmI to subscribe to onDeviceInitializationContextUpdate Event from SecManager. This also initializes IARM thru InitializeIARM() and returns an empty string |
|---|---|
| Prototype | const string MaintenanceManager::Initialize(PluginHost::IShell* service) |
| Input Args | PluginHost::IShell* service |
| Return | string |
| Description | This method Deinitializes the MaintenanceManager services releases it triggers stopMaintenanceTasks() to gracefully exit maintenance and deinitializes IARM via DeinitializeIARM() |
|---|---|
| Prototype | void MaintenanceManager::Deinitialize(PluginHost::IShell* service) |
| Input Args | PluginHost::IShell* service |
| Return | void |
| Description | This method checks if IARM is Initialized and registers event handlers for Maintenance Event Update Event and DCM Start Time Event |
|---|---|
| Prototype | void MaintenanceManager::InitializeIARM() |
| Input Args | None |
| Return | void |
| Description | This is a Maintenance API to trigger Maintenance Task execution thread by setting appropriate preconditions and flags to them |
|---|---|
| Prototype | void MaintenanceManager::maintenanceManagerOnBootup() |
| Input Args | None |
| Return | void |
| Description | This is an event handler to trigger IARM Event Handler iarmEventHandler() for events triggered by InitializeIARM() and DeinitializeIARM() |
|---|---|
| Prototype | void MaintenanceManager::_MaintenanceMgrEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) |
| Input Args | const char *owner, IARM_EventId_t eventId, void *data, size_t len |
| Return | void |
| Description | This is an IARM based event handler for Maintenance Manager, triggered by _MaintenanceMgrEventHandler, this sets appropriate Task Completion or Error Status and completion/ incompletion of all tasks it sets the Maintenance Status and joins the thread accordingly |
|---|---|
| Prototype | void MaintenanceManager::iarmEventHandler(const char *owner, IARM_EventId_t eventId, void *data, size_t len) |
| Input Args | const char *owner, IARM_EventId_t eventId, void *data, size_t len |
| Return | void |
| Description | This method checks if IARM is Connected and removes event handlers for Maintenance Event Update Event and DCM Start Time Event |
|---|---|
| Prototype | void MaintenanceManager::DeinitializeIARM() |
| Input Args | None |
| Return | void |
| Description | This Utility method is triggered via stopMaintenance() RPC method to stop a running (MAINTENANCE_STARTED) maintenance cycle gracefully. It aborts all the tasks on a running Maintenance using abortTask(). And once that is done, the threads used are joined and MAINTENANCE_ERROR is set as Maintenance Status on exit | |
|---|---|---|
| Prototype | bool MaintenanceManager::stopMaintenanceTasks() | |
| Input Args | None | |
| Return | true | returns if all tasks are gracefully exited (aborted) |
| false | returns in any other cases | |
| Description | A Utility method to read the RFC Value set for the RFC Parameter passed (Boolean Data type RFCs only) and returns it | |
|---|---|---|
| Prototype | bool MaintenanceManager::readRFC(const char *rfc) | |
| Input Args | const char *rfc | |
| Return | true | if the RFC Param stored has value "true" |
| false | if the RFC Param stored has value "false" or the RFC Param does not exist | |
| Description | A Utility method used by Maintenance Manager. This uses getTaskPID() to get the PID of the process to be aborted and terminates it with an appropriate Signal passed. This is triggered in case of Stop Maintenance |
|---|---|
| Prototype | int MaintenanceManager::abortTask(const char* taskname, int sig_to_send) |
| Input Args | const char* taskname, int sig_to_send |
| Return | int |
| Description | A Utility method used in Maintenance Manager to get the process PID. This is used to abort the Task gracefully using its PID in case Stop Maintenance is being triggered |
|---|---|
| Prototype | pid_t MaintenanceManager::getTaskPID(const char* taskname) |
| Input Args | const char* taskname |
| Return | pid_t |
| Description | JsonRPC Method to get the current Maintenance Status or the Maintenance Status of the recent Maintenance Activity (either of MAINTENANCE_IDLE/ MAINTENANCE_STARTED/ MAINTENANCE_ERROR/ MAINTENANCE_COMPLETE/ MAINTENANCE_INCOMPLETE) along with info like isCriticalMaintenance |
|---|---|
| Prototype | uint32_t MaintenanceManager::getMaintenanceActivityStatus(const JsonObject& parameters, JsonObject& response) |
| Parameters | const JsonObject& parameters, JsonObject& response |
| RPC Call | curl -H "Authorization: Bearer `WPEFrameworkSecurityUtility | cut -d '"' -f 4`" --header "Content-Type: application/json" --request POST --silent -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.getMaintenanceActivityStatus","params":{}}' http://127.0.0.1:9998/jsonrpc |
| Response | {"jsonrpc":"2.0","id":3,"result":{"maintenanceStatus":"MAINTENANCE_ERROR","LastSuccessfulCompletionTime":0,"isCriticalMaintenance":false,"isRebootPending":false,"success":true}} |
| Return | uint32_t |
| Description | returns the future time window - start time in epoch or Unix Time (UTC) - of the critical activities in the maintenance schedule. The time the critical activities start is uniformly distributed by XConf across the entire population of CPEs (based on the PMI).
| |
|---|---|---|
| Prototype | uint32_t MaintenanceManager::getMaintenanceStartTime (const JsonObject& parameters, JsonObject& response) | |
| Parameters | const JsonObject& parameters, JsonObject& response | |
| RPC Call | curl -H "Authorization: Bearer `WPEFrameworkSecurityUtility | cut -d '"' -f 4`" --header "Content-Type: application/json" --request POST --silent -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.getMaintenanceStartTime","params":{}}' http://127.0.0.1:9998/jsonrpc | |
| Response | Positive | {"jsonrpc":"2.0","id":3,"result":{"maintenanceStartTime":1640094912,"success":true}} |
| Negative | {"jsonrpc":"2.0","id":3,"result":{"maintenanceStartTime":-1,"success":true}} | |
| Return | uint32_t | |
| Description | JsonRPC Method to start a Maintenance Cycle (SOLICITED MAINTENANCE). This is triggered by App (EPG/AS) to start scheduled maintenance based on the Start Maintenance Time. This RPC can be triggered only when a Maintenance Cycle is not running already. This will give a successful response with positive response when a maintenance is not running already and the trigger is successfule. It returns false response if the trigger fails or if there is already a maintenance is running. | |
|---|---|---|
| Prototype | uint32_t MaintenanceManager::startMaintenance(const JsonObject& parameters, JsonObject& response) | |
| Parameters | const JsonObject& parameters, JsonObject& response | |
| RPC Call | curl -H "Authorization: Bearer `WPEFrameworkSecurityUtility | cut -d '"' -f 4`" --header "Content-Type: application/json" --request POST --silent -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.startMaintenance","params":{}}' http://127.0.0.1:9998/jsonrpc | |
| Response | Positive | {"jsonrpc":"2.0","id":3,"result":{"success":true}} |
| Negative | {"jsonrpc":"2.0","id":3,"result":{"success":false}} | |
| Return | uint32_t | |
| Description | JsonRPC Method to gracefully end all the current running maintenance tasks, joins all threads and exists maintenance with MAINTENANCE_ERROR Status. This RPC Call gives successful response with true if the running maintenance is stopped successfully and it returns false response if there is a failure in the stopping process or if thee is no running Maintenance to stop. This is used by App (EPG/AS) to stop the current running maintenance. Stop Maintenance feature is controlled via an | |
|---|---|---|
| Prototype | uint32_t MaintenanceManager::stopMaintenance(const JsonObject& parameters, JsonObject& response) | |
| Parameters | const JsonObject& parameters, JsonObject& response | |
| RPC Call |
| |
| Response | Positive |
|
Negative |
| |
| Return | uint32_t | |
| Description | JsonRPC Method to set the Maintenance Mode.
| |
|---|---|---|
| Prototype | uint32_t MaintenanceManager::setMaintenanceMode(const JsonObject& parameters, JsonObject& response) | |
| Parameters | const JsonObject& parameters, JsonObject& response | |
| RPC Call | FOREGROUND | curl -H "Authorization: Bearer `WPEFrameworkSecurityUtility | cut -d '"' -f 4`" --header "Content-Type: application/json" --request POST --silent -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.setMaintenanceMode","params":{"maintenanceMode":"FOREGROUND"}}' http://127.0.0.1:9998/jsonrpc |
| BACKGROUND | curl -H "Authorization: Bearer `WPEFrameworkSecurityUtility | cut -d '"' -f 4`" --header "Content-Type: application/json" --request POST --silent -d '{"jsonrpc":"2.0","id":"3","method":"org.rdk.MaintenanceManager.1.setMaintenanceMode","params":{"maintenanceMode":"BACKGROUND"}}' http://127.0.0.1:9998/jsonrpc | |
| Response | Positive |
|
| Negative |
| |
| Return | uint32_t | |
| Description | JsonRPC Method to get the current Maintenance Manager Mode (either FOREGROUND/ BACKGROUND). The received response will also have OptOut Value (NONE/ IGNORE_UPDATE/ BYPASS_OUTPUT/ ENFORECE_OPTOUT) | |
|---|---|---|
| Prototype | uint32_t MaintenanceManager::getMaintenanceMode(const JsonObject& parameters, JsonObject& response) | |
| Parameters | const JsonObject& parameters, JsonObject& response | |
| RPC Call |
| |
| Response | Foreground |
|
Background |
| |
| Return | uint32_t | |
| Description | This is a critical utility method which sends IARM Event upon Maintenance Status Event changes during the Maintenance Flow |
|---|---|
| Prototype | void MaintenanceManager::onMaintenanceStatusChange(Maint_notify_status_t status) |
| Input Args | Maint_notify_status_t status |
| Return | void |
| Description | Utility function to get the string equivalent of Maintenance Status passed | |
|---|---|---|
| Prototype | string notifyStatusToString(Maint_notify_status_t &status); | |
| Input Args | Maint_notify_status_t &status | |
| Return | string | Returns the corresponding Maintenance Status String for the respective Maintenance Status. Below are the possible Maintenance statuses that will be returned
|
| Description | Utility function if the OptOut passed is from one that is honored by Maintenance Manager | |
|---|---|---|
| Prototype | bool checkValidOptOutModes(string OptoutModes); | |
| Input Args | string OptoutModes | |
| Return | true | Returns when the passed OptOutMode is in either of the one below;
|
| false | Returns when the OptOut is not any of the above | |
| Description | Utility function to get the string equivalent of Maintenance IARM Activity Status passed | |
|---|---|---|
| Prototype | string moduleStatusToString(IARM_Maint_module_status_t &status); | |
| Input Args | IARM_Maint_module_status_t &status | |
| Return | string | Returns the corresponding Maintenance Status String for the respective Maintenance IARM Status. Below are the possible IARM statuses that will be returned
|