IEEE1905: Align with new ubus object

This commit is contained in:
Amin Ben Ramdhane 2021-06-03 15:13:36 +01:00
parent 5ad4e94b5f
commit 1c9316e665
9 changed files with 1437 additions and 657 deletions

View file

@ -110,7 +110,6 @@ libbbfdm_la_SOURCES += \
../dmtree/vendor/iopsys/tr181/deviceinfo.c \
../dmtree/vendor/iopsys/tr181/bridging.c \
../dmtree/vendor/iopsys/tr181/ethernet.c \
../dmtree/vendor/iopsys/tr181/ieee1905.c \
../dmtree/vendor/iopsys/tr181/times.c \
../dmtree/vendor/iopsys/tr181/x_iopsys_eu_igmp.c \
../dmtree/vendor/iopsys/tr181/x_iopsys_eu_mld.c

File diff suppressed because it is too large Load diff

View file

@ -87,7 +87,7 @@ DMOBJ tDeviceObj[] = {
{"Firewall", &DMREAD, NULL, NULL, "file:/etc/config/firewall", NULL, NULL, NULL, tFirewallObj, tFirewallParams, NULL, BBFDM_BOTH},
{"DNS", &DMREAD, NULL, NULL, "file:/etc/config/network", NULL, NULL, NULL, tDNSObj, tDNSParams, NULL, BBFDM_BOTH},
{"Users", &DMREAD, NULL, NULL, "file:/etc/config/users", NULL, NULL, NULL, tUsersObj, tUsersParams, NULL, BBFDM_BOTH},
{"IEEE1905", &DMREAD, NULL, NULL, "file:/etc/config/ieee1905,/etc/config/topology;ubus:ieee1905->info,topology->dump", NULL, NULL, NULL, tIEEE1905Obj, tIEEE1905Params, NULL, BBFDM_BOTH},
{"IEEE1905", &DMREAD, NULL, NULL, "file:/etc/config/ieee1905;ubus:ieee1905->info", NULL, NULL, NULL, tIEEE1905Obj, tIEEE1905Params, NULL, BBFDM_BOTH},
{"InterfaceStack", &DMREAD, NULL, NULL, "file:/etc/config/network", browseInterfaceStackInst, NULL, NULL, NULL, tInterfaceStackParams, NULL, BBFDM_BOTH},
{"USB", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUSBObj, tUSBParams, NULL, BBFDM_BOTH},
{"GRE", &DMREAD, NULL, NULL, "file:/lib/netifd/proto/gre.sh,/etc/config/network", NULL, NULL, NULL, tGREObj, tGREParams, NULL, BBFDM_BOTH},

File diff suppressed because it is too large Load diff

View file

@ -1,75 +0,0 @@
/*
* Copyright (C) 2021 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 Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#include "ieee1905.h"
static int browseIEEE1905ALNetworkTopologyNonIEEE1905NeighborInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
json_object *res = NULL, *arrobj = NULL, *res_self = NULL;
char *inst = NULL, *max_inst = NULL, *obj = NULL;
int id = 0, i = 0;
dmubus_call("topology", "dump", UBUS_ARGS{}, 0, &res_self);
if (res_self)
json_object_object_get_ex(res_self, "self", &res);
dmjson_foreach_value_in_array(res, arrobj, obj, i, 1, "non1905_neighbors") {
inst = handle_update_instance(1, dmctx, &max_inst, update_instance_without_section, 1, ++id);
if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)obj, inst) == DM_STOP)
break;
}
return 0;
}
static int get_IEEE1905ALNetworkTopology_NonIEEE1905NeighborNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
json_object *res = NULL, *obj = NULL, *obj_nbr = NULL;
size_t num_nodes = 0;
dmubus_call("topology", "dump", UBUS_ARGS{}, 0, &res);
DM_ASSERT(res, *value = "0");
json_object_object_get_ex(res, "self", &obj);
if (obj) {
json_object_object_get_ex(obj, "non1905_neighbors", &obj_nbr);
num_nodes = (obj_nbr) ? json_object_array_length(obj_nbr) : 0;
}
dmasprintf(value, "%d", num_nodes);
return 0;
}
static int get_IEEE1905ALNetworkTopologyNonIEEE1905Neighbor(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = (char *)data;
return 0;
}
/**********************************************************************************************************************************
* OBJ & PARAM DEFINITION
***********************************************************************************************************************************/
/* *** Device.IEEE1905.AL.NetworkTopology. *** */
DMOBJ tIOPSYS_IEEE1905ALNetworkTopologyObj[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, nextdynamicobj, dynamicleaf, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
{BBF_VENDOR_PREFIX"NonIEEE1905Neighbor", &DMREAD, NULL, NULL, NULL, browseIEEE1905ALNetworkTopologyNonIEEE1905NeighborInst, NULL, NULL, NULL, tIEEE1905ALNetworkTopologyNonIEEE1905NeighborParams, NULL, BBFDM_BOTH},
{0}
};
DMLEAF tIOPSYS_IEEE1905ALNetworkTopologyParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
{BBF_VENDOR_PREFIX"NonIEEE1905NeighborNumberOfEntries", &DMREAD, DMT_UNINT, get_IEEE1905ALNetworkTopology_NonIEEE1905NeighborNumberOfEntries, NULL, BBFDM_BOTH},
{0}
};
/* *** Device.IEEE1905.AL.NetworkTopology.X_IOPSYS_EU_NonIEEE1905Neighbor.{i}. *** */
DMLEAF tIEEE1905ALNetworkTopologyNonIEEE1905NeighborParams[] = {
/* PARAM, permission, type, getvalue, setvalue, bbfdm_type*/
{"NonIEEE1905NeighborId", &DMREAD, DMT_STRING, get_IEEE1905ALNetworkTopologyNonIEEE1905Neighbor, NULL, BBFDM_BOTH},
{0}
};

View file

@ -1,21 +0,0 @@
/*
* Copyright (C) 2021 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 Ramdhane <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __IOPSYS_IEEE1905_H
#define __IOPSYS_IEEE1905_H
#include <libbbf_api/dmcommon.h>
extern DMOBJ tIOPSYS_IEEE1905ALNetworkTopologyObj[];
extern DMLEAF tIOPSYS_IEEE1905ALNetworkTopologyParams[];
extern DMLEAF tIEEE1905ALNetworkTopologyNonIEEE1905NeighborParams[];
#endif //__IOPSYS_IEEE1905_H

View file

@ -13,7 +13,6 @@
#include "deviceinfo.h"
#include "bridging.h"
#include "ethernet.h"
#include "ieee1905.h"
#include "ip.h"
#include "times.h"
#include "vendor.h"
@ -24,7 +23,6 @@ DM_MAP_OBJ tVendorExtensionIOPSYS[] = {
{"Device.DeviceInfo.", NULL, tIOPSYS_DeviceInfoParams},
{"Device.Ethernet.VLANTermination.{i}.", NULL, tIOPSYS_EthernetVLANTerminationParams},
{"Device.Time.", NULL, tIOPSYS_TimeParams},
{"Device.IEEE1905.AL.NetworkTopology.", tIOPSYS_IEEE1905ALNetworkTopologyObj, tIOPSYS_IEEE1905ALNetworkTopologyParams},
{"Device.Bridging.Bridge.{i}.Port.{i}.", NULL, tIOPSYS_BridgingBridgePortParams},
{"Device.Bridging.Bridge.{i}.VLAN.{i}.", NULL, tIOPSYS_BridgingBridgeVLANParams},
{0}

View file

@ -50,6 +50,7 @@ char *SupportedStandards[] = {"a", "b", "g", "n", "ac", "ax", NULL};
char *SupportedFrequencyBands[] = {"2.4GHz", "5GHz", NULL};
char *Provider_Bridge_Type[] = {"S-VLAN", "PE", NULL};
char *AdvPreferredRouterFlag[] = {"High", "Medium", "Low", NULL};
char *PowerState[] = {"On", "Power_Save", "Off", "Unsupported", NULL};
char *PIN[] = {"^\\d{4}|\\d{8}$", NULL};
char *DestinationAddress[] = {"^\\d+/\\d+$", NULL};

View file

@ -113,6 +113,7 @@ extern char *SupportedStandards[];
extern char *SupportedFrequencyBands[];
extern char *Provider_Bridge_Type[];
extern char *AdvPreferredRouterFlag[];
extern char *PowerState[];
#define UPTIME "/proc/uptime"
#define DEFAULT_CONFIG_DIR "/etc/config/"