deviceinfo: update mappings of some parameters

This commit is contained in:
Sukru Senli 2020-04-20 12:54:01 +02:00 committed by Amin Ben Ramdhane
parent 00c60187fb
commit f462f1f54e
3 changed files with 26 additions and 8 deletions

View file

@ -2,6 +2,7 @@
#include <libbbf_api/dmcommon.h> #include <libbbf_api/dmcommon.h>
/*#Device.DeviceInfo.Manufacturer!UCI:cwmp/cwmp,cpe/manufacturer*/
char * os__get_deviceid_manufacturer() char * os__get_deviceid_manufacturer()
{ {
char *v; char *v;
@ -13,10 +14,11 @@ char * os__get_deviceid_manufacturer()
return v; return v;
} }
/*#Device.DeviceInfo.ProductClass!UCI:cwmp/cwmp,cpe/product_class*/
char * os__get_deviceid_productclass() char * os__get_deviceid_productclass()
{ {
char *v; char *v;
dmuci_get_option_value_string("cwmp", "cpe", "override_productclass", &v); dmuci_get_option_value_string("cwmp", "cpe", "product_class", &v);
if (v[0] == '\0') { if (v[0] == '\0') {
db_get_value_string("hw", "board", "iopVerFam", &v); db_get_value_string("hw", "board", "iopVerFam", &v);
return v; return v;
@ -44,18 +46,22 @@ int os__get_device_hardwareversion(char *refparam, struct dmctx *ctx, void *data
return 0; return 0;
} }
/*#Device.DeviceInfo.ManufacturerOUI!UCI:cwmp/cwmp,cpe/model_name*/
int os__get_device_routermodel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) int os__get_device_routermodel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{ {
db_get_value_string("hw", "board", "model_name", value); dmuci_get_option_value_string("cwmp", "cpe", "model_name", value);
if (*value[0] == '\0')
db_get_value_string("hw", "board", "model_name", value);
return 0; return 0;
} }
/*#Device.DeviceInfo.ManufacturerOUI!UCI:cwmp/cwmp,cpe/manufacturer_oui*/
char * os__get_deviceid_manufactureroui() char * os__get_deviceid_manufactureroui()
{ {
char *v, *mac = NULL, str[16]; char *v, *mac = NULL, str[16];
json_object *res; json_object *res;
dmuci_get_option_value_string("cwmp", "cpe", "override_oui", &v); dmuci_get_option_value_string("cwmp", "cpe", "manufacturer_oui", &v);
if (v[0]) if (v[0])
return v; return v;

View file

@ -49,21 +49,18 @@ int lookup_vcf_name(char *instance, char **value)
return 0; return 0;
} }
/*#Device.DeviceInfo.Manufacturer!UCI:cwmp/cwmp,cpe/manufacturer*/
static int get_device_manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) static int get_device_manufacturer(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{ {
*value = get_deviceid_manufacturer(); *value = get_deviceid_manufacturer();
return 0; return 0;
} }
/*#Device.DeviceInfo.ManufacturerOUI!UCI:cwmp/cwmp,cpe/override_oui*/
static int get_device_manufactureroui(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) static int get_device_manufactureroui(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{ {
*value = get_deviceid_manufactureroui(); *value = get_deviceid_manufactureroui();
return 0; return 0;
} }
/*#Device.DeviceInfo.ProductClass!UCI:cwmp/cwmp,cpe/override_productclass*/
static int get_device_productclass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) static int get_device_productclass(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{ {
*value = get_deviceid_productclass(); *value = get_deviceid_productclass();

View file

@ -339,7 +339,7 @@
"name": "cpe" "name": "cpe"
}, },
"option": { "option": {
"name": "override_oui" "name": "manufacturer_oui"
} }
} }
} }
@ -382,6 +382,21 @@
{ {
"max": 64 "max": 64
} }
],
"mapping": [
{
"type": "uci",
"uci": {
"file": "cwmp",
"section": {
"type": "cwmp",
"name": "cpe"
},
"option": {
"name": "model_name"
}
}
}
] ]
}, },
"Description": { "Description": {
@ -423,7 +438,7 @@
"name": "cpe" "name": "cpe"
}, },
"option": { "option": {
"name": "override_productclass" "name": "product_class"
} }
} }
} }