Add input value validation to vendor extension mechanisms

This commit is contained in:
Amin Ben Ramdhane 2021-10-19 10:54:51 +01:00
parent 689da88d95
commit d04a757b2c
12 changed files with 2196 additions and 480 deletions

View file

@ -487,7 +487,8 @@ The application should bring its JSON file under **'/etc/bbfdm/json/'** path wit
"cwmp",
"usp"
],
"array": false
"array": false,
"access": false
}
```
@ -503,6 +504,7 @@ The application should bring its JSON file under **'/etc/bbfdm/json/'** path wit
"usp"
],
"array": true,
"access": true,
"mapping": {
"type": "uci",
"uci": {
@ -526,6 +528,7 @@ The application should bring its JSON file under **'/etc/bbfdm/json/'** path wit
"usp"
],
"array": true,
"access": false,
"mapping": {
"type": "ubus",
"ubus": {
@ -687,7 +690,14 @@ The application should bring its JSON file under **'/etc/bbfdm/json/'** path wit
> Note4: Each object definition in JSON file must begin with "Device." and should have the full parent path if it is under another object
- For more examples on JSON files, you can see these links: [X_IOPSYS_EU_MCPD](https://dev.iopsys.eu/feed/broadcom/-/blob/devel/mcpd/files/etc/bbfdm/json/X_IOPSYS_EU_MCPD.json), [UserInterface](/test/files/etc/bbfdm/json/UserInterface.json), [X_IOPSYS_EU_Dropbear](/test/files/etc/bbfdm/json/X_IOPSYS_EU_Dropbear.json)
> Note5: You can validate any JSON file using [Validate_JSON_Plugin](/test/tools/validate_json_plugin.py) python script.
```bash
$ ./test/tools/validate_json_plugin.py test/files/etc/bbfdm/json/UserInterface.json
$ ./test/tools/validate_json_plugin.py test/files/etc/bbfdm/json/X_IOPSYS_EU_TEST.json
```
- For more examples on JSON files, you can see these links: [X_IOPSYS_EU_MCPD](https://dev.iopsys.eu/feed/broadcom/-/blob/devel/mcpd/files/etc/bbfdm/json/X_IOPSYS_EU_MCPD.json), [UserInterface](/test/files/etc/bbfdm/json/UserInterface.json), [X_IOPSYS_EU_Dropbear](/test/files/etc/bbfdm/json/X_IOPSYS_EU_Dropbear.json), [X_IOPSYS_EU_TEST](/test/files/etc/bbfdm/json/X_IOPSYS_EU_TEST.json)
## BBFDM Tools
BBF tools are written in python3 and has below dependencies.

File diff suppressed because it is too large Load diff

View file

@ -146,19 +146,6 @@ struct dm_parameter {
char *additional_data;
};
struct dm_json_parameter {
struct list_head list;
char *name;
char *arg1;
char *arg2;
char *arg3;
char *arg4;
char *arg5;
char *arg6;
char *arg7;
char *arg8;
};
struct dmctx
{
bool stop;

View file

@ -1141,10 +1141,15 @@ int dm_validate_unsignedInt(char *value, struct range_args r_args[], int r_args_
if ((*value == '-') || (*endval != 0) || (errno != 0)) return -1;
if (r_args[i].min && r_args[i].max && minval == maxval) {
if (r_args[i].min && r_args[i].max) {
if (strlen(value) == minval)
break;
if (minval == maxval) {
if (strlen(value) == minval)
break;
} else {
if (ui_val >= minval && ui_val <= maxval)
break;
}
if (i == r_args_size - 1)
return -1;
@ -1179,6 +1184,17 @@ int dm_validate_int(char *value, struct range_args r_args[], int r_args_size)
if ((*endval != 0) || (errno != 0)) return -1;
if (r_args[i].min && r_args[i].max) {
if (i_val >= minval && i_val <= maxval)
break;
if (i == r_args_size - 1)
return -1;
continue;
}
/* check size */
if ((r_args[i].min && i_val < minval) || (r_args[i].max && i_val > maxval) || (i_val < INT_MIN) || (i_val > INT_MAX))
return -1;
@ -1206,6 +1222,17 @@ int dm_validate_unsignedLong(char *value, struct range_args r_args[], int r_args
if ((*value == '-') || (*endval != 0) || (errno != 0)) return -1;
if (r_args[i].min && r_args[i].max) {
if (ul_val >= minval && ul_val <= maxval)
break;
if (i == r_args_size - 1)
return -1;
continue;
}
/* check size */
if ((r_args[i].min && ul_val < minval) || (r_args[i].max && ul_val > maxval) || (ul_val > (unsigned long)ULONG_MAX))
return -1;
@ -1233,6 +1260,17 @@ int dm_validate_long(char *value, struct range_args r_args[], int r_args_size)
if ((*endval != 0) || (errno != 0)) return -1;
if (r_args[i].min && r_args[i].max) {
if (u_val >= minval && u_val <= maxval)
break;
if (i == r_args_size - 1)
return -1;
continue;
}
/* check size */
if ((r_args[i].min && u_val < minval) || (r_args[i].max && u_val > maxval))
return -1;
@ -1304,6 +1342,9 @@ int dm_validate_hexBinary(char *value, struct range_args r_args[], int r_args_si
static int dm_validate_size_list(int min_item, int max_item, int nbr_item)
{
if (((min_item > 0) && (max_item > 0) && (min_item == max_item) && (nbr_item == 2 * min_item)))
return 0;
if (((min_item > 0) && (nbr_item < min_item)) ||
((max_item > 0) && (nbr_item > max_item))) {
return -1;
@ -1340,7 +1381,7 @@ int dm_validate_string_list(char *value, int min_item, int max_item, int max_siz
int dm_validate_unsignedInt_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
{
char *token, *saveptr;
char *tmp, *saveptr;
int nbr_item = 0;
/* check length of list */
@ -1352,8 +1393,116 @@ int dm_validate_unsignedInt_list(char *value, int min_item, int max_item, int ma
DM_STRNCPY(buf, value, sizeof(buf));
/* for each value, validate string */
for (token = strtok_r(buf, ",", &saveptr); token != NULL; token = strtok_r(NULL, ",", &saveptr)) {
if (dm_validate_unsignedInt(token, r_args, r_args_size))
for (tmp = strtok_r(buf, ",", &saveptr); tmp != NULL; tmp = strtok_r(NULL, ",", &saveptr)) {
if (dm_validate_unsignedInt(tmp, r_args, r_args_size))
return -1;
nbr_item ++;
}
/* check size of list */
if (dm_validate_size_list(min_item, max_item, nbr_item))
return -1;
return 0;
}
int dm_validate_int_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
{
char *token, *pchr;
int nbr_item = 0;
/* check length of list */
if ((max_size > 0) && (strlen(value) > max_size))
return -1;
/* copy data in buffer */
char buf[strlen(value)+1];
DM_STRNCPY(buf, value, sizeof(buf));
/* for each value, validate string */
for (token = strtok_r(buf, ",", &pchr); token != NULL; token = strtok_r(NULL, ",", &pchr)) {
if (dm_validate_int(token, r_args, r_args_size))
return -1;
nbr_item ++;
}
/* check size of list */
if (dm_validate_size_list(min_item, max_item, nbr_item))
return -1;
return 0;
}
int dm_validate_unsignedLong_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
{
char *token, *tmp;
int nbr_item = 0;
/* check length of list */
if ((max_size > 0) && (strlen(value) > max_size))
return -1;
/* copy data in buffer */
char buf[strlen(value)+1];
DM_STRNCPY(buf, value, sizeof(buf));
/* for each value, validate string */
for (token = strtok_r(buf, ",", &tmp); token != NULL; token = strtok_r(NULL, ",", &tmp)) {
if (dm_validate_unsignedLong(token, r_args, r_args_size))
return -1;
nbr_item ++;
}
/* check size of list */
if (dm_validate_size_list(min_item, max_item, nbr_item))
return -1;
return 0;
}
int dm_validate_long_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
{
char *pch, *saveptr;
int nbr_item = 0;
/* check length of list */
if ((max_size > 0) && (strlen(value) > max_size))
return -1;
/* copy data in buffer */
char buf[strlen(value)+1];
DM_STRNCPY(buf, value, sizeof(buf));
/* for each value, validate string */
for (pch = strtok_r(buf, ",", &saveptr); pch != NULL; pch = strtok_r(NULL, ",", &saveptr)) {
if (dm_validate_long(pch, r_args, r_args_size))
return -1;
nbr_item ++;
}
/* check size of list */
if (dm_validate_size_list(min_item, max_item, nbr_item))
return -1;
return 0;
}
int dm_validate_hexBinary_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size)
{
char *pch, *spch;
int nbr_item = 0;
/* check length of list */
if ((max_size > 0) && (strlen(value) > max_size))
return -1;
/* copy data in buffer */
char buf[strlen(value)+1];
DM_STRNCPY(buf, value, sizeof(buf));
/* for each value, validate string */
for (pch = strtok_r(buf, ",", &spch); pch != NULL; pch = strtok_r(NULL, ",", &spch)) {
if (dm_validate_hexBinary(pch, r_args, r_args_size))
return -1;
nbr_item ++;
}

View file

@ -285,6 +285,10 @@ int dm_validate_dateTime(char *value);
int dm_validate_hexBinary(char *value, struct range_args r_args[], int r_args_size);
int dm_validate_string_list(char *value, int min_item, int max_item, int max_size, int min, int max, char *enumeration[], char *pattern[]);
int dm_validate_unsignedInt_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
int dm_validate_int_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
int dm_validate_unsignedLong_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
int dm_validate_long_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
int dm_validate_hexBinary_list(char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
char *decode64(char *enc);
bool folder_exists(const char *path);
bool file_exists(const char *path);

View file

@ -679,6 +679,22 @@ static void test_bbf_api_validate(void **state)
validate = dm_validate_unsignedInt("112", RANGE_ARGS{{"10","1000"}}, 1);
assert_int_equal(validate, 0);
// dm_validate_unsignedInt: test with multi range and wrong value
validate = dm_validate_unsignedInt("5420", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
assert_int_equal(validate, -1);
// dm_validate_unsignedInt: test with multi range and correct value
validate = dm_validate_unsignedInt("50", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
assert_int_equal(validate, 0);
// dm_validate_unsignedInt: test with wrong value
validate = dm_validate_unsignedInt("112", RANGE_ARGS{{"4","4"}}, 1);
assert_int_equal(validate, -1);
// dm_validate_unsignedInt: test with correct value
validate = dm_validate_unsignedInt("1124", RANGE_ARGS{{"4","4"}}, 1);
assert_int_equal(validate, 0);
/*
* Test of dm_validate_int function
@ -704,6 +720,13 @@ static void test_bbf_api_validate(void **state)
validate = dm_validate_int("-2", RANGE_ARGS{{"-10","1000"}}, 1);
assert_int_equal(validate, 0);
// dm_validate_int: test with multi range and wrong value
validate = dm_validate_int("-2", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
assert_int_equal(validate, -1);
// dm_validate_int: test with multi range and correct value
validate = dm_validate_int("-7", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
assert_int_equal(validate, 0);
/*
* Test of dm_validate_unsignedLong function
@ -729,6 +752,14 @@ static void test_bbf_api_validate(void **state)
validate = dm_validate_unsignedLong("20", RANGE_ARGS{{"10","1000"}}, 1);
assert_int_equal(validate, 0);
// dm_validate_unsignedLong: test with multi range and wrong value
validate = dm_validate_unsignedLong("5420", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
assert_int_equal(validate, -1);
// dm_validate_unsignedLong: test with multi range and correct value
validate = dm_validate_unsignedLong("15000", RANGE_ARGS{{"10","1000"},{"11200","45000"}}, 2);
assert_int_equal(validate, 0);
/*
* Test of dm_validate_long function
@ -754,6 +785,14 @@ static void test_bbf_api_validate(void **state)
validate = dm_validate_long("-2", RANGE_ARGS{{"-10","1000"}}, 1);
assert_int_equal(validate, 0);
// dm_validate_long: test with multi range and wrong value
validate = dm_validate_long("-2", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
assert_int_equal(validate, -1);
// dm_validate_long: test with multi range and correct value
validate = dm_validate_long("-7", RANGE_ARGS{{"-10","-3"},{"-1","45"}}, 2);
assert_int_equal(validate, 0);
/*
* Test of dm_validate_dateTime function
@ -816,10 +855,22 @@ static void test_bbf_api_validate(void **state)
validate = dm_validate_hexBinary("123bcd", RANGE_ARGS{{"1","8"}}, 1);
assert_int_equal(validate, 0);
// dm_validate_hexBinary: test with wrong value
// dm_validate_hexBinary: test with correct value
validate = dm_validate_hexBinary("123bcd", RANGE_ARGS{{"3","3"}}, 1);
assert_int_equal(validate, 0);
// dm_validate_hexBinary: test with multi range and wrong value
validate = dm_validate_hexBinary("123bc", RANGE_ARGS{{"3","3"},{"5","5"}}, 2);
assert_int_equal(validate, -1);
// dm_validate_hexBinary: test with multi range and correct value
validate = dm_validate_hexBinary("123bcd", RANGE_ARGS{{"3","3"},{"5","5"}}, 2);
assert_int_equal(validate, 0);
// dm_validate_hexBinary: test with multi range and correct value
validate = dm_validate_hexBinary("12345abcde", RANGE_ARGS{{"3","3"},{"5","5"}}, 2);
assert_int_equal(validate, 0);
/*
* Test of dm_validate_string_list function

View file

@ -257,6 +257,573 @@ static void test_api_bbfdm_get_set_standard_parameter_alias(void **state)
validate_parameter(ctx, "Device.WiFi.Radio.[iopsys_test].Channel", "74", "xsd:unsignedInt");
}
static void test_api_bbfdm_input_value_validation_json_parameter(void **state)
{
struct dmctx *ctx = (struct dmctx *) *state;
int fault = 0;
/*
* Validate Boolean parameters
*/
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Enable", "64t", NULL);
assert_int_equal(fault, FAULT_9007);
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Enable", "truee", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Enable", "true", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Enable", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Enable", "1", "xsd:boolean");
/*
* Validate unsignedInt parameters
*/
// Mapping without range: Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_Retries", "64t", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_Retries", "15600", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_Retries", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Nbr_Retries", "15600", "xsd:unsignedInt");
// Mapping with range: Set Wrong Value out of range ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Port", "1050", NULL);
assert_int_equal(fault, FAULT_9007);
// Mapping with range: set value in the first range [0-1000] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Port", "1000", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Port", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Port", "1000", "xsd:unsignedInt");
// Mapping with range: set value in the second range [15000-65535] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Port", "20546", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Port", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Port", "20546", "xsd:unsignedInt");
/*
* Validate int parameters
*/
// Mapping with range (only min): Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Min_value", "-300", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Min_value", "-273", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Min_value", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Min_value", "-273", "xsd:int");
// Mapping with range (only max): Set Wrong Value out of range ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Max_value", "280", NULL);
assert_int_equal(fault, FAULT_9007);
// Mapping with range: set value in the first range [0-1000] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Max_value", "274", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Max_value", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Max_value", "274", "xsd:int");
// Mapping with range: Set Wrong Value out of range ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Value", "-3", NULL);
assert_int_equal(fault, FAULT_9007);
// Mapping with range: set value in the first range [-10:-5] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Value", "-7", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Value", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.value", "-7", "xsd:int");
// Mapping with range: set value in the second range [-1:10] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Value", "1", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Value", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Value", "1", "xsd:int");
/*
* Validate unsignedLong parameters
*/
// Mapping without range: Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_bytes", "64t", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_bytes", "15600", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_bytes", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Nbr_bytes", "15600", "xsd:unsignedLong");
// Mapping with range: Set Wrong Value out of range ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_packets", "499", NULL);
assert_int_equal(fault, FAULT_9007);
// Mapping with range: set value in the first range [0-100] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_packets", "99", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_packets", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Nbr_packets", "99", "xsd:unsignedLong");
// Mapping with range: set value in the second range [500-3010] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_packets", "1024", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Nbr_packets", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Nbr_packets", "1024", "xsd:unsignedLong");
/*
* Validate long parameters
*/
// Mapping without range: Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.MaxTxPower", "-300t", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.MaxTxPower", "-273", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.MaxTxPower", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.MaxTxPower", "-273", "xsd:long");
// Mapping with range: Set Wrong Value out of range ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerLimit", "-91", NULL);
assert_int_equal(fault, FAULT_9007);
// Mapping with range: set value in the first range [-90:36] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerLimit", "274", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerLimit", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerLimit", "274", "xsd:long");
// Mapping with range: Set Wrong Value out of range ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerLimit", "37", NULL);
assert_int_equal(fault, FAULT_9007);
// Mapping with range: set value in the first range [70:360] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerLimit", "70", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerLimit", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerLimit", "70", "xsd:long");
/*
* Validate dateTime parameters
*/
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.AssociationTime", "2030-01-01T11:22:33.2Z", NULL);
assert_int_equal(fault, FAULT_9007);
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.AssociationTime", "2022-01-01T12:20:22.2222Z", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.AssociationTime", "2022-01-01T12:20:22Z", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.AssociationTime", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.AssociationTime", "2022-01-01T12:20:22Z", "xsd:dateTime");
/*
* Validate hexBinary parameters
*/
// Mapping without range: Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.ButtonColor", "64t", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.ButtonColor", "64ab78cef12", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.ButtonColor", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.ButtonColor", "64ab78cef12", "xsd:hexBinary");
// Mapping with range: Set Wrong Value out of range ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TextColor", "am123", NULL);
assert_int_equal(fault, FAULT_9007);
// Mapping with range: set value in the first range [3-3] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TextColor", "123abc", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TextColor", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.TextColor", "123abc", "xsd:hexBinary");
// Mapping with range: set value in the second range [5-5] ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TextColor", "12345abcde", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TextColor", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.TextColor", "12345abcde", "xsd:hexBinary");
// Mapping without range: Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.BackgroundColor", "12345abce", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.BackgroundColor", "45a1bd", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.BackgroundColor", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.BackgroundColor", "45a1bd", "xsd:hexBinary");
/*
* Validate string parameters
*/
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Interface", "64", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Interface", "wan", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Interface", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Interface", "wan", "xsd:string");
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.IPAddr", "192.168.1.789", NULL);
assert_int_equal(fault, FAULT_9007);
// Set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.IPAddr", "192.168.117.45", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.IPAddr", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.IPAddr", "192.168.117.45", "xsd:string");
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Protocol", "OMA-D", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Protocol", "OMA-DM", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Protocol", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Protocol", "OMA-DM", "xsd:string");
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Description", "bbf validate test", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.Description", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.Description", "bbf validate test", "xsd:string");
/*
* Validate list string parameters
*/
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.FailureReasons", "te,be,re,yu", NULL);
assert_int_equal(fault, FAULT_9007);
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.FailureReasons", "ExcessiveDelay,InsufficientBuffers", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.FailureReasons", "LowRate,Other", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.FailureReasons", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.FailureReasons", "LowRate,Other", "xsd:string");
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.SupportedOperatingChannelBandwidths", "200MHz,10MHz", NULL);
assert_int_equal(fault, FAULT_9007);
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.SupportedOperatingChannelBandwidths", "ExcessiveDelay,InsufficientBuffers", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.SupportedOperatingChannelBandwidths", "40MHz,80+80MHz", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.SupportedOperatingChannelBandwidths", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.SupportedOperatingChannelBandwidths", "40MHz,80+80MHz", "xsd:string");
/*
* Validate list int parameters
*/
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerSupported", "-5,-3,99,120", NULL);
assert_int_equal(fault, FAULT_9007);
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerSupported", "-1,9,990", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerSupported", "-1,9,100", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerSupported", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.TransmitPowerSupported", "-1,9,100", "xsd:string");
/*
* Validate list unsignedInt parameters
*/
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.PriorityRegeneration", "8,1,2,3", NULL);
assert_int_equal(fault, FAULT_9007);
// Set Wrong Value ==> expected "9007" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.PriorityRegeneration", "1,2,3,4,5,6,7,8", NULL);
assert_int_equal(fault, FAULT_9007);
// set value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_SET_VALUE, "Device.X_IOPSYS_EU_TEST.1.PriorityRegeneration", "0,1,2,3,4,5,6,7", NULL);
assert_int_equal(fault, 0);
// apply value ==> expected "0" error
fault = dm_entry_apply(ctx, CMD_SET_VALUE, "test_key");
assert_int_equal(fault, 0);
// get value ==> expected "0" error
fault = dm_entry_param_method(ctx, CMD_GET_VALUE, "Device.X_IOPSYS_EU_TEST.1.PriorityRegeneration", NULL, NULL);
assert_int_equal(fault, 0);
// validate parameter after setting to true: name, type, value
validate_parameter(ctx, "Device.X_IOPSYS_EU_TEST.1.PriorityRegeneration", "0,1,2,3,4,5,6,7", "xsd:string");
}
static void test_api_bbfdm_add_del_standard_object(void **state)
{
struct dmctx *ctx = (struct dmctx *) *state;
@ -451,6 +1018,7 @@ int main(void)
cmocka_unit_test_setup_teardown(test_api_bbfdm_get_set_json_parameter, setup, teardown_commit),
cmocka_unit_test_setup_teardown(test_api_bbfdm_get_set_library_parameter, setup, teardown_commit),
cmocka_unit_test_setup_teardown(test_api_bbfdm_get_set_standard_parameter_alias, setup_alias, teardown_commit),
cmocka_unit_test_setup_teardown(test_api_bbfdm_input_value_validation_json_parameter, setup, teardown_commit),
// Add/Delete Object method test cases
cmocka_unit_test_setup_teardown(test_api_bbfdm_add_del_standard_object, setup, teardown_commit),

View file

@ -15,7 +15,6 @@
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"type": "uci",
@ -39,7 +38,6 @@
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"type": "uci",
@ -63,7 +61,6 @@
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
{
"type": "uci",
@ -87,7 +84,6 @@
"cwmp",
"usp"
],
"datatype": "hexBinary",
"range": [
{
"min": 3,
@ -117,7 +113,6 @@
"cwmp",
"usp"
],
"datatype": "hexBinary",
"range": [
{
"min": 3,
@ -147,7 +142,6 @@
"cwmp",
"usp"
],
"datatype": "hexBinary",
"range": [
{
"min": 3,
@ -177,7 +171,6 @@
"cwmp",
"usp"
],
"datatype": "hexBinary",
"range": [
{
"min": 3,
@ -213,12 +206,12 @@
},
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "userinterface",
"file": "userinterface",
"section": {
"name": "global"
},
},
"option": {
"name": "available_languages"
}
@ -234,7 +227,6 @@
"cwmp",
"usp"
],
"datatype": "string",
"range": [
{
"max": 16
@ -242,18 +234,18 @@
],
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "userinterface",
"file": "userinterface",
"section": {
"name": "global"
},
},
"option": {
"name": "current_language"
}
}
}
]
]
},
"X_IOPSYS_EU_Theme": {
"type": "string",
@ -263,12 +255,11 @@
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "userinterface",
"file": "userinterface",
"section": {
"name": "global"
},

View file

@ -4,10 +4,11 @@
"protocols": [
"cwmp",
"usp"
],
],
"access": true,
"array": true,
"mapping": {
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"section": {
@ -42,22 +43,22 @@
]
},
"PasswordAuth": {
"type": "boolean",
"type": "boolean",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
},
"option": {
"name": "PasswordAuth"
}
@ -66,22 +67,22 @@
]
},
"RootPasswordAuth": {
"type": "boolean",
"type": "boolean",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
},
"option": {
"name": "RootPasswordAuth"
}
@ -90,20 +91,20 @@
]
},
"Port": {
"type": "unsignedInt",
"type": "unsignedInt",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
"option": {
@ -114,22 +115,22 @@
]
},
"RootLogin": {
"type": "boolean",
"type": "boolean",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
},
"option": {
"name": "RootLogin"
}
@ -138,22 +139,22 @@
]
},
"GatewayPorts": {
"type": "boolean",
"type": "boolean",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
},
"option": {
"name": "GatewayPorts"
}
@ -162,22 +163,22 @@
]
},
"Interface": {
"type": "string",
"type": "string",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
},
"option": {
"name": "Interface"
}
@ -186,22 +187,22 @@
]
},
"RSAKeyFile": {
"type": "string",
"type": "string",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
},
"option": {
"name": "rsakeyfile"
}
@ -210,22 +211,22 @@
]
},
"DSSKeyFile": {
"type": "string",
"type": "string",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
},
"option": {
"name": "dsskeyfile"
}
@ -234,20 +235,20 @@
]
},
"SSHKeepAlive": {
"type": "unsignedInt",
"type": "unsignedInt",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
"option": {
@ -258,22 +259,22 @@
]
},
"IdleTimeout": {
"type": "unsignedInt",
"type": "unsignedInt",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
],
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
},
"option": {
"name": "IdleTimeout"
}
@ -282,22 +283,22 @@
]
},
"Verbose": {
"type": "boolean",
"type": "boolean",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
},
"option": {
"name": "verbose"
}
@ -306,22 +307,22 @@
]
},
"BannerFile": {
"type": "string",
"type": "string",
"protocols": [
"cwmp",
"cwmp",
"usp"
],
"read": true,
"write": true,
"read": true,
"write": true,
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "dropbear",
"file": "dropbear",
"section": {
"type": "dropbear",
"type": "dropbear",
"index": "@i-1"
},
},
"option": {
"name": "BannerFile"
}

View file

@ -0,0 +1,668 @@
{
"Device.X_IOPSYS_EU_TEST.": {
"type": "object",
"protocols": [
"cwmp",
"usp"
],
"access": true,
"array": true,
"mapping": {
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"type": "test"
},
"dmmapfile": "dmmap_cwmp"
}
},
"Enable": {
"type": "boolean",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "enable"
}
}
}
]
},
"Port": {
"type": "unsignedInt",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"range": [
{
"min": 0,
"max": 1000
},
{
"min": 15000,
"max": 65535
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "port"
}
}
}
]
},
"Nbr_Retries": {
"type": "unsignedInt",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "nbr_retries"
}
}
}
]
},
"Min_value": {
"type": "int",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"range": [
{
"min": -274
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "min_value"
}
}
}
]
},
"Max_value": {
"type": "int",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"range": [
{
"max": 275
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "max_value"
}
}
}
]
},
"Value": {
"type": "int",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"range": [
{
"min": -10,
"max": -5
},
{
"min": -1,
"max": 10
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "value"
}
}
}
]
},
"Nbr_packets": {
"type": "unsignedLong",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"range": [
{
"min": 0,
"max": 100
},
{
"min": 500,
"max": 3010
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "nbr_packets"
}
}
}
]
},
"Nbr_bytes": {
"type": "unsignedLong",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "nbr_bytes"
}
}
}
]
},
"TransmitPowerLimit": {
"type": "long",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"range": [
{
"min": -90,
"max": 36
},
{
"min": 70,
"max": 360
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "power_limit"
}
}
}
]
},
"MaxTxPower": {
"type": "long",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "max_tx_power"
}
}
}
]
},
"ButtonColor": {
"type": "hexBinary",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "button_color"
}
}
}
]
},
"BackgroundColor": {
"type": "hexBinary",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"range": [
{
"max": 8
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "background_color"
}
}
}
]
},
"TextColor": {
"type": "hexBinary",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"range": [
{
"min": 3,
"max": 3
},
{
"min": 5,
"max": 5
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "text_color"
}
}
}
]
},
"AssociationTime": {
"type": "dateTime",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "association_time"
}
}
}
]
},
"Description": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "description"
}
}
}
]
},
"Interface": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"range": [
{
"min": 3,
"max": 128
}
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "interface"
}
}
}
]
},
"IPAddr": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"range": [
{
"max": 15
}
],
"pattern": [
"^$",
"^((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])$"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "ip_addr"
}
}
}
]
},
"Protocol": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"enumerations": [
"CWMP",
"USP",
"OMA-DM",
"SNMP",
"UPnP",
"HELD",
"DHCPv4",
"DHCPv6",
"LLDP-MED",
"MLP",
"Other"
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "protocol"
}
}
}
]
},
"FailureReasons": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string",
"maxsize": 16,
"item": {
"min": 1,
"max": 3
},
"enumerations": [
"LowRate",
"ExcessiveDelay",
"InsufficientBuffers",
"Other"
]
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "failure_reasons"
}
}
}
]
},
"SupportedOperatingChannelBandwidths": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "string",
"enumerations": [
"20MHz",
"40MHz",
"80MHz",
"160MHz",
"80+80MHz",
"Auto"
]
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "supported_operating_channel"
}
}
}
]
},
"TransmitPowerSupported": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "int",
"maxsize": 8,
"range": [
{
"min": -1,
"max": 100
}
]
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "transmit_power"
}
}
}
]
},
"PriorityRegeneration": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"list": {
"datatype": "unsignedInt",
"item": {
"min": 4,
"max": 4
},
"range": [
{
"min": 0,
"max": 7
}
]
},
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"name": "test"
},
"option": {
"name": "priority_regeneration"
}
}
}
]
}
}
}

View file

@ -54,3 +54,7 @@ config inform_extra
option enabled '0'
option parameter 'Device.DeviceInfo.SerialNumber'
option events '0 BOOTSTRAP'
config test 'test'
option enable '0'
option port '0'

View file

@ -63,7 +63,8 @@ obj_schema = {
"required": [
"type",
"protocols",
"array"
"array",
"access"
]
}