diff --git a/README.md b/README.md
index 567424c..50a924e 100644
--- a/README.md
+++ b/README.md
@@ -37,6 +37,18 @@ config lwn 'lwn'
option port ''
```
+> Note: icwmp depends on usp.raw for all datamodel parameters, some `DeviceId` related parameters can be overwritten by writing them directly on `/etc/config/cwmp` file.
+
+```bash
+uci set cwmp.cpe.manufacturer="ABC"
+uci set cwmp.cpe.manufacturer_oui="XXX"
+uci set cwmp.cpe.product_class="TEST_CLASS"
+uci set cwmp.cpe.serial_number="1234567890"
+uci set cwmp.cpe.software_version="X.Y.Z"
+uci set cwmp.cpe.model_name="MODELXXX"
+uci set cwmp.cpe.description="This is a test device"
+uci commit cwmp
+```
> Complete UCI for `cwmp` configuration available in [link](./docs/api/uci.cwmp.md) or [raw schema](./schemas/uci/cwmp.json)
## RPCs Method supported
@@ -233,6 +245,7 @@ Valid commands:
set_notif [path-expr] [notification] => set parameter notifications
```
> Note: icwmpd CLI is a debug utility and hence it is advised to use for debug and development purpose only.
+> icwmpd CLI utility is independent of icwmpd daemon.
icwmp CLI command success result is displayed in the terminal as following:
diff --git a/config.c b/config.c
index 7d1bf10..00bdc4a 100755
--- a/config.c
+++ b/config.c
@@ -625,11 +625,11 @@ end:
int cwmp_get_deviceid(struct cwmp *cwmp)
{
- cwmp->deviceid.manufacturer = strdup(cwmp_db_get_value_string("device", "deviceinfo", "Manufacturer"));
- cwmp->deviceid.serialnumber = strdup(cwmp_db_get_value_string("device", "deviceinfo", "SerialNumber"));
- cwmp->deviceid.productclass = strdup(cwmp_db_get_value_string("device", "deviceinfo", "ProductClass"));
- cwmp->deviceid.oui = strdup(cwmp_db_get_value_string("device", "deviceinfo", "ManufacturerOUI"));
- cwmp->deviceid.softwareversion = strdup(cwmp_db_get_value_string("device", "deviceinfo", "SoftwareVersion"));
+ cwmp_usp_get_single("Device.DeviceInfo.Manufacturer", &cwmp->deviceid.manufacturer);
+ cwmp_usp_get_single("Device.DeviceInfo.SerialNumber", &cwmp->deviceid.serialnumber);
+ cwmp_usp_get_single("Device.DeviceInfo.ProductClass", &cwmp->deviceid.productclass);
+ cwmp_usp_get_single("Device.DeviceInfo.ManufacturerOUI", &cwmp->deviceid.oui);
+ cwmp_usp_get_single("Device.DeviceInfo.SoftwareVersion", &cwmp->deviceid.softwareversion);
return CWMP_OK;
}
diff --git a/cwmp_uci.c b/cwmp_uci.c
index ee296d3..f384457 100644
--- a/cwmp_uci.c
+++ b/cwmp_uci.c
@@ -14,8 +14,6 @@
struct uci_paths uci_save_conf_paths[] = {
[UCI_STANDARD_CONFIG] = { "/etc/config", "/tmp/.uci", NULL },
- [UCI_DB_CONFIG] = { "/lib/db/config", NULL, NULL },
- [UCI_BOARD_DB_CONFIG] = { "/etc/board-db/config", NULL, NULL },
[UCI_VARSTATE_CONFIG] = { "/var/state", NULL, NULL }
};
@@ -171,15 +169,6 @@ int cwmp_uci_get_option_value_string(char *package, char *section, char *option,
return UCI_OK;
}
-char* cwmp_db_get_value_string(char *package, char *section, char *option)
-{
- char *value = NULL;
- cwmp_uci_get_option_value_string(package, section, option, folder_exists("/lib/db/config") ? UCI_DB_CONFIG : UCI_BOARD_DB_CONFIG, &value);
- if (value == NULL)
- value = "";
- return value;
-}
-
int cwmp_uci_get_value_by_path(char *path, uci_config_paths uci_type, char **value)
{
struct uci_ptr ptr;
diff --git a/datamodel_interface.c b/datamodel_interface.c
index 69bd958..9ea2d41 100755
--- a/datamodel_interface.c
+++ b/datamodel_interface.c
@@ -506,3 +506,25 @@ char *cwmp_delete_object(char *object_name, char *key)
return NULL;
}
+
+
+int cwmp_usp_get_single(char *param, char **value)
+{
+ struct cwmp_dm_parameter *pv = NULL;
+ LIST_HEAD(params_list);
+
+ if (param == NULL || value == NULL)
+ return -1;
+
+ cwmp_get_parameter_values(param, ¶ms_list);
+ list_for_each_entry (pv, ¶ms_list, list) {
+ if (strncmp(param, pv->name, strlen(param)) == 0) {
+ *value = (pv->value)?strdup(pv->value):strdup("");
+ break;
+ }
+ }
+
+ cwmp_free_all_dm_parameter_list(¶ms_list);
+
+ return 0;
+}
diff --git a/docs/api/uci.cwmp.md b/docs/api/uci.cwmp.md
index c100a6e..429432e 100644
--- a/docs/api/uci.cwmp.md
+++ b/docs/api/uci.cwmp.md
@@ -173,6 +173,55 @@
default |
description |
+
+ manufacturer |
+ string |
+ no |
+ |
+ Overwrite DeviceId parameter |
+
+
+ manufacturer_oui |
+ string |
+ no |
+ |
+ Overwrite DeviceId parameter |
+
+
+ product_class |
+ string |
+ no |
+ |
+ Overwrite DeviceId parameter |
+
+
+ serial_number |
+ string |
+ no |
+ |
+ Overwrite DeviceId parameter |
+
+
+ software_version |
+ string |
+ no |
+ |
+ Overwrite DeviceId parameter |
+
+
+ model_name |
+ string |
+ no |
+ |
+ Overwrite DeviceId parameter |
+
+
+ description |
+ string |
+ no |
+ |
+ Overwrite DeviceId parameter |
+
interface |
string |
diff --git a/inc/cwmp_uci.h b/inc/cwmp_uci.h
index 4f518d2..51dad83 100644
--- a/inc/cwmp_uci.h
+++ b/inc/cwmp_uci.h
@@ -70,8 +70,6 @@
typedef enum uci_config_paths
{
UCI_STANDARD_CONFIG,
- UCI_DB_CONFIG,
- UCI_BOARD_DB_CONFIG,
UCI_VARSTATE_CONFIG
}uci_config_paths;
@@ -132,7 +130,6 @@ int uci_set_value_by_path(char *cmd, char *value, uci_config_paths uci_type);
int cwmp_uci_set_value_by_path(char *path, char *value);
int cwmp_uci_set_varstate_value_by_path(char *path, char *value);
int uci_get_value(char *cmd, char **value);
-char* cwmp_db_get_value_string(char *package, char *section, char *option);
struct uci_section *cwmp_uci_walk_section(char *package, char *stype, void *arg1, void *arg2, int cmp, int (*filter)(struct uci_section *s, void *value), struct uci_section *prev_section, uci_config_paths uci_type, int walk);
int cwmp_uci_get_value_by_section_string(struct uci_section *s, char *option, char **value);
int cwmp_uci_get_option_value_string(char *package, char *section, char *option, uci_config_paths uci_type, char **value);
diff --git a/inc/datamodel_interface.h b/inc/datamodel_interface.h
index 53bebe4..6c43031 100644
--- a/inc/datamodel_interface.h
+++ b/inc/datamodel_interface.h
@@ -12,6 +12,7 @@ bool cwmp_transaction_commit();
bool cwmp_transaction_abort();
bool cwmp_transaction_status();
char *cwmp_get_parameter_values(char *parameter_name, struct list_head *parameters_list);
+int cwmp_usp_get_single(char *param, char **value);
char *cwmp_get_multiple_parameters_values(struct list_head *arg_params_list, struct list_head *parameters_list);
char *cwmp_get_single_parameter_value(char *parameter_name, struct cwmp_dm_parameter *dm_parameter);
int cwmp_set_multiple_parameters_values(struct list_head *parameters_values_list, char *parameter_key, int *flag, struct list_head *faults_list);
diff --git a/schemas/uci/cwmp.json b/schemas/uci/cwmp.json
index cfb49b7..82becc3 100644
--- a/schemas/uci/cwmp.json
+++ b/schemas/uci/cwmp.json
@@ -131,6 +131,55 @@
"description": "CWMP client configuration",
"multi": false,
"options": [
+ {
+ "name": "manufacturer",
+ "type": "string",
+ "required": "no",
+ "default": "",
+ "description": "Overwrite DeviceId parameter"
+ },
+ {
+ "name": "manufacturer_oui",
+ "type": "string",
+ "required": "no",
+ "default": "",
+ "description": "Overwrite DeviceId parameter"
+ },
+ {
+ "name": "product_class",
+ "type": "string",
+ "required": "no",
+ "default": "",
+ "description": "Overwrite DeviceId parameter"
+ },
+ {
+ "name": "serial_number",
+ "type": "string",
+ "required": "no",
+ "default": "",
+ "description": "Overwrite DeviceId parameter"
+ },
+ {
+ "name": "software_version",
+ "type": "string",
+ "required": "no",
+ "default": "",
+ "description": "Overwrite DeviceId parameter"
+ },
+ {
+ "name": "model_name",
+ "type": "string",
+ "required": "no",
+ "default": "",
+ "description": "Overwrite DeviceId parameter"
+ },
+ {
+ "name": "description",
+ "type": "string",
+ "required": "no",
+ "default": "",
+ "description": "Overwrite DeviceId parameter"
+ },
{
"name": "interface",
"type": "string",
diff --git a/test/cmocka/icwmp_uci_unit_test.c b/test/cmocka/icwmp_uci_unit_test.c
index f59ce5a..bf248e1 100644
--- a/test/cmocka/icwmp_uci_unit_test.c
+++ b/test/cmocka/icwmp_uci_unit_test.c
@@ -59,13 +59,6 @@ static void cwmp_uci_get_tests(void **state)
assert_int_equal(error, UCI_OK);
assert_null(value);
- value = cwmp_db_get_value_string("device", "deviceinfo", "ProductClass");
- assert_string_equal(value, "FirstClass");
-
-
- value = cwmp_db_get_value_string("device", "deviceinfo", "wrong_option");
- assert_string_equal(value, "");
-
error = cwmp_uci_get_option_value_string("cwmp", "acs", "dhcp_url", UCI_VARSTATE_CONFIG, &value);
assert_int_equal(error, UCI_OK);
assert_string_equal(value, "http://192.168.103.160:8080/openacs/acs");