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_init
|
||||||
json_add_array "snooping"
|
json_add_array "snooping"
|
||||||
json_add_object ""
|
|
||||||
IFS=" "
|
IFS=" "
|
||||||
for intf in $ifaces; do
|
for intf in $ifaces; do
|
||||||
while read line; do
|
json_add_object ""
|
||||||
# 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_string "interface" "$intf"
|
||||||
json_add_array "groups"
|
json_add_array "groups"
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done < /tmp/igmp_stats
|
|
||||||
IFS=" "
|
IFS=" "
|
||||||
for gip_addr in $mcast_addrs; do
|
for gip_addr in $mcast_addrs; do
|
||||||
grp_obj_added=0
|
grp_obj_added=0
|
||||||
|
|
@ -116,12 +104,14 @@ read_mcast_stats() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < /tmp/igmp_stats
|
done < /tmp/igmp_stats
|
||||||
|
if [ $grp_obj_added -eq 1 ]; then
|
||||||
json_close_array #close the associated devices array
|
json_close_array #close the associated devices array
|
||||||
json_close_object # close the groups object
|
json_close_object # close the groups object
|
||||||
|
fi
|
||||||
done # close the loop for group addresses
|
done # close the loop for group addresses
|
||||||
json_close_array #close the groups array
|
json_close_array #close the groups array
|
||||||
done # close the loop for interfaces
|
|
||||||
json_close_object # close the snooping object
|
json_close_object # close the snooping object
|
||||||
|
done # close the loop for interfaces
|
||||||
json_close_array # close the snooping array
|
json_close_array # close the snooping array
|
||||||
json_dump
|
json_dump
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,23 +85,11 @@ read_mcast_stats() {
|
||||||
|
|
||||||
json_init
|
json_init
|
||||||
json_add_array "snooping"
|
json_add_array "snooping"
|
||||||
json_add_object ""
|
|
||||||
IFS=" "
|
IFS=" "
|
||||||
for intf in $ifaces; do
|
for intf in $ifaces; do
|
||||||
while read line; do
|
json_add_object ""
|
||||||
# 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_string "interface" "$intf"
|
||||||
json_add_array "groups"
|
json_add_array "groups"
|
||||||
break
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done < "$temp_igmp_file"
|
|
||||||
IFS=" "
|
IFS=" "
|
||||||
for gip_addr in $mcast_addrs; do
|
for gip_addr in $mcast_addrs; do
|
||||||
grp_obj_added=0
|
grp_obj_added=0
|
||||||
|
|
@ -137,12 +125,14 @@ read_mcast_stats() {
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < "$temp_igmp_file"
|
done < "$temp_igmp_file"
|
||||||
|
if [ $grp_obj_added -eq 1 ]; then
|
||||||
json_close_array #close the associated devices array
|
json_close_array #close the associated devices array
|
||||||
json_close_object # close the groups object
|
json_close_object # close the groups object
|
||||||
|
fi
|
||||||
done # close the loop for group addresses
|
done # close the loop for group addresses
|
||||||
json_close_array #close the groups array
|
json_close_array #close the groups array
|
||||||
done # close the loop for interfaces
|
|
||||||
json_close_object # close the snooping object
|
json_close_object # close the snooping object
|
||||||
|
done # close the loop for interfaces
|
||||||
json_close_array # close the snooping array
|
json_close_array # close the snooping array
|
||||||
json_dump
|
json_dump
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue