Update mappings of some parameters

This commit is contained in:
Amin Ben Ramdhane 2020-05-12 00:56:45 +01:00
parent 61a1c57664
commit 04deea2605
5 changed files with 162 additions and 144 deletions

View file

@ -1631,54 +1631,55 @@ static int br_get_sysfs(const struct bridge_port_args *br, const char *name, cha
return get_net_device_sysfs(device, name, value);
}
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.BytesSent!UBUS:network.device/status/name,@Name/statistics.tx_bytes*/
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.BytesSent!SYSFS:/sys/class/net/@Name/statistics/tx_bytes*/
static int get_BridgingBridgePortStats_BytesSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return br_get_sysfs(data, "statistics/tx_bytes", value);
}
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.BytesSent!UBUS:network.device/status/name,@Name/statistics.rx_bytes*/
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.BytesSent!SYSFS:/sys/class/net/@Name/statistics/rx_bytes*/
static int get_BridgingBridgePortStats_BytesReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return br_get_sysfs(data, "statistics/rx_bytes", value);
}
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.PacketsSent!UBUS:network.device/status/name,@Name/statistics.tx_packets*/
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.PacketsSent!SYSFS:/sys/class/net/@Name/statistics/tx_packets*/
static int get_BridgingBridgePortStats_PacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return br_get_sysfs(data, "statistics/tx_packets", value);
}
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.PacketsReceived!UBUS:network.device/status/name,@Name/statistics.rx_packets*/
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.PacketsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_packets*/
static int get_BridgingBridgePortStats_PacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return br_get_sysfs(data, "statistics/rx_packets", value);
}
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.ErrorsSent!UBUS:network.device/status/name,@Name/statistics.tx_errors*/
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.ErrorsSent!SYSFS:/sys/class/net/@Name/statistics/tx_errors*/
static int get_BridgingBridgePortStats_ErrorsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return br_get_sysfs(data, "statistics/tx_errors", value);
}
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.ErrorsReceived!UBUS:network.device/status/name,@Name/statistics.rx_errors*/
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.ErrorsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_errors*/
static int get_BridgingBridgePortStats_ErrorsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return br_get_sysfs(data, "statistics/rx_errors", value);
}
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.DiscardPacketsSent!UBUS:network.device/status/name,@Name/statistics.tx_dropped*/
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.DiscardPacketsSent!SYSFS:/sys/class/net/@Name/statistics/tx_dropped*/
static int get_BridgingBridgePortStats_DiscardPacketsSent(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return br_get_sysfs(data, "statistics/tx_dropped", value);
}
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.DiscardPacketsReceived!UBUS:network.device/status/name,@Name/statistics.rx_dropped*/
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.DiscardPacketsReceived!SYSFS:/sys/class/net/@Name/statistics/rx_dropped*/
static int get_BridgingBridgePortStats_DiscardPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return br_get_sysfs(data, "statistics/rx_dropped", value);
}
/*#Device.Bridging.Bridge.{i}.Port.{i}.Stats.MulticastPacketsReceived!SYSFS:/sys/class/net/@Name/statistics/multicast*/
static int get_BridgingBridgePortStats_MulticastPacketsReceived(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
return br_get_sysfs(data, "statistics/multicast", value);

View file

@ -406,36 +406,42 @@ void os__wifi_start_scan(const char *radio)
dmubus_call_set(object, "scan", UBUS_ARGS{}, 0);
}
/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.SSID!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].ssid*/
int os__get_neighboring_wifi_diagnostics_result_ssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "ssid");
return 0;
}
/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.BSSID!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].bssid*/
int os__get_neighboring_wifi_diagnostics_result_bssid(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "bssid");
return 0;
}
/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.Channel!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].channel*/
int os__get_neighboring_wifi_diagnostics_result_channel(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "channel");
return 0;
}
/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.SignalStrength!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].rssi*/
int os__get_neighboring_wifi_diagnostics_result_signal_strength(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "rssi");
return 0;
}
/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.OperatingFrequencyBand!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].band*/
int os__get_neighboring_wifi_diagnostics_result_operating_frequency_band(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "band");
return 0;
}
/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.Noise!UBUS:wifi.radio.@Name/scanresults//accesspoints[@i-1].snr*/
int os__get_neighboring_wifi_diagnostics_result_noise(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "snr");
@ -489,6 +495,7 @@ int os__get_WiFiRadio_CurrentOperatingChannelBandwidth(char *refparam, struct dm
return 0;
}
/*#Device.WiFi.NeighboringWiFiDiagnostic.Result.{i}.!UBUS:wifi.radio.@Name/scanresults//accesspoints*/
int os__browseWifiNeighboringWiFiDiagnosticResultInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance)
{
struct uci_section *ss;

View file

@ -1976,7 +1976,7 @@
"section": {
"type": "sip_advanced",
"name": "SIP"
},
},
"option": {
"name": "call_lines"
}
@ -3802,7 +3802,7 @@
"Disabled",
"Quiescent",
"Enabled"
],
],
"mapping": [
{
"type": "uci",
@ -3847,7 +3847,7 @@
{
"max": 32
}
],
],
"mapping": [
{
"type": "uci",
@ -3951,9 +3951,7 @@
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
]
"datatype": "string"
},
"X_IOPSYS_EU_TELLine": {
"type": "string",
@ -3963,9 +3961,7 @@
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
]
"datatype": "string"
},
"X_IOPSYS_EU_ComfortNoiseEnable": {
"type": "boolean",

View file

@ -412,16 +412,16 @@
{
"max": 256
}
],
],
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "cwmp",
"file": "cwmp",
"section": {
"type": "cpe",
"type": "cpe",
"name": "cpe"
},
},
"option": {
"name": "description"
}
@ -2494,16 +2494,16 @@
"protocols": [
"cwmp"
],
"datatype": "boolean",
"datatype": "boolean",
"mapping": [
{
"type": "uci",
"type": "uci",
"uci": {
"file": "cwmp",
"file": "cwmp",
"section": {
"type": "cpe",
"type": "cpe",
"name": "cpe"
},
},
"option": {
"name": "upgrades_managed"
}
@ -6449,9 +6449,7 @@
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
]
"datatype": "string"
}
},
"Device.UserInterface.": {
@ -30116,6 +30114,15 @@
],
"access": false,
"array": true,
"mapping": {
"type": "ubus",
"ubus": {
"object": "wifi.radio.@Name",
"method": "scanresults",
"args": {},
"key": "accesspoints"
}
},
"Radio": {
"type": "string",
"read": true,
@ -30137,6 +30144,17 @@
{
"max": 32
}
],
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "wifi.radio.@Name",
"method": "scanresults",
"args": {},
"key": "accesspoints[@i-1].ssid"
}
}
]
},
"BSSID": {
@ -30154,6 +30172,17 @@
],
"pattern": [
"([0-9A-Fa-f][0-9A-Fa-f]:){5}([0-9A-Fa-f][0-9A-Fa-f])"
],
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "wifi.radio.@Name",
"method": "scanresults",
"args": {},
"key": "accesspoints[@i-1].bssid"
}
}
]
},
"Mode": {
@ -30182,6 +30211,17 @@
"min": 1,
"max": 255
}
],
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "wifi.radio.@Name",
"method": "scanresults",
"args": {},
"key": "accesspoints[@i-1].channel"
}
}
]
},
"SignalStrength": {
@ -30198,7 +30238,18 @@
"max": 0
}
],
"unit": "dBm"
"unit": "dBm",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "wifi.radio.@Name",
"method": "scanresults",
"args": {},
"key": "accesspoints[@i-1].rssi"
}
}
]
},
"SecurityModeEnabled": {
"type": "string",
@ -30248,6 +30299,17 @@
"enumerations": [
"2.4GHz",
"5GHz"
],
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "wifi.radio.@Name",
"method": "scanresults",
"args": {},
"key": "accesspoints[@i-1].band"
}
}
]
},
"SupportedStandards": {
@ -30320,7 +30382,18 @@
"max": 0
}
],
"unit": "dBm"
"unit": "dBm",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "wifi.radio.@Name",
"method": "scanresults",
"args": {},
"key": "accesspoints[@i-1].snr"
}
}
]
},
"BasicDataTransferRates": {
"type": "string",
@ -35733,15 +35806,8 @@
"datatype": "unsignedLong",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "network.device",
"method": "status",
"args": {
"name": "@Name"
},
"key": "statistics.tx_bytes"
}
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/tx_bytes"
}
]
},
@ -35766,15 +35832,8 @@
"datatype": "unsignedLong",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "network.device",
"method": "status",
"args": {
"name": "@Name"
},
"key": "statistics.tx_packets"
}
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/tx_packets"
}
]
},
@ -35789,15 +35848,8 @@
"datatype": "unsignedLong",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "network.device",
"method": "status",
"args": {
"name": "@Name"
},
"key": "statistics.rx_packets"
}
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/rx_packets"
}
]
},
@ -35812,15 +35864,8 @@
"datatype": "unsignedInt",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "network.device",
"method": "status",
"args": {
"name": "@Name"
},
"key": "statistics.tx_errors"
}
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/tx_errors"
}
]
},
@ -35835,15 +35880,8 @@
"datatype": "unsignedInt",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "network.device",
"method": "status",
"args": {
"name": "@Name"
},
"key": "statistics.rx_errors"
}
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/rx_errors"
}
]
},
@ -35878,15 +35916,8 @@
"datatype": "unsignedInt",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "network.device",
"method": "status",
"args": {
"name": "@Name"
},
"key": "statistics.tx_dropped"
}
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/tx_dropped"
}
]
},
@ -35901,15 +35932,8 @@
"datatype": "unsignedInt",
"mapping": [
{
"type": "ubus",
"ubus": {
"object": "network.device",
"method": "status",
"args": {
"name": "@Name"
},
"key": "statistics.rx_dropped"
}
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/rx_dropped"
}
]
},
@ -35931,7 +35955,13 @@
"cwmp",
"usp"
],
"datatype": "unsignedLong"
"datatype": "unsignedLong",
"mapping": [
{
"type": "sysfs",
"file": "/sys/class/net/@Name/statistics/multicast"
}
]
},
"BroadcastPacketsSent": {
"type": "unsignedLong",
@ -36123,18 +36153,6 @@
"max": 4094
}
]
},
"X_IOPSYS_EU_VLANPriority": {
"type": "string",
"read": true,
"write": true,
"protocols": [
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
]
}
},
"Device.Bridging.Bridge.{i}.VLANPort.{i}.": {
@ -38423,10 +38441,8 @@
"cwmp",
"usp"
],
"datatype": "boolean",
"mapping": [
]
},
"datatype": "boolean"
},
},
"Device.IP.Interface.{i}.Stats.": {
"type": "object",
@ -58939,9 +58955,7 @@
"cwmp",
"usp"
],
"datatype": "string",
"mapping": [
]
"datatype": "string"
},
"Device.UPnP.Device.Capabilities.": {
"type": "object",

View file

@ -334,7 +334,7 @@ def printOBJMaPPING (mapping):
if config[2] != "":
args = config[2].split(",")
print >> fp, "\"%s\": \"%s\"" % (args[0], args[1])
print >> fp, "}"
print >> fp, "}"
print >> fp, "\"key\": \"%s\"" % config[3]
print >> fp, "}\n}"
@ -350,7 +350,7 @@ def printPARAMMaPPING (mapping):
print >> fp, "{"
print >> fp, "\"type\": \"%s\"," % config_type[0].lower()
# SYSFS || PROCFS
if config_type[0] == "SYSFS" or config_type[0] == "PROCFS":
print >> fp, "\"file\": \"%s\"" % config_type[1]
@ -362,40 +362,40 @@ def printPARAMMaPPING (mapping):
# UCI
if config_type[0] == "UCI":
print >> fp, "\"file\": \"%s\"," % config[0]
print >> fp, "\"section\": {"
var = config[1].split(",")
if len(var) == 1:
print >> fp, "\"type\": \"%s\"" % var[0]
elif len(var) > 1 and "@i" in var[1]:
print >> fp, "\"type\": \"%s\"," % var[0]
print >> fp, "\"index\": \"%s\"" % var[1]
elif len(var) > 1:
print >> fp, "\"type\": \"%s\"," % var[0]
print >> fp, "\"name\": \"%s\"" % var[1]
print >> fp, "}"
if len(var) > 1:
print >> fp, "\"option\": {"
print >> fp, "\"name\": \"%s\"" % config[2]
print >> fp, "\"file\": \"%s\"," % config[0]
print >> fp, "\"section\": {"
var = config[1].split(",")
if len(var) == 1:
print >> fp, "\"type\": \"%s\"" % var[0]
elif len(var) > 1 and "@i" in var[1]:
print >> fp, "\"type\": \"%s\"," % var[0]
print >> fp, "\"index\": \"%s\"" % var[1]
elif len(var) > 1:
print >> fp, "\"type\": \"%s\"," % var[0]
print >> fp, "\"name\": \"%s\"" % var[1]
print >> fp, "}"
if len(var) > 1:
print >> fp, "\"option\": {"
print >> fp, "\"name\": \"%s\"" % config[2]
print >> fp, "}"
# UBUS
elif config_type[0] == "UBUS":
print >> fp, "\"object\": \"%s\"," % config[0]
print >> fp, "\"method\": \"%s\"," % config[1]
print >> fp, "\"args\": {"
if config[2] != "":
args = config[2].split(",")
print >> fp, "\"%s\": \"%s\"" % (args[0], args[1])
print >> fp, "}"
print >> fp, "\"key\": \"%s\"" % config[3]
print >> fp, "\"object\": \"%s\"," % config[0]
print >> fp, "\"method\": \"%s\"," % config[1]
print >> fp, "\"args\": {"
if config[2] != "":
args = config[2].split(",")
print >> fp, "\"%s\": \"%s\"" % (args[0], args[1])
print >> fp, "}"
print >> fp, "\"key\": \"%s\"" % config[3]
# CLI
elif config_type[0] == "CLI":
print >> fp, "\"command\": \"%s\"," % config[0]
print >> fp, "\"args\": \"%s\"" % config[1]
print >> fp, "}"
print >> fp, "\"command\": \"%s\"," % config[0]
print >> fp, "\"args\": \"%s\"" % config[1]
print >> fp, "}"
print >> fp, "}"
print >> fp, "]\n}"