mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
mcastmngr: correct stats output
Corrected the read_mcast_stats function, to display "ubus call mcast stats" correct output for multiple iptv bridges Test: "ubus call mcast stats" showing correct output for both single and multiple bridge.
This commit is contained in:
parent
31e6887d42
commit
abbab7118c
2 changed files with 16 additions and 36 deletions
|
|
@ -64,23 +64,11 @@ read_mcast_stats() {
|
|||
|
||||
json_init
|
||||
json_add_array "snooping"
|
||||
json_add_object ""
|
||||
IFS=" "
|
||||
for intf in $ifaces; do
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ "$snoop_iface" != "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
json_add_object ""
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
IFS=" "
|
||||
for gip_addr in $mcast_addrs; do
|
||||
grp_obj_added=0
|
||||
|
|
@ -116,12 +104,14 @@ read_mcast_stats() {
|
|||
;;
|
||||
esac
|
||||
done < /tmp/igmp_stats
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
if [ $grp_obj_added -eq 1 ]; then
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
fi
|
||||
done # close the loop for group addresses
|
||||
json_close_array #close the groups array
|
||||
json_close_object # close the snooping object
|
||||
done # close the loop for interfaces
|
||||
json_close_object # close the snooping object
|
||||
json_close_array # close the snooping array
|
||||
json_dump
|
||||
|
||||
|
|
|
|||
|
|
@ -85,23 +85,11 @@ read_mcast_stats() {
|
|||
|
||||
json_init
|
||||
json_add_array "snooping"
|
||||
json_add_object ""
|
||||
IFS=" "
|
||||
for intf in $ifaces; do
|
||||
while read line; do
|
||||
# reading each line
|
||||
case $line in
|
||||
br-*)
|
||||
snoop_iface="$(echo $line | awk -F ' ' '{ print $1 }')"
|
||||
if [ "$snoop_iface" != "$intf" ]; then
|
||||
continue
|
||||
fi
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done < "$temp_igmp_file"
|
||||
json_add_object ""
|
||||
json_add_string "interface" "$intf"
|
||||
json_add_array "groups"
|
||||
IFS=" "
|
||||
for gip_addr in $mcast_addrs; do
|
||||
grp_obj_added=0
|
||||
|
|
@ -137,12 +125,14 @@ read_mcast_stats() {
|
|||
;;
|
||||
esac
|
||||
done < "$temp_igmp_file"
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
if [ $grp_obj_added -eq 1 ]; then
|
||||
json_close_array #close the associated devices array
|
||||
json_close_object # close the groups object
|
||||
fi
|
||||
done # close the loop for group addresses
|
||||
json_close_array #close the groups array
|
||||
json_close_object # close the snooping object
|
||||
done # close the loop for interfaces
|
||||
json_close_object # close the snooping object
|
||||
json_close_array # close the snooping array
|
||||
json_dump
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue