freecwmp
[Top] [All Lists]

Re: [PATCH 04/27] Update device_hosts to support communicte data of get

To: mohamed.kallel@pivasoftware.com
Subject: Re: [PATCH 04/27] Update device_hosts to support communicte data of get parameter values to the core via ubus Contributed by Inteno Broadband Technology AB
From: Luka Perkov <freecwmp@lukaperkov.net>
Date: Sat, 8 Dec 2012 11:34:17 +0100
Cc: freecwmp@linux-mips.org, ahmed.zribi@pivasoftware.com, freecwmp@lukaperkov.net, jogo@openwrt.org
In-reply-to: <1354809292-2467-5-git-send-email-mohamed.kallel@pivasoftware.com>
Mail-followup-to: mohamed.kallel@pivasoftware.com, freecwmp@linux-mips.org, ahmed.zribi@pivasoftware.com, jogo@openwrt.org
Original-recipient: rfc822;freecwmp@linux-mips.org
References: <mohamed.kallel@pivasoftware.com> <1354809292-2467-1-git-send-email-mohamed.kallel@pivasoftware.com> <1354809292-2467-5-git-send-email-mohamed.kallel@pivasoftware.com>
Sender: freecwmp-bounce@linux-mips.org
User-agent: Mutt/1.5.21 (2010-09-15)
On Thu, Dec 06, 2012 at 04:54:29PM +0100, Mohamed wrote:
> 
> Signed-off-by: Ahmed ZRIBI <ahmed.zribi@pivasoftware.com>
> Signed-off-by: Mohamed <mohamed.kallel@pivasoftware.com>

NACK to entire patch. This has to be reworked in a way that we just call
"freecwmp_output" function. freecwmp_output needs to be extended so it can
handle ubus, value and notification output depending on the flags passed to the
main freecwmp script.

For example if we pass --ubus then freecwmp_output will send the output via 
ubus.

> ---
>  ext/openwrt/scripts/functions/device_hosts |   22 +++++++++++-----------
>  1 files changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/ext/openwrt/scripts/functions/device_hosts 
> b/ext/openwrt/scripts/functions/device_hosts
> index 4c3fcd4..8909df6 100644
> --- a/ext/openwrt/scripts/functions/device_hosts
> +++ b/ext/openwrt/scripts/functions/device_hosts
> @@ -44,7 +44,7 @@ local parameter=`echo -n $1 | sed 
> "s/InternetGatewayDevice\.LANDevice\.1\./Devic
>  case "$parameter" in
>       Device.Hosts.HostNumberOfEntries)
>       let local val=$num_static_leases+$num_dynamic_leases
> -     freecwmp_output "$parameter" "$val"
> +     ubus_freecwmp_output "$parameter" "$val"
>       return
>       ;;
>  esac
> @@ -66,7 +66,7 @@ if [ $rc -eq 0 ]; then
>               local sed_cmd=`echo -n \'$num; echo p\'`
>               val=`eval sed -n $sed_cmd $leases_file | awk '{ print $2 }'`
>       fi
> -     freecwmp_value_output "$parameter" "$val"
> +     ubus_freecwmp_output "$parameter" "$val"
>       return
>  fi
>  
> @@ -74,7 +74,7 @@ freecwmp_parse_formated_parameter "$parameter" 
> "Device.Hosts.Host.{i}.IPAddress"
>  if [ $rc -eq 0 ]; then
>       local val
>       get_device_hosts_ip_address "$leases_file" "$num" "$num_static_leases" 
> "$num_dynamic_leases" "val"
> -     freecwmp_value_output "$parameter" "$val"
> +     ubus_freecwmp_output "$parameter" "$val"
>       return
>  fi
>  
> @@ -88,7 +88,7 @@ if [ $rc -eq 0 ]; then
>       if [ $num -gt 0 -a $num -le $num_dynamic_leases ]; then
>               val="DHCP"
>       fi
> -     freecwmp_value_output "$parameter" "$val"
> +     ubus_freecwmp_output "$parameter" "$val"
>       return
>  fi
>  
> @@ -107,7 +107,7 @@ if [ $rc -eq 0 ]; then
>               local t2=`date +%s`
>               let val=$t1-$t2
>       fi
> -     freecwmp_value_output "$parameter" "$val"
> +     ubus_freecwmp_output "$parameter" "$val"
>       return
>  fi
>  
> @@ -131,7 +131,7 @@ if [ $rc -eq 0 ]; then
>               val=`eval sed -n $sed_cmd $leases_file | awk '{ print $4 }'`
>               if [ "x$val" == "x*" ]; then val=""; fi
>       fi
> -     freecwmp_value_output "$parameter" "$val"
> +     ubus_freecwmp_output "$parameter" "$val"
>       return
>  fi
>  
> @@ -144,7 +144,7 @@ if [ $rc -eq 0 ]; then
>       get_device_hosts_ip_address "$leases_file" "$num" "$num_static_leases" 
> "$num_dynamic_leases" "ip"
>       val=`ping -c 1 $ip 2>&1 > /dev/null ; echo $?`
>       let val=!$val
> -     freecwmp_value_output "$parameter" "$val"
> +     ubus_freecwmp_output "$parameter" "$val"
>       return
>  fi
>  
> @@ -156,7 +156,7 @@ if [ $rc -eq 0 ]; then
>       if [ $num -le $n ]; then
>               val=1
>       fi
> -     freecwmp_value_output "$parameter" "$val"
> +     ubus_freecwmp_output "$parameter" "$val"
>       return
>  fi
>  
> @@ -168,7 +168,7 @@ if [ $rc -eq 0 ]; then
>       if [ $num -le $n ]; then
>               val=0
>       fi
> -     freecwmp_value_output "$parameter" "$val"
> +     ubus_freecwmp_output "$parameter" "$val"
>       return
>  fi
>  
> @@ -182,10 +182,10 @@ if [ $rc -eq 0 ]; then
>       if [ $num2 -eq 1 ]; then
>               get_device_hosts_ip_address "$leases_file" "$num1" 
> "$num_static_leases" "$num_dynamic_leases" "val"
>       fi
> -     freecwmp_value_output "$parameter" "$val"
> +     ubus_freecwmp_output "$parameter" "$val"
>       return
>  fi
>  
>  # TODO: Device.Hosts.Host.{i}.IPv6Address.{i}.IPAddress (no IPv6 support yet)
> -
> +return $FAULT_CPE_INVALID_PARAMETER_NAME
>  }
> -- 
> 1.7.4.1

Luka 

<Prev in Thread] Current Thread [Next in Thread>