IEEE1905: Add support for Device.IEEE1905.AL.Interface.{i}.LowerLayers parameter

This commit is contained in:
Amin Ben Ramdhane 2022-04-13 14:28:27 +01:00
parent 306d79a86a
commit 4aeb252016
3 changed files with 32 additions and 2 deletions

View file

@ -88497,7 +88497,18 @@
"list": {
"datatype": "string",
"maxsize": 1024
},
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "ieee1905",
"method": "info",
"args": {},
"key": "interface[@i-1].ifname"
}
}
]
},
"InterfaceStackReference": {
"type": "string",

View file

@ -439,6 +439,18 @@ static int get_IEEE1905ALInterface_Status(char *refparam, struct dmctx *ctx, voi
return 0;
}
/*#Device.IEEE1905.AL.Interface.{i}.LowerLayers!UBUS:ieee1905/info//interface[@i-1].ifname*/
static int get_IEEE1905ALInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *linker = dmjson_get_value((json_object *)data, 1, "ifname");
adm_entry_get_linker_param(ctx, "Device.Ethernet.Interface.", linker, value);
if (!(*value) || (*value)[0] == 0)
adm_entry_get_linker_param(ctx, "Device.WiFi.Radio.", linker, value);
if (!(*value) || (*value)[0] == 0)
adm_entry_get_linker_param(ctx, "Device.WiFi.AccessPoint.", linker, value);
return 0;
}
#if 0
static int get_IEEE1905ALInterface_InterfaceStackReference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
@ -1613,6 +1625,7 @@ DMLEAF tIEEE1905ALInterfaceParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type, version*/
{"InterfaceId", &DMREAD, DMT_STRING, get_IEEE1905ALInterface_InterfaceId, NULL, BBFDM_BOTH, "2.9"},
{"Status", &DMREAD, DMT_STRING, get_IEEE1905ALInterface_Status, NULL, BBFDM_BOTH, "2.9"},
{"LowerLayers", &DMREAD, DMT_STRING, get_IEEE1905ALInterface_LowerLayers, NULL, BBFDM_BOTH, "2.9"},
//{"InterfaceStackReference", &DMREAD, DMT_STRING, get_IEEE1905ALInterface_InterfaceStackReference, NULL, BBFDM_BOTH, "2.9"},
{"MediaType", &DMREAD, DMT_STRING, get_IEEE1905ALInterface_MediaType, NULL, BBFDM_BOTH, "2.9"},
//{"GenericPhyOUI", &DMREAD, DMT_STRING, get_IEEE1905ALInterface_GenericPhyOUI, NULL, BBFDM_BOTH, "2.9"},

View file

@ -62,6 +62,12 @@ static int get_linker_Wifi_Ssid(char *refparam, struct dmctx *dmctx, void *data,
return 0;
}
static int get_linker_Wifi_AccessPoint(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
*linker = (data && ((struct wifi_acp_args *)data)->ifname) ? ((struct wifi_acp_args *)data)->ifname : "";
return 0;
}
static int get_linker_associated_device(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker)
{
*linker = data ? dmjson_get_value((json_object *)data, 1, "macaddr") : "";
@ -6225,7 +6231,7 @@ DMOBJ tWiFiObj[] = {
{"DataElements", &DMREAD, NULL, NULL, "file:/etc/init.d/decollector", NULL, NULL, NULL, tWiFiDataElementsObj, NULL, NULL, BBFDM_BOTH, NULL, "2.13"},
{"Radio", &DMREAD, NULL, NULL, NULL, browseWifiRadioInst, NULL, NULL, tWiFiRadioObj, tWiFiRadioParams, get_linker_Wifi_Radio, BBFDM_BOTH, LIST_KEY{"Name", "Alias", NULL}, "2.0"},
{"SSID", &DMWRITE, add_wifi_ssid, delete_wifi_ssid, NULL, browseWifiSsidInst, NULL, NULL, tWiFiSSIDObj, tWiFiSSIDParams, get_linker_Wifi_Ssid, BBFDM_BOTH, LIST_KEY{"Name", "Alias", "BSSID", NULL}, "2.0"},
{"AccessPoint", &DMWRITE, add_wifi_accesspoint, delete_wifi_accesspoint, NULL, browseWifiAccessPointInst, NULL, NULL, tWiFiAccessPointObj, tWiFiAccessPointParams, NULL, BBFDM_BOTH, LIST_KEY{"SSIDReference", "Alias", NULL}, "2.0"},
{"AccessPoint", &DMWRITE, add_wifi_accesspoint, delete_wifi_accesspoint, NULL, browseWifiAccessPointInst, NULL, NULL, tWiFiAccessPointObj, tWiFiAccessPointParams, get_linker_Wifi_AccessPoint, BBFDM_BOTH, LIST_KEY{"SSIDReference", "Alias", NULL}, "2.0"},
{"NeighboringWiFiDiagnostic", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tWiFiNeighboringWiFiDiagnosticObj, tWiFiNeighboringWiFiDiagnosticParams, NULL, BBFDM_BOTH, NULL, "2.7"},
{"EndPoint", &DMWRITE, addObjWiFiEndPoint, delObjWiFiEndPoint, NULL, browseWiFiEndPointInst, NULL, NULL, tWiFiEndPointObj, tWiFiEndPointParams, NULL, BBFDM_BOTH, LIST_KEY{"SSIDReference", "Alias", NULL}, "2.0"},
{0}