#include "pon_ctrl.h"
#include <amxc/amxc_macros.h>
#include <amxc/amxc.h>
#include <amxm/amxm.h>
#include "module_mgmt.h"
#include "xpon_trace.h"
Go to the source code of this file.
|
static int | call_pon_ctrl_function_common (const char *const func_name, amxc_var_t *args, amxc_var_t *ret) |
|
static void | set_max_nr_of_onus (void) |
|
void | pon_ctrl_init (void) |
|
void | pon_ctrl_set_enable (const char *const path, bool enable) |
|
int | pon_ctrl_get_list_of_instances (const char *const path, amxc_var_t *ret) |
|
int | pon_ctrl_get_object_content (const char *const path, uint32_t index, amxc_var_t *ret) |
|
int | pon_ctrl_get_param_values (const char *const path, const char *const names, amxc_var_t *ret) |
|
void | pon_ctrl_handle_file_descriptor (int fd) |
|
void | pon_ctrl_set_password (const char *const ani_path, const char *const password, bool hex) |
|
◆ call_pon_ctrl_function_common()
static int call_pon_ctrl_function_common |
( |
const char *const |
func_name, |
|
|
amxc_var_t * |
args, |
|
|
amxc_var_t * |
ret |
|
) |
| |
|
static |
Definition at line 85 of file pon_ctrl.c.
90 amxc_var_t* ret_dummy = NULL;
92 when_null_trace(args, exit, ERROR,
"args is NULL");
95 when_null_trace(so_name, exit, ERROR,
"No vendor module loaded");
98 if(amxc_var_new(&ret_dummy)) {
99 SAH_TRACEZ_ERROR(
ME,
"Failed to allocate memory");
104 rc = amxm_execute_function(so_name,
MOD_PON_CTRL, func_name, args,
105 ret ? ret : ret_dummy);
107 SAH_TRACEZ_ERROR(
ME,
"%s.%s.%s() failed: rc=%d", so_name,
MOD_PON_CTRL,
112 if(ret_dummy != NULL) {
113 amxc_var_delete(&ret_dummy);
const char * mod_get_vendor_module_loaded(void)
static const char *const MOD_PON_CTRL
◆ pon_ctrl_get_list_of_instances()
int pon_ctrl_get_list_of_instances |
( |
const char *const |
path, |
|
|
amxc_var_t * |
ret |
|
) |
| |
Ask vendor module which instances exist for a template object.
- Parameters
-
[in] | path | path to template object, e.g. "XPON.ONU" or "XPON.ONU.1.SoftwareImage" |
[in,out] | ret | function returns result via this parameter. See below for more info. |
The param ret should be an htable with following keys upon success:
- 'indexes': a string with comma-separated integers representing the instance indexes. It's an empty string if no instances exist.
- Returns
- 0 on success, -1 upon error
Definition at line 187 of file pon_ctrl.c.
190 amxc_var_init(&args);
191 amxc_var_set(cstring_t, &args, path);
196 amxc_var_clean(&args);
static const char *const GET_LIST_OF_INSTANCES
static int call_pon_ctrl_function_common(const char *const func_name, amxc_var_t *args, amxc_var_t *ret)
◆ pon_ctrl_get_object_content()
int pon_ctrl_get_object_content |
( |
const char *const |
path, |
|
|
uint32_t |
index, |
|
|
amxc_var_t * |
ret |
|
) |
| |
Ask vendor module for the content (parameter values) of an object.
- Parameters
-
[in] | path | object path. This can be a singleton or template object. |
[in] | index | instance index when querying the content of an instance. Must be 0 when querying a singleton. |
[in,out] | ret | function returns result via this parameter. See below for more info. |
The param ret should be an htable with following keys upon success:
- 'parameters': values for the parameters of the object
- 'keys': only present in ret when querying an instance. It should contain values for the keys of the template object.
- Returns
- 0 on success, -1 upon error
Definition at line 216 of file pon_ctrl.c.
219 amxc_var_init(&args);
221 amxc_var_set_type(&args, AMXC_VAR_ID_HTABLE);
222 amxc_var_add_key(cstring_t, &args,
"path", path);
224 amxc_var_add_key(uint32_t, &args,
"index", index);
229 amxc_var_clean(&args);
static const char *const GET_OBJECT_CONTENT
◆ pon_ctrl_get_param_values()
int pon_ctrl_get_param_values |
( |
const char *const |
path, |
|
|
const char *const |
names, |
|
|
amxc_var_t * |
ret |
|
) |
| |
Ask vendor module for the values of one or more parameters of an object.
- Parameters
-
[in] | path | object path of a singleton or an instance |
[in] | names | parameter names formatted as a comma-separated list. The vendor module might support passing max 1 parameter name. Example: "RxPower". |
[in,out] | ret | function returns result via this parameter. See below for more info. |
The param ret should be an htable with following keys upon success:
- 'parameters': values for the requested parameter(s) of the object
- Returns
- 0 on success, -1 upon error
Definition at line 248 of file pon_ctrl.c.
253 amxc_var_init(&args);
255 amxc_var_set_type(&args, AMXC_VAR_ID_HTABLE);
256 amxc_var_add_key(cstring_t, &args,
"path", path);
257 amxc_var_add_key(cstring_t, &args,
"names", names);
262 amxc_var_clean(&args);
static const char *const GET_PARAM_VALUES
#define SAH_TRACEZ_DEBUG(zone, format,...)
◆ pon_ctrl_handle_file_descriptor()
void pon_ctrl_handle_file_descriptor |
( |
int |
fd | ) |
|
Ask vendor module to handle (a message arriving on) a file descriptor.
- Parameters
-
[in] | fd | the file descriptor to handle |
Examples for the file descriptor:
- file descriptor of the socket the vendor module uses for IPC with the vendor specific PON/OMCI stack.
- file descriptor of a socket to monitor netlink messages from the kernel.
- ...
Definition at line 277 of file pon_ctrl.c.
281 amxc_var_set(fd_t, &var, fd);
283 amxc_var_clean(&var);
static const char *const HANDLE_FILE_DESCRIPTOR
◆ pon_ctrl_init()
void pon_ctrl_init |
( |
void |
| ) |
|
Initialize the pon_ctrl part of this plugin.
The function forwards value of MAX_NR_OF_ONUS to the vendor module.
The plugin must call this function once at startup, after loading the vendor module.
Definition at line 142 of file pon_ctrl.c.
static void set_max_nr_of_onus(void)
◆ pon_ctrl_set_enable()
void pon_ctrl_set_enable |
( |
const char *const |
path, |
|
|
bool |
enable |
|
) |
| |
Let vendor module know that a read-write Enable field was changed.
- Parameters
-
[in] | path | path of object whose Enable field was changed, e.g., "XPON.ONU.1", or "XPON.ONU.1.ANI.1" |
[in] | enable | true if Enable field was set to true, else false |
Definition at line 153 of file pon_ctrl.c.
156 amxc_var_init(&args);
160 amxc_var_set_type(&args, AMXC_VAR_ID_HTABLE);
162 amxc_var_add_key(cstring_t, &args,
"path", path);
163 amxc_var_add_key(
bool, &args,
"enable", enable);
166 SAH_TRACEZ_ERROR(
ME,
"path='%s' enable=%d: %s() failed",
170 amxc_var_clean(&args);
static const char *const SET_ENABLE
◆ pon_ctrl_set_password()
void pon_ctrl_set_password |
( |
const char *const |
ani_path, |
|
|
const char *const |
password, |
|
|
bool |
hex |
|
) |
| |
Ask vendor module to apply the password.
- Parameters
-
[in] | ani_path | path to ANI instance, e.g. "XPON.ONU.1.ANI.1" |
[in] | password | new value for the parameter Password of the ANI referred to by ani_path |
[in] | hex | false if password is in ASCII format; true if password is in hexadecimal format |
Definition at line 295 of file pon_ctrl.c.
299 amxc_var_init(&args);
301 amxc_var_set_type(&args, AMXC_VAR_ID_HTABLE);
302 amxc_var_add_key(cstring_t, &args,
"ani_path", ani_path);
303 amxc_var_add_key(cstring_t, &args,
"password", password);
304 amxc_var_add_key(
bool, &args,
"is_hexadecimal_password", hex);
308 amxc_var_clean(&args);
static const char *const SET_PASSWORD
◆ set_max_nr_of_onus()
static void set_max_nr_of_onus |
( |
void |
| ) |
|
|
static |
Forward value of MAX_NR_OF_ONUS to the vendor module.
Definition at line 122 of file pon_ctrl.c.
124 amxc_var_init(&args);
125 amxc_var_set(uint32_t, &args, MAX_NR_OF_ONUS);
128 SAH_TRACEZ_ERROR(
ME,
"Failed to set max nr of ONUs");
131 amxc_var_clean(&args);
static const char *const SET_MAX_NR_OF_ONUS
◆ GET_LIST_OF_INSTANCES
const char* const GET_LIST_OF_INSTANCES = "get_list_of_instances" |
|
static |
◆ GET_OBJECT_CONTENT
const char* const GET_OBJECT_CONTENT = "get_object_content" |
|
static |
◆ GET_PARAM_VALUES
const char* const GET_PARAM_VALUES = "get_param_values" |
|
static |
◆ HANDLE_FILE_DESCRIPTOR
const char* const HANDLE_FILE_DESCRIPTOR = "handle_file_descriptor" |
|
static |
◆ MOD_PON_CTRL
const char* const MOD_PON_CTRL = "pon_ctrl" |
|
static |
◆ SET_ENABLE
const char* const SET_ENABLE = "set_enable" |
|
static |
◆ SET_MAX_NR_OF_ONUS
const char* const SET_MAX_NR_OF_ONUS = "set_max_nr_of_onus" |
|
static |
◆ SET_PASSWORD
const char* const SET_PASSWORD = "set_password" |
|
static |