Move Device.WiFi. to wifidmd

This commit is contained in:
Amin Ben Romdhane 2024-05-30 07:51:00 +00:00
parent 6d9b6a7411
commit 6df8fecbcc
17 changed files with 53 additions and 9436 deletions

View file

@ -111,6 +111,7 @@ All supported tools are presented in this file[BBFDM Tools](./tools/README.md)
| Device.Ethernet. | ethmngr | https://dev.iopsys.eu/hal/ethmngr.git |
| Device.QoS. | qosmngr | https://dev.iopsys.eu/hal/qosmngr.git |
| Device.SSH. | sshmngr | https://dev.iopsys.eu/network/sshmngr.git |
| Device.WiFi. | wifidmd | https://dev.iopsys.eu/bbf/wifidmd.git |
| Device.USB. | usbmngr | https://dev.iopsys.eu/system/usbmngr.git |
| Device.Bridging. | bridgemngr | https://dev.iopsys.eu/network/bridgemngr.git |
| Device.IP.Diagnostics. | tr143 | https://dev.iopsys.eu/bbf/tr143d.git |

View file

@ -244,7 +244,7 @@ These are special parameters all with a suffix "NumberOfEntries", which has coun
For multi-instance on ubus mapping, it has to point to an array of objects, so for NumberOfEntries, we need to get the size of that array, which is refered here as `@Count`
```bash
{
"Device.WiFi.X_IOPSYS_EU_RadioNumberOfEntries": {
"Device.X_IOPSYS_EU_WiFi.RadioNumberOfEntries": {
"type": "unsignedInt",
"protocols": [
"cwmp",
@ -384,7 +384,7 @@ Multi-instance mapping either maps to array of json objects or uci section, so f
Ubus example for the same
```json
{
"Device.WiFi.X_IOPSYS_EU_Radio.{i}.": {
"Device.X_IOPSYS_EU_WiFi.Radio.{i}.": {
"type": "object",
"protocols": [
"cwmp",

View file

@ -62,7 +62,7 @@ int load_dotso_plugins(DMOBJ *entryobj, const char *plugin_path)
void *handle = dlopen(plugin_path, RTLD_LAZY);
#endif
if (!handle) {
BBF_DEBUG("Plugin failed [%s]\n", dlerror());
BBF_ERR("Plugin failed [%s]\n", dlerror());
return 0;
}
@ -72,7 +72,7 @@ int load_dotso_plugins(DMOBJ *entryobj, const char *plugin_path)
if (dynamic_obj == NULL) {
dlclose(handle);
BBF_DEBUG("Plugin %s missing init symbol ...", plugin_path);
BBF_ERR("Plugin %s missing init symbol ...", plugin_path);
return 0;
}

View file

@ -2055,7 +2055,7 @@ int load_json_plugins(DMOBJ *entryobj, const char *plugin_path)
json_object *json = json_object_from_file(plugin_path);
if (!json) {
BBF_DEBUG("Plugin failed [%s]\n", plugin_path);
BBF_ERR("Plugin failed [%s]\n", plugin_path);
return 0;
}

View file

@ -8,7 +8,6 @@ ADD_DEFINITIONS(-DBBF_VENDOR_PREFIX="${BBF_VENDOR_PREFIX}")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR} -I${CMAKE_CURRENT_SOURCE_DIR}/dmtree")
OPTION(BBF_TR181 "build with tr181 datamodel" ON)
OPTION(BBF_WIFI_DATAELEMENTS "build with wifi dataelements datamodel" ON)
SET(BBF_DM_SOURCES dmlayer.c)
@ -16,9 +15,6 @@ IF(BBF_TR181)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr181")
FILE(GLOB BBF_TR181_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dmtree/tr181/*.c)
add_compile_definitions(BBF_TR181)
IF(BBF_WIFI_DATAELEMENTS)
add_compile_definitions(BBF_WIFI_DATAELEMENTS)
ENDIF(BBF_WIFI_DATAELEMENTS)
ENDIF(BBF_TR181)
ADD_LIBRARY(bbfdm SHARED ${BBF_DM_SOURCES} ${BBF_TR181_SOURCES})

View file

@ -13,7 +13,6 @@
#include "device.h"
#include "deviceinfo.h"
#include "ip.h"
#include "wifi.h"
#include "ppp.h"
#include "routing.h"
#include "interfacestack.h"
@ -70,7 +69,6 @@ DM_MAP_OBJ tDynamicObj[] = {
DMOBJ tDeviceObj[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/
{"DeviceInfo", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tDeviceInfoObj, tDeviceInfoParams, NULL, BBFDM_BOTH, NULL},
{"WiFi", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiObj, tWiFiParams, NULL, BBFDM_BOTH, NULL},
{"IP", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tIPObj, tIPParams, NULL, BBFDM_BOTH, NULL},
{"PPP", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/ppp.sh,/etc/config/network", NULL, NULL, NULL, tPPPObj, tPPPParams, NULL, BBFDM_BOTH, NULL},
{"Routing", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tRoutingObj, tRoutingParams, NULL, BBFDM_BOTH, NULL},

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,89 +0,0 @@
/*
* Copyright (C) 2023 IOPSYS Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
*
*/
#ifndef __WIFI_DATAELEMENTS_H
#define __WIFI_DATAELEMENTS_H
#include "libbbfdm-api/dmcommon.h"
extern DMOBJ tWiFiDataElementsObj[];
extern DMOBJ tWiFiDataElementsNetworkObj[];
extern DMLEAF tWiFiDataElementsNetworkParams[];
extern DMLEAF tWiFiDataElementsNetworkSSIDParams[];
extern DMLEAF tWiFiDataElementsNetworkMultiAPSteeringSummaryStatsParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceDefault8021QParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceSSIDtoVIDMappingParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceCACStatusObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceCACStatusParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceCACStatusCACAvailableChannelParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceCACStatusCACNonOccupancyChannelParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceCACStatusCACActiveChannelParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceSPRuleParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceIEEE1905SecurityParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceAnticipatedChannelsParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceAnticipatedChannelUsageEntryParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceMultiAPDeviceObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulCurrentOperatingClassProfileParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceMultiAPDeviceBackhaulStatsParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioScanResultObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanResultOpClassScanChannelScanNeighborBSSParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBackhaulStaParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioScanCapabilityObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanCapabilityParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioScanCapabilityOpClassChannelsParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioCACCapabilityObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCACCapabilityParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCACCapabilityCACMethodOpClassChannelsParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioCapabilitiesObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6APRoleParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesWiFi6bSTARoleParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesAKMFrontHaulParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesAKMBackhaulParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCapabilitiesCapableOperatingClassProfileParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioCurrentOperatingClassProfileParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioDisAllowedOpClassChannelsParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioSpatialReuseParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioBSSObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSQMDescriptorParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSMultiAPSteeringParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioBSSSTAObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAParams[];
extern DMOBJ tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTAObj[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTAParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringSummaryStatsParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAMultiAPSTASteeringHistoryParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTAWiFi6CapabilitiesParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioBSSSTATIDQueueSizesParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioUnassociatedSTAParams[];
extern DMLEAF tWiFiDataElementsNetworkDeviceRadioMultiAPRadioParams[];
extern DMLEAF tWiFiDataElementsAssociationEventParams[];
extern DMLEAF tWiFiDataElementsDisassociationEventParams[];
extern DMLEAF tWiFiDataElementsFailedConnectionEventParams[];
#endif //__WIFI_DATAELEMENTS_H

View file

@ -1,46 +0,0 @@
/*
* Copyright (C) 2023 IOPSYS Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Anis Ellouze <anis.ellouze@pivasoftware.com>
* Author: Amin Ben Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __WIFI_H
#define __WIFI_H
#include "libbbfdm-api/dmcommon.h"
extern DMOBJ tWiFiObj[];
extern DMLEAF tWiFiParams[];
extern DMOBJ tWiFiRadioObj[];
extern DMOBJ tWiFiAccessPointObj[];
extern DMOBJ tWiFiSSIDObj[];
extern DMLEAF tWiFiAccessPointParams[];
extern DMLEAF tWiFiSSIDParams[];
extern DMLEAF tWiFiRadioParams[];
extern DMLEAF tWiFiAccessPointSecurityParams[];
extern DMLEAF tWiFiAccessPointAssociatedDeviceParams[];
extern DMOBJ tWiFiAccessPointAssociatedDeviceObj[];
extern DMLEAF tWiFiAccessPointAssociatedDeviceStatsParams[];
extern DMLEAF tWiFiRadioStatsParams[];
extern DMLEAF tWiFiSSIDStatsParams[];
extern DMOBJ tWiFiNeighboringWiFiDiagnosticObj[];
extern DMLEAF tWiFiNeighboringWiFiDiagnosticParams[];
extern DMLEAF tWiFiNeighboringWiFiDiagnosticResultParams[];
extern DMLEAF tWiFiAccessPointWPSParams[];
extern DMLEAF tWiFiAccessPointAccountingParams[];
extern DMOBJ tWiFiEndPointObj[];
extern DMLEAF tWiFiEndPointParams[];
extern DMLEAF tWiFiEndPointSecurityParams[];
extern DMLEAF tWiFiEndPointWPSParams[];
extern DMOBJ tWiFiEndPointProfileObj[];
extern DMLEAF tWiFiEndPointProfileParams[];
extern DMLEAF tWiFiEndPointProfileSecurityParams[];
extern DMLEAF tWiFiEndPointStatsParams[];
#endif

View file

@ -112,44 +112,44 @@ static void test_api_bbfdm_get_set_json_parameter(void **state)
int fault = 0;
// get value ==> expected "0" error
ctx->in_param = "Device.WiFi.X_IOPSYS_EU_Radio.1.Noise";
ctx->in_param = "Device.X_IOPSYS_EU_WiFi.Radio.1.Noise";
fault = bbf_entry_method(ctx, BBF_GET_VALUE);
assert_int_equal(fault, 0);
// validate parameter : name, type, value
validate_parameter(ctx, "Device.WiFi.X_IOPSYS_EU_Radio.1.Noise", "-87", "xsd:int");
validate_parameter(ctx, "Device.X_IOPSYS_EU_WiFi.Radio.1.Noise", "-87", "xsd:int");
// get value ==> expected "0" error
ctx->in_param = "Device.WiFi.X_IOPSYS_EU_Radio.2.Noise";
ctx->in_param = "Device.X_IOPSYS_EU_WiFi.Radio.2.Noise";
fault = bbf_entry_method(ctx, BBF_GET_VALUE);
assert_int_equal(fault, 0);
// validate parameter : name, type, value
validate_parameter(ctx, "Device.WiFi.X_IOPSYS_EU_Radio.2.Noise", "-85", "xsd:int");
validate_parameter(ctx, "Device.X_IOPSYS_EU_WiFi.Radio.2.Noise", "-85", "xsd:int");
// get value ==> expected "0" error
ctx->in_param = "Device.WiFi.X_IOPSYS_EU_Radio.2.Band";
ctx->in_param = "Device.X_IOPSYS_EU_WiFi.Radio.2.Band";
fault = bbf_entry_method(ctx, BBF_GET_VALUE);
assert_int_equal(fault, 0);
// validate parameter : name, type, value
validate_parameter(ctx, "Device.WiFi.X_IOPSYS_EU_Radio.2.Band", "2.4GHz", "xsd:string");
validate_parameter(ctx, "Device.X_IOPSYS_EU_WiFi.Radio.2.Band", "2.4GHz", "xsd:string");
// get value ==> expected "0" error
ctx->in_param = "Device.WiFi.X_IOPSYS_EU_Radio.1.Stats.BytesSent";
ctx->in_param = "Device.X_IOPSYS_EU_WiFi.Radio.1.Stats.BytesSent";
fault = bbf_entry_method(ctx, BBF_GET_VALUE);
assert_int_equal(fault, 0);
// validate parameter : name, type, value
validate_parameter(ctx, "Device.WiFi.X_IOPSYS_EU_Radio.1.Stats.BytesSent", "14418177", "xsd:unsignedInt");
validate_parameter(ctx, "Device.X_IOPSYS_EU_WiFi.Radio.1.Stats.BytesSent", "14418177", "xsd:unsignedInt");
// get value ==> expected "0" error
ctx->in_param = "Device.WiFi.X_IOPSYS_EU_Radio.2.Stats.BytesSent";
ctx->in_param = "Device.X_IOPSYS_EU_WiFi.Radio.2.Stats.BytesSent";
fault = bbf_entry_method(ctx, BBF_GET_VALUE);
assert_int_equal(fault, 0);
// validate parameter : name, type, value
validate_parameter(ctx, "Device.WiFi.X_IOPSYS_EU_Radio.2.Stats.BytesSent", "14417451", "xsd:unsignedInt");
validate_parameter(ctx, "Device.X_IOPSYS_EU_WiFi.Radio.2.Stats.BytesSent", "14417451", "xsd:unsignedInt");
}
static void test_api_bbfdm_get_set_json_v1_parameter(void **state)

View file

@ -1,6 +1,6 @@
{
"json_plugin_version": 2,
"Device.WiFi.": {
"Device.{BBF_VENDOR_PREFIX}WiFi.": {
"type": "object",
"protocols": [
"cwmp",
@ -28,7 +28,7 @@
}
]
},
"Device.WiFi.{BBF_VENDOR_PREFIX}Radio.{i}.": {
"Device.{BBF_VENDOR_PREFIX}WiFi.Radio.{i}.": {
"type": "object",
"protocols": [
"cwmp",
@ -79,7 +79,7 @@
}
]
},
"Device.WiFi.{BBF_VENDOR_PREFIX}Radio.{i}.Stats.": {
"Device.{BBF_VENDOR_PREFIX}WiFi.Radio.{i}.Stats.": {
"type": "object",
"protocols": [
"cwmp",

View file

@ -1,16 +0,0 @@
LIB_WIFI_DATAELEMENTS = libwifi_dataelements.so
LIB_WIFI_DATAELEMENTS_OBJS = wifi_dataelements.o ../../libbbfdm/dmtree/tr181/wifi.dataelements.o
LIB_CFLAGS = $(CFLAGS) -Wall -Werror -fPIC -I /usr/local/include/
LIB_LDFLAGS = $(LDFLAGS) -lbbfdm-api
%.o: %.c
$(CC) $(LIB_CFLAGS) $(FPIC) -c -o $@ $<
all: $(LIB_WIFI_DATAELEMENTS)
$(LIB_WIFI_DATAELEMENTS): $(LIB_WIFI_DATAELEMENTS_OBJS)
$(CC) $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^
clean:
rm -fv *.o $(LIB_WIFI_DATAELEMENTS)

View file

@ -1,25 +0,0 @@
/*
* Copyright (C) 2023 iopsys Software Solutions AB
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 2.1
* as published by the Free Software Foundation
*
* Author: Amin Ben Romdhane <amin.benromdhane@iopsys.eu>
*/
#include "../../libbbfdm/dmtree/tr181/wifi.dataelements.h"
/* *** Device.WiFi. *** */
DMOBJ tDeviceWiFiObj[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys, version*/
{"DataElements", &DMREAD, NULL, NULL, "file:/etc/init.d/decollector", NULL, NULL, NULL, tWiFiDataElementsObj, NULL, NULL, BBFDM_BOTH, NULL},
{0}
};
/* ********** DynamicObj ********** */
DM_MAP_OBJ tDynamicObj[] = {
/* parentobj, nextobject, parameter */
{"Device.WiFi.", tDeviceWiFiObj, NULL},
{0}
};

View file

@ -1,14 +0,0 @@
{
"daemon": {
"input": {
"type": "DotSo",
"name": "/tmp/libwifi_dataelements.so"
},
"output": {
"type": "UBUS",
"parent_dm": "Device.WiFi.",
"object": "DataElements",
"root_obj": "bbfdm"
}
}
}

View file

@ -337,6 +337,8 @@ def download_and_build_plugins(plugins, vendor_prefix):
print("Generating data models from defined plugins...")
remove_folder(".repo")
for plugin_index, plugin in enumerate(plugins):
repo = get_option_value(plugin, "repo")
@ -415,7 +417,6 @@ def generate_supported_dm(vendor_prefix=None, vendor_list=None, plugins=None):
build_and_install_bbfdm(vendor_prefix, vendor_list)
# Download && Build Plugins Data Models
remove_folder(".repo")
download_and_build_plugins(plugins, vendor_prefix)
# Fill the list supported data model

View file

@ -130,6 +130,14 @@
"src/times.c"
]
},
{
"repo": "https://dev.iopsys.eu/bbf/timemngr.git",
"proto": "git",
"version": "devel",
"dm_files": [
"src/vendor.c"
]
},
{
"repo": "https://dev.iopsys.eu/feed/openwrt-packages.git",
"proto": "git",
@ -239,13 +247,13 @@
"src/datamodel.c"
]
},
{
{
"repo": "https://dev.iopsys.eu/network/bridgemngr.git",
"proto": "git",
"version": "devel",
"dm_files": [
"src/common.c",
"src/bridging.c"
"src/bridging.c",
"src/common.c"
]
},
{
@ -253,8 +261,8 @@
"proto": "git",
"version": "devel",
"dm_files": [
"src/common.c",
"src/vendor.c"
"src/vendor.c",
"src/common.c"
]
},
{
@ -288,6 +296,25 @@
"dm_files": [
"src/packetcapture.c"
]
},
{
"repo": "https://dev.iopsys.eu/bbf/wifidmd.git",
"proto": "git",
"version": "devel",
"dm_files": [
"src/wifi.c"
],
"extra_dependencies": [
"-lm"
]
},
{
"repo": "https://dev.iopsys.eu/bbf/wifidmd.git",
"proto": "git",
"version": "devel",
"dm_files": [
"src/dataelements.c"
]
}
],
"output": {