diff --git a/dmtree/tr181/atm.c b/dmtree/tr181/atm.c index 15dedff0..1ed83a78 100644 --- a/dmtree/tr181/atm.c +++ b/dmtree/tr181/atm.c @@ -223,9 +223,16 @@ static int set_atm_enable(char *refparam, struct dmctx *ctx, void *data, char *i return 0; } +/*#Device.ATM.Link.{i}.Status!SYSFS:/sys/class/net/@Name/operstate*/ static int get_atm_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = "Up"; + get_net_device_sysfs(((struct atm_args *)data)->ifname, "operstate", value); + if (strcmp(*value, "up") == 0) + *value = "Up"; + else if (strcmp(*value, "down") == 0) + *value = "Down"; + else + *value = "Unknown"; return 0; } diff --git a/dmtree/tr181/ptm.c b/dmtree/tr181/ptm.c index 3f9fe941..28f1102c 100644 --- a/dmtree/tr181/ptm.c +++ b/dmtree/tr181/ptm.c @@ -120,9 +120,16 @@ static int set_ptm_enable(char *refparam, struct dmctx *ctx, void *data, char *i return 0; } +/*#Device.PTM.Link.{i}.Status!SYSFS:/sys/class/net/@Name/operstate*/ static int get_ptm_status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) { - *value = "Up"; + get_net_device_sysfs(((struct ptm_args *)data)->ifname, "operstate", value); + if (strcmp(*value, "up") == 0) + *value = "Up"; + else if (strcmp(*value, "down") == 0) + *value = "Down"; + else + *value = "Unknown"; return 0; } diff --git a/json/tr181.json b/json/tr181.json index 40b9dc84..0b3b2b21 100644 --- a/json/tr181.json +++ b/json/tr181.json @@ -17380,6 +17380,12 @@ "NotPresent", "LowerLayerDown", "Error" + ], + "mapping": [ + { + "type": "sysfs", + "file": "/sys/class/net/@Name/operstate" + } ] }, "Alias": { @@ -18248,6 +18254,12 @@ "NotPresent", "LowerLayerDown", "Error" + ], + "mapping": [ + { + "type": "sysfs", + "file": "/sys/class/net/@Name/operstate" + } ] }, "Alias": {