mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Device.Bridging.Bridge.{i}.: Update Enable parameter && update JSON file
This commit is contained in:
parent
5450d37c2e
commit
82bba0a58c
2 changed files with 30 additions and 30 deletions
|
|
@ -41853,7 +41853,7 @@
|
|||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"type": "interface"
|
||||
"type": "device"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41886,7 +41886,7 @@
|
|||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"type": "interface"
|
||||
"type": "device"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41937,14 +41937,16 @@
|
|||
"datatype": "boolean",
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "network.interface",
|
||||
"method": "status",
|
||||
"args": {
|
||||
"interface": "@Name"
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"type": "device",
|
||||
"index": "@i-1"
|
||||
},
|
||||
"key": "up"
|
||||
"option": {
|
||||
"name": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -41966,14 +41968,16 @@
|
|||
],
|
||||
"mapping": [
|
||||
{
|
||||
"type": "ubus",
|
||||
"ubus": {
|
||||
"object": "network.interface",
|
||||
"method": "status",
|
||||
"args": {
|
||||
"interface": "@Name"
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "network",
|
||||
"section": {
|
||||
"type": "device",
|
||||
"index": "@i-1"
|
||||
},
|
||||
"key": "up"
|
||||
"option": {
|
||||
"name": "enabled"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
@ -41997,9 +42001,9 @@
|
|||
{
|
||||
"type": "uci",
|
||||
"uci": {
|
||||
"file": "dmmap_network",
|
||||
"file": "dmmap_bridge",
|
||||
"section": {
|
||||
"type": "interface",
|
||||
"type": "device",
|
||||
"index": "@i-1"
|
||||
},
|
||||
"option": {
|
||||
|
|
|
|||
|
|
@ -1839,7 +1839,7 @@ static int get_Bridging_get_Bridging_MaxFilterEntries(char *refparam, struct dmc
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.Bridging.ProviderBridgeNumberOfEntries!UCI:network/interface/*/
|
||||
/*#Device.Bridging.ProviderBridgeNumberOfEntries!UCI:network/device/*/
|
||||
static int get_Bridging_ProviderBridgeNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct uci_section *s = NULL;
|
||||
|
|
@ -1853,7 +1853,7 @@ static int get_Bridging_ProviderBridgeNumberOfEntries(char *refparam, struct dmc
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.Bridging.BridgeNumberOfEntries!UCI:network/interface/*/
|
||||
/*#Device.Bridging.BridgeNumberOfEntries!UCI:network/device/*/
|
||||
static int get_Bridging_BridgeNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct uci_section *s = NULL;
|
||||
|
|
@ -1866,14 +1866,10 @@ static int get_Bridging_BridgeNumberOfEntries(char *refparam, struct dmctx *ctx,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.Bridging.Bridge.{i}.Enable!UBUS:network.interface/status/interface,@Name/up*/
|
||||
/*#Device.Bridging.Bridge.{i}.Enable!UCI:network/device,@i-1/enabled*/
|
||||
static int get_BridgingBridge_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
json_object *res = NULL;
|
||||
|
||||
dmubus_call("network.interface", "status", UBUS_ARGS{{"interface", ((struct bridge_args *)data)->bridge_sec_name, String}}, 1, &res);
|
||||
DM_ASSERT(res, *value = "false");
|
||||
*value = dmjson_get_value(res, 1, "up");
|
||||
*value = dmuci_get_value_by_section_fallback_def(((struct bridge_args *)data)->bridge_sec, "enabled", "1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1888,21 +1884,21 @@ static int set_BridgingBridge_Enable(char *refparam, struct dmctx *ctx, void *da
|
|||
return 0;
|
||||
case VALUESET:
|
||||
string_to_bool(value, &b);
|
||||
dmubus_call_set("network.interface", b ? "up" : "down", UBUS_ARGS{{"interface", ((struct bridge_args *)data)->bridge_sec_name, String}}, 1);
|
||||
dmuci_set_value_by_section(((struct bridge_args *)data)->bridge_sec, "enabled", b ? "1" : "0");
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.Bridging.Bridge.{i}.Status!UBUS:network.interface/status/interface,@Name/up*/
|
||||
/*#Device.Bridging.Bridge.{i}.Status!UCI:network/device,@i-1/enabled*/
|
||||
static int get_BridgingBridge_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
get_BridgingBridge_Enable(refparam, ctx, data, instance, value);
|
||||
*value = (strcmp(*value, "true") == 0) ? "Enabled" : "Disabled";
|
||||
*value = (strcmp(*value, "1") == 0) ? "Enabled" : "Disabled";
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*#Device.Bridging.Bridge.{i}.Alias!UCI:dmmap_network/interface,@i-1/bridge_alias*/
|
||||
/*#Device.Bridging.Bridge.{i}.Alias!UCI:dmmap_bridge/device,@i-1/bridge_alias*/
|
||||
static int get_BridgingBridge_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||
{
|
||||
struct uci_section *dmmap_sect = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue