TR181-XPON
1.4.0
TR-181 PON manager.
|
#include "dm_actions.h"
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>
#include <amxc/amxc_macros.h>
#include <amxc/amxc.h>
#include <amxp/amxp.h>
#include <amxd/amxd_action.h>
#include <amxd/amxd_object.h>
#include "ani.h"
#include "object_intf_priv.h"
#include "onu_priv.h"
#include "password.h"
#include "pon_ctrl.h"
#include "utils_time.h"
#include "xpon_trace.h"
Go to the source code of this file.
Typedefs | |
typedef enum _private_data_type | private_data_type_t |
Enumerations | |
enum | _private_data_type { private_data_for_onu = 0 , private_data_for_object_interface } |
Functions | |
void | dm_actions_set_ignore_param_reads (bool ignore) |
static bool | process_param_value (const char *const param_name, const amxc_var_t *const ret, amxc_var_t *const retval) |
amxd_status_t | _read_trx_param (amxd_object_t *object, amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, amxc_var_t *const retval, void *priv) |
amxd_status_t | _lastchange_on_read (amxd_object_t *const object, UNUSED amxd_param_t *const param, amxd_action_t reason, UNUSED const amxc_var_t *const args, amxc_var_t *const retval, UNUSED void *priv_unused) |
amxd_status_t | object_destroyed_common (amxd_object_t *object, amxd_action_t reason, private_data_type_t private_data_type) |
amxd_status_t | _onu_destroyed (amxd_object_t *object, UNUSED amxd_param_t *param, amxd_action_t reason, UNUSED const amxc_var_t *const args, UNUSED amxc_var_t *const retval, UNUSED void *priv_unused) |
amxd_status_t | _interface_object_destroyed (amxd_object_t *object, UNUSED amxd_param_t *param, amxd_action_t reason, UNUSED const amxc_var_t *const args, UNUSED amxc_var_t *const retval, UNUSED void *priv_unused) |
amxd_status_t | _check_password (amxd_object_t *object, UNUSED amxd_param_t *param, amxd_action_t reason, const amxc_var_t *const args, UNUSED amxc_var_t *const retval, UNUSED void *priv) |
Variables | |
static bool | s_ignore_param_reads = false |
typedef enum _private_data_type private_data_type_t |
enum _private_data_type |
Enumerator | |
---|---|
private_data_for_onu | |
private_data_for_object_interface |
Definition at line 285 of file dm_actions.c.
amxd_status_t _check_password | ( | amxd_object_t * | object, |
UNUSED amxd_param_t * | param, | ||
amxd_action_t | reason, | ||
const amxc_var_t *const | args, | ||
UNUSED amxc_var_t *const | retval, | ||
UNUSED void * | priv | ||
) |
Called if Password parameter of an ANI instance is changed.
[in] | object | the TC.Authentication object of an ANI instance whose Password parameter is changed |
[in] | reason | this must be 'action_param_validate' |
[in] | args | variant with cstring_t value for the Password |
Definition at line 394 of file dm_actions.c.
amxd_status_t _interface_object_destroyed | ( | amxd_object_t * | object, |
UNUSED amxd_param_t * | param, | ||
amxd_action_t | reason, | ||
UNUSED const amxc_var_t *const | args, | ||
UNUSED amxc_var_t *const | retval, | ||
UNUSED void * | priv_unused | ||
) |
Called if an instance of an object interface is destroyed.
[in] | object | the object/instance being destroyed |
[in] | reason | this must be 'action_object_destroy' |
The function deletes the private data attached to the instance.
Definition at line 372 of file dm_actions.c.
amxd_status_t _lastchange_on_read | ( | amxd_object_t *const | object, |
UNUSED amxd_param_t *const | param, | ||
amxd_action_t | reason, | ||
UNUSED const amxc_var_t *const | args, | ||
amxc_var_t *const | retval, | ||
UNUSED void * | priv_unused | ||
) |
Called if a LastChange parameter is read.
[in] | object | object whose LastChange parameter is read |
[in] | action | this must be 'action_param_read' |
[in,out] | retval | the function returns the value for the LastChange parameter via this 'retval' parameter |
This function is called when the object with the LastChange parameter is is being created. Then 'object->priv' is still NULL. Therefore do not log an error if 'object->priv' is NULL.
Definition at line 241 of file dm_actions.c.
amxd_status_t _onu_destroyed | ( | amxd_object_t * | object, |
UNUSED amxd_param_t * | param, | ||
amxd_action_t | reason, | ||
UNUSED const amxc_var_t *const | args, | ||
UNUSED amxc_var_t *const | retval, | ||
UNUSED void * | priv_unused | ||
) |
Called if an ONU instance is destroyed.
[in] | object | the object/instance being destroyed |
[in] | reason | this must be 'action_object_destroy' |
The function deletes the private data attached to the instance.
Definition at line 351 of file dm_actions.c.
amxd_status_t _read_trx_param | ( | amxd_object_t * | object, |
amxd_param_t * | param, | ||
amxd_action_t | reason, | ||
const amxc_var_t *const | args, | ||
amxc_var_t *const | retval, | ||
void * | priv | ||
) |
Read a parameter value.
The Ambiorix framework calls this function every time a parameter is read which has this function as custom read handler.
The function has 'trx' in its name because for now it's only used to query the values of the volatile params of an XPON.ONU.{i}.ANI.1.Transceiver.{i} instance. But the function is generic in the sense that it can be used for other parameters (of other objects) in the future.
Go to 'exit' if function is called for a template object.
It does not make sense to read the param values of a template object. Only read them for a singleton or an instance.
See also: ST-826 - [amx] custom param read handler called more often than expected
Definition at line 162 of file dm_actions.c.
void dm_actions_set_ignore_param_reads | ( | bool | ignore | ) |
Set 's_ignore_param_reads' to ignore.
See doc in front of s_ignore_param_reads.
Definition at line 124 of file dm_actions.c.
amxd_status_t object_destroyed_common | ( | amxd_object_t * | object, |
amxd_action_t | reason, | ||
private_data_type_t | private_data_type | ||
) |
Helper function called when certain instances are deleted.
[in] | object | the object/instance being destroyed |
[in] | reason | this must be 'action_object_destroy' |
[in] | private_data_type | type of the private data to be destroyed |
The function deletes the private data attached to the instance.
Definition at line 302 of file dm_actions.c.
|
static |
|
static |
Do not ask vendor module for param value if this setting is true.
When deleting a Transceiver instance, the custom read handler _read_trx_param() is called many times for the parameters RxPower, TxPower, etc. This seems not ok. It does not make sense to query the parameters of an instance being deleted. See:
ST-826 - [amx] custom param read handler called more often than expected
If the vendor module calls dm_remove_instance() to delete a Transceiver instance, the plugin querying the parameter values in the vendor module when deleting the instance causes errors: the vendor module already considers the Transceiver instance deleted.
To avoid those errors, the plugin sets s_ignore_param_reads to true just before deleting an instance, and sets it back to false immediately afterwards. The plugin still calls the custom read handler while deleting a Transceiver instance, but the handler will not query the value in the vendor module.
The plugin sets s_ignore_param_reads to true for each instance it deletes, not only for Transceiver instances. This makes the code more future proof. We might reuse _read_trx_param() in the future for the volatile parameters of other template objects.
Definition at line 117 of file dm_actions.c.