T#7879: Bridging tuple object should show all interfaces part of br-tuple

This commit is contained in:
Amin Ben Ramdhane 2022-04-21 15:21:17 +01:00
parent d526bf77ee
commit 3ff96f1d5b
3 changed files with 52 additions and 8 deletions

View file

@ -91580,7 +91580,7 @@
"object": "ieee1905",
"method": "info",
"args": {},
"key": "topology.device[@i-1].bridge_tuples[@i-1].macaddress"
"key": "topology.device[@i-1].bridge_tuples[@i-1].tuple"
}
}
]

View file

@ -1518,11 +1518,28 @@ static int get_IEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905NeighborMetric_RSS
return 0;
}
/*#Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.{i}.BridgingTuple.{i}.InterfaceList!UBUS:ieee1905/info//topology.device[@i-1].bridge_tuples[@i-1].macaddress*/
/*#Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.{i}.BridgingTuple.{i}.InterfaceList!UBUS:ieee1905/info//topology.device[@i-1].bridge_tuples[@i-1].tuple*/
static int get_IEEE1905ALNetworkTopologyIEEE1905DeviceBridgingTuple_InterfaceList(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
char *linker = dmjson_get_value((json_object *)data, 1, "macaddress");
adm_entry_get_linker_param(ctx, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.", linker, value);
json_object *json_obj = NULL;
char *mac_addr = NULL;
char buf[256] = {0};
unsigned pos = 0;
int idx = 0;
buf[0] = 0;
dmjson_foreach_value_in_array((json_object *)data, json_obj, mac_addr, idx, 1, "tuple") {
char *linker = NULL;
adm_entry_get_linker_param(ctx, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.", mac_addr, &linker);
if (DM_STRLEN(linker) && (sizeof(buf) - pos) > 0)
pos += snprintf(&buf[pos], sizeof(buf) - pos, "%s,", linker);
}
if (pos)
buf[pos - 1] = 0;
*value = (buf[0] != '\0') ? dmstrdup(buf) : "";
return 0;
}

View file

@ -413,8 +413,24 @@
],
"bridge_tuples": [
{
"macaddress": "ec:6c:9a:52:af:64"
}
"tuple": [
"ec:6c:9a:52:af:68",
"ec:6c:9a:52:af:64",
"9e:6c:9a:52:af:68"
]
},
{
"tuple": [
"a2:6c:9a:52:af:69",
"9e:6c:9a:52:af:69"
]
},
{
"tuple": [
"a2:6c:9a:52:af:6a",
"ec:6c:9a:52:af:65"
]
}
]
},
{
@ -626,7 +642,18 @@
],
"bridge_tuples": [
{
"macaddress": "fa:d4:37:71:b9:30"
"tuple": [
"fa:d4:37:71:b9:30",
"fe:d4:37:71:b9:38",
"fe:d4:37:71:b9:39",
"fa:d4:37:71:b9:3f"
]
},
{
"tuple": [
"44:d4:37:71:b9:3f",
"44:d4:37:71:b9:31"
]
}
]
}
@ -637,4 +664,4 @@
"registrar_5": "00:00:00:00:00:00",
"registrar_60": "00:00:00:00:00:00"
}
}
}