mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Align bbf tools with latest changes
- Update the generator of source code - Fix the generator of data model in XML format (generate_xml.sh/generate_xml_bbf.sh) - Update README.md file
This commit is contained in:
parent
8e9336a5b0
commit
50b9d73af7
7 changed files with 40 additions and 40 deletions
36
README.md
36
README.md
|
|
@ -110,8 +110,6 @@ Each object in the **DMOBJ** table contains the following arguments:
|
|||
| `delobj` | The function to delete instance under this object. This function will be triggered when the ACS/Controller call DeleteObject of an instance of this object |
|
||||
| `checkdep` | A string of the object dependency, it can be a file("file:/etc/config/network") or an ubus object,method("ubus:network.interface->status"). If it's `NULL` then the object has always appeared in the tree. |
|
||||
| `browseinstobj` | This function allow to browse all instances under this object |
|
||||
| `forced_inform` | If it's set to `&DMFINFRM` that mean the object contains a force inform parameter in its subtree. The forced inform parameters are the parameter included in the inform message |
|
||||
| `notification` | The notification of the object. Could be **&DMACTIVE**, **&DMACTIVE** or **&DMNONE** |
|
||||
| `nextdynamicobj` | Pointer to the next of **DMOBJ** which contains a list of the child objects using json files and plugins(libraries) |
|
||||
| `nextobj` | Pointer to a **DMOBJ** array which contains a list of the child objects |
|
||||
| `leaf` | Pointer to a **DMLEAF** array which contains a list of the child objects |
|
||||
|
|
@ -131,8 +129,6 @@ Each parameter in the **DMLEAF** table contains the following arguments:
|
|||
| `type` | Type of the parameter: **DM_STRING**, **DM_BOOL**, **DM_UNINT**,... |
|
||||
| `getvalue` | The function which return the value of this parameter |
|
||||
| `setvalue` | The function which set the value of this parameter |
|
||||
| `forced_inform` | If this argument is set to `&DMFINFRM` that mean the parameter will be included in the list of parameter of inform message |
|
||||
| `notification` | The notification of the parameter. Could be **&DMACTIVE**, **&DMACTIVE** or **&DMNONE** |
|
||||
| `bbfdm_type` | The bbfdm type of the parameter. Could be **BBFDM_CWMP**, **BBFDM_USP** or **BBFDM_NONE**.If it's `BBFDM_NONE` then we can see this parameter in all protocols (CWMP, USP,...) |
|
||||
|
||||
## BBFDM API ##
|
||||
|
|
@ -218,37 +214,45 @@ It is a generator of data model tree in XML format conform to BBF schema.
|
|||
$ ./generate_xml_bbf.sh
|
||||
Start Generation of BBF Data Models...
|
||||
Please wait...
|
||||
Number of BBF Data Models objects is 196
|
||||
Number of BBF Data Models parameters is 1393
|
||||
Number of BBF Data Models objects is 275
|
||||
Number of BBF Data Models parameters is 1647
|
||||
End of BBF Data Models Generation
|
||||
```
|
||||
|
||||
#### JSON generator: ####
|
||||
It is a generator of json file from xml data model and C source code.
|
||||
```plain
|
||||
$ python generator_json_with_backend.py
|
||||
Usage: generator_json_with_backend.py <tr-181 cwmp xml data model> <tr-181 usp xml data model> [Object path]
|
||||
$ python generate_json.py
|
||||
Usage: generate_json.py <tr-xxx cwmp xml data model> <tr-xxx usp xml data model> [Object path]
|
||||
Examples:
|
||||
- generator_json_with_backend.py tr-181-2-12-0-cwmp-full.xml tr-181-2-12-0-usp-full.xml Device.
|
||||
- generate_json.py tr-181-2-13-0-cwmp-full.xml tr-181-2-13-0-usp-full.xml Device.
|
||||
==> Generate the json file of the sub tree Device. in tr181.json
|
||||
- generator_json_with_backend.py tr-104-1-1-0-full.xml VoiceService.
|
||||
==> Generate the json file of the sub tree VoiceService. in tr104.json
|
||||
- generator_json_with_backend.py tr-106-1-2-0-full.xml Device.
|
||||
- generate_json.py tr-104-2-0-2-cwmp-full.xml tr-104-2-0-2-usp-full.xml Device.Services.VoiceService.
|
||||
==> Generate the json file of the sub tree Device.Services.VoiceService. in tr104.json
|
||||
- generate_json.py tr-106-1-2-0-full.xml Device.
|
||||
==> Generate the json file of the sub tree Device. in tr106.json
|
||||
|
||||
Example of xml data model file: https://www.broadband-forum.org/cwmp/tr-181-2-12-0-cwmp-full.xml
|
||||
Example of xml data model file: https://www.broadband-forum.org/cwmp/tr-181-2-13-0-cwmp-full.xml
|
||||
```
|
||||
|
||||
#### Excel generator: ####
|
||||
It is a generator of excel sheet with supported and unsupported data model parameters.
|
||||
```plain
|
||||
$ python generate_excel.py
|
||||
Usage: generate_excel.py <json data model>
|
||||
Usage: generate_excel.py <json data model> [options...] <urls>
|
||||
Options:
|
||||
-r, --remote-dm Check OBJ/PARAM under these repositories if it is not found under bbf repo
|
||||
-h, --help This help text
|
||||
|
||||
Examples:
|
||||
- generate_excel.py tr181.json
|
||||
- python generate_excel.py tr181.json
|
||||
==> Generate excel file in tr181.xls
|
||||
- generate_excel.py tr104.json
|
||||
- python generate_excel.py tr104.json
|
||||
==> Generate excel file in tr104.xls
|
||||
- python generate_excel.py tr181.json -r https://dev.iopsys.eu/feed/iopsys.git,https://dev.iopsys.eu/abc/def.git
|
||||
==> Generate excel file in tr181.xls
|
||||
- python generate_excel.py tr181.json --remote-dm https://dev.iopsys.eu/feed/iopsys.git
|
||||
==> Generate excel file in tr181.xls
|
||||
```
|
||||
|
||||
#### Load additional parameters at run time ####
|
||||
|
|
|
|||
|
|
@ -657,7 +657,7 @@ static void parse_mapping_param(char *parameter, json_object *mapping, struct li
|
|||
|
||||
static void parse_param(char *object, char *param, json_object *jobj, DMLEAF *pleaf, int i, struct list_head *list)
|
||||
{
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type(8)*/
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type(6)*/
|
||||
struct json_object *type, *protocols, *proto, *write, *mapping_arr, *mapping;
|
||||
char full_param[256] = "";
|
||||
size_t n_proto;
|
||||
|
|
@ -742,7 +742,7 @@ static void count_obj_param_under_jsonobj(json_object *jsonobj, int *obj_number,
|
|||
|
||||
static void parse_obj(char *object, json_object *jobj, DMOBJ *pobj, int index, struct list_head *list)
|
||||
{
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys(14)*/
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys(12)*/
|
||||
|
||||
char *full_obj = NULL, *prfix_obj = NULL, *obj_str = NULL;
|
||||
int obj_number = 0, param_number = 0, i = 0, j = 0;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ def printheaderObjCommon( objname ):
|
|||
def cprintheaderOBJS( objname ):
|
||||
fp = open('./.objparamarray.c', 'a')
|
||||
print >> fp, "DMOBJ %s[] = {" % ("tdynamic" + getname(objname) + "Obj")
|
||||
print >> fp, "/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/"
|
||||
print >> fp, "/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/"
|
||||
fp.close()
|
||||
|
||||
def cprintheaderRootDynamicObj( ):
|
||||
|
|
@ -276,7 +276,7 @@ def cprintOperate( get_operate ):
|
|||
def cprintheaderPARAMS( objname ):
|
||||
fp = open('./.objparamarray.c', 'a')
|
||||
print >> fp, "DMLEAF %s[] = {" % ("tdynamic" + getname(objname) + "Params")
|
||||
print >> fp, "/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/"
|
||||
print >> fp, "/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/"
|
||||
fp.close()
|
||||
|
||||
def hprintheaderPARAMS( objname ):
|
||||
|
|
@ -308,7 +308,7 @@ def printPARAMline( parentname, dmparam, value ):
|
|||
cprintGetSetValue(getvalue, setvalue, mappingparam, instance, typeparam, parentname, dmparam)
|
||||
|
||||
fp = open('./.objparamarray.c', 'a')
|
||||
print >> fp, "{\"%s\", %s, %s, %s, %s, NULL, NULL, %s}," % (dmparam, access, ptype, getvalue, setvalue, bbfdm)
|
||||
print >> fp, "{\"%s\", %s, %s, %s, %s, %s}," % (dmparam, access, ptype, getvalue, setvalue, bbfdm)
|
||||
fp.close()
|
||||
|
||||
def printtailArray( ):
|
||||
|
|
@ -355,7 +355,7 @@ def printOBJline( dmobject, value ):
|
|||
paramarray = "NULL"
|
||||
|
||||
fp = open('./.objparamarray.c', 'a')
|
||||
print >> fp, "{\"%s\", %s, %s, %s, NULL, %s, NULL, NULL, NULL, %s, %s, NULL, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm)
|
||||
print >> fp, "{\"%s\", %s, %s, %s, NULL, %s, NULL, %s, %s, NULL, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm)
|
||||
fp.close()
|
||||
|
||||
def printusage():
|
||||
|
|
|
|||
|
|
@ -355,7 +355,7 @@ def printheaderObjCommon( objname ):
|
|||
def cprintheaderOBJS( objname ):
|
||||
fp = open('./.objparamarray.c', 'a')
|
||||
print("DMOBJ %s[] = {" % ("t" + getname(objname) + "Obj"), file=fp)
|
||||
print("/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/", file=fp)
|
||||
print("/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/", file=fp)
|
||||
fp.close()
|
||||
|
||||
def hprintheaderOBJS( objname ):
|
||||
|
|
@ -772,7 +772,7 @@ def cprintGetSetValue(getvalue, setvalue, mappingparam, instance, typeparam, par
|
|||
def cprintheaderPARAMS( objname ):
|
||||
fp = open('./.objparamarray.c', 'a')
|
||||
print("DMLEAF %s[] = {" % ("t" + getname(objname) + "Params"), file=fp)
|
||||
print("/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/", file=fp)
|
||||
print("/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/", file=fp)
|
||||
fp.close()
|
||||
|
||||
def hprintheaderPARAMS( objname ):
|
||||
|
|
@ -804,7 +804,7 @@ def printPARAMline( parentname, dmparam, value ):
|
|||
cprintGetSetValue(getvalue, setvalue, mappingparam, instance, typeparam, parentname, dmparam, value)
|
||||
|
||||
fp = open('./.objparamarray.c', 'a')
|
||||
print("{\"%s\", %s, %s, %s, %s, NULL, NULL, %s}," % (dmparam, access, ptype, getvalue, setvalue, bbfdm), file=fp)
|
||||
print("{\"%s\", %s, %s, %s, %s, %s}," % (dmparam, access, ptype, getvalue, setvalue, bbfdm), file=fp)
|
||||
fp.close()
|
||||
|
||||
def printtailArray( ):
|
||||
|
|
@ -851,9 +851,9 @@ def printOBJline( dmobject, value ):
|
|||
|
||||
fp = open('./.objparamarray.c', 'a')
|
||||
if uniquekeys:
|
||||
print("{\"%s\", %s, %s, %s, NULL, %s, NULL, NULL, NULL, %s, %s, NULL, %s, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm, uniquekeys), file=fp)
|
||||
print("{\"%s\", %s, %s, %s, NULL, %s, NULL, %s, %s, NULL, %s, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm, uniquekeys), file=fp)
|
||||
else:
|
||||
print("{\"%s\", %s, %s, %s, NULL, %s, NULL, NULL, NULL, %s, %s, NULL, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm), file=fp)
|
||||
print("{\"%s\", %s, %s, %s, NULL, %s, NULL, %s, %s, NULL, %s}," % (getlastname(dmobject), access, faddobj, fdelobj, fbrowse, objchildarray, paramarray, bbfdm), file=fp)
|
||||
fp.close()
|
||||
|
||||
def printusage():
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ struct dm_notif_s {
|
|||
};
|
||||
|
||||
typedef struct dm_leaf_s {
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type(8)*/
|
||||
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type(6)*/
|
||||
char *parameter;
|
||||
struct dm_permession_s *permission;
|
||||
int type;
|
||||
|
|
@ -118,7 +118,7 @@ typedef struct dm_leaf_s {
|
|||
} DMLEAF;
|
||||
|
||||
typedef struct dm_obj_s {
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys(14)*/
|
||||
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys(12)*/
|
||||
char *obj;
|
||||
struct dm_permession_s *permission;
|
||||
int (*addobj)(char *refparam, struct dmctx *ctx, void *data, char **instance);
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ gen_dm_tree(){
|
|||
done
|
||||
|
||||
######## Create Childs list
|
||||
while IFS=, read -r f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13; do
|
||||
while IFS=, read -r f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11; do
|
||||
name=`echo ${f1/CUSTOM_PREFIX/$CUSTOM_PREFIX} | sed 's/{//' | sed 's/"//g'`
|
||||
type=${f3// }
|
||||
multiinstance=${f5// }
|
||||
|
|
@ -159,8 +159,8 @@ gen_dm_tree(){
|
|||
echo $pname >> $TREE_TXT
|
||||
fi
|
||||
if [ -n "$str" ]; then
|
||||
child_objects=${f9// }
|
||||
child_parameters=${f10// }
|
||||
child_objects=${f7// }
|
||||
child_parameters=${f8// }
|
||||
obj_name=${name}
|
||||
#Add the actual object to the list of objects looking for their children objects ########
|
||||
if [ "$child_objects" != "NULL" ]; then
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ gen_dm_tree(){
|
|||
done
|
||||
|
||||
######## Create Childs list
|
||||
while IFS=, read -r f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13; do
|
||||
while IFS=, read -r f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11; do
|
||||
name=`echo ${f1//{} | sed 's/^"\(.*\)"$/\1/'`
|
||||
permission=${f2// &}
|
||||
type=${f3// }
|
||||
|
|
@ -202,19 +202,15 @@ gen_dm_tree(){
|
|||
fi
|
||||
|
||||
if [ "$p_found" == "1" ]; then
|
||||
forced_inform=${f6// &}
|
||||
active_notify=`echo ${f7//&} | tr --delete }`
|
||||
[ "$forced_inform" == "DMFINFRM" ] && forced_inform="true" || forced_inform="false"
|
||||
[ "$active_notify" == "DMACTIVE" ] && active_notify="Active" || active_notify=""
|
||||
name=`set_obj_param_child "$father_name" "$name"`
|
||||
otype=`get_param_type $type`
|
||||
pname=`set_obj_param_line "$instance" "$otype" "$active_notify" "$forced_inform" "$name"`
|
||||
pname=`set_obj_param_line "$instance" "$otype" "" "false" "$name"`
|
||||
echo $pname >> $TREE_TXT
|
||||
fi
|
||||
|
||||
if [ -n "$str" ]; then
|
||||
child_objects=${f9// }
|
||||
child_parameters=${f10// }
|
||||
child_objects=${f7// }
|
||||
child_parameters=${f8// }
|
||||
obj_name=${name}
|
||||
#Add the actual object to the list of objects looking for their children objects ########
|
||||
if [ "$child_objects" != "NULL" ]; then
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue