Ticket refs #3111: TR-181: Remove Device.Hosts.Host.*.Alias

This commit is contained in:
Amin Ben Ramdhane 2020-11-07 22:16:05 +01:00
parent 519342a064
commit bb04af701a
4 changed files with 1 additions and 64 deletions

View file

@ -88,48 +88,6 @@ int os__get_Hosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *d
return 0;
}
int os__get_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
struct uci_section *s = NULL;
char *macaddr = dmjson_get_value((json_object *)data, 1, "macaddr");
uci_path_foreach_sections(bbfdm, "dmmap", "hosts", s) {
char *mac;
dmuci_get_value_by_section_string(s, "mac", &mac);
if (strcmp(mac, macaddr) == 0) {
dmuci_get_value_by_section_string(s, "alias", value);
break;
}
}
if ((*value)[0] == '\0')
dmasprintf(value, "cpe-%s", instance);
return 0;
}
int os__set_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
struct uci_section *s = NULL, *dmmap = NULL;
char *macaddr, *v;
switch (action) {
case VALUECHECK:
if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0))
return FAULT_9007;
break;
case VALUESET:
macaddr = dmjson_get_value((json_object *)data, 1, "macaddr");
uci_path_foreach_option_eq(bbfdm, "dmmap", "hosts", "mac", macaddr, s) {
dmuci_set_value_by_section_bbfdm(s, "alias", value);
return 0;
}
dmuci_add_section_bbfdm("dmmap", "hosts", &dmmap, &v);
dmuci_set_value_by_section(dmmap, "mac", macaddr);
dmuci_set_value_by_section(dmmap, "alias", value);
break;
}
return 0;
}
/*#Device.Hosts.Host.{i}.PhysAddress!UBUS:router.network/hosts//hosts[@i-1].macaddr*/
int os__get_HostsHost_PhysAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{

View file

@ -40,24 +40,6 @@ int os__get_Hosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *d
return not_implemented(value);
}
int os__get_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);
}
int os__set_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action)
{
switch (action) {
case VALUECHECK:
if (dm_validate_string(value, -1, 64, NULL, 0, NULL, 0))
return FAULT_9007;
break;
case VALUESET:
break;
}
return 0;
}
int os__get_HostsHost_PhysAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return not_implemented(value);

View file

@ -14,7 +14,7 @@
/* *** Device.Hosts. *** */
DMOBJ tHostsObj[] = {
/* OBJ, permission, addobj, delobj, checkdep, browseinstobj, forced_inform, notification, nextdynamicobj, nextobj, leaf, linker, bbfdm_type, uniqueKeys*/
{"Host", &DMREAD, NULL, NULL, NULL, os__browseHostsHostInst, NULL, NULL, NULL, tHostsHostObj, tHostsHostParams, get_linker_host, BBFDM_BOTH, LIST_KEY{"PhysAddress", "Alias", NULL}},
{"Host", &DMREAD, NULL, NULL, NULL, os__browseHostsHostInst, NULL, NULL, NULL, tHostsHostObj, tHostsHostParams, get_linker_host, BBFDM_BOTH, LIST_KEY{"PhysAddress", NULL}},
{0}
};
@ -35,7 +35,6 @@ DMOBJ tHostsHostObj[] = {
DMLEAF tHostsHostParams[] = {
/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/
{"Alias", &DMWRITE, DMT_STRING, os__get_HostsHost_Alias, os__set_HostsHost_Alias, NULL, NULL, BBFDM_BOTH},
{"PhysAddress", &DMREAD, DMT_STRING, os__get_HostsHost_PhysAddress, NULL, NULL, NULL, BBFDM_BOTH},
{"IPAddress", &DMREAD, DMT_STRING, os__get_HostsHost_IPAddress, NULL, NULL, NULL, BBFDM_BOTH},
{"AddressSource", &DMREAD, DMT_STRING, os__get_HostsHost_AddressSource, NULL, NULL, NULL, BBFDM_BOTH},

View file

@ -37,8 +37,6 @@ int os__browseHostsHostIPv4AddressInst(struct dmctx *dmctx, DMNODE *parent_node,
int os__browseHostsHostIPv6AddressInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance);
int get_linker_host(char *refparam, struct dmctx *dmctx, void *data, char *instance, char **linker);
int os__get_Hosts_HostNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int os__get_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int os__set_HostsHost_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action);
int os__get_HostsHost_PhysAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int os__get_HostsHost_IPAddress(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
int os__get_HostsHost_AddressSource(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);