On Thu, Dec 06, 2012 at 04:54:43PM +0100, Mohamed wrote:
>
> Signed-off-by: Ahmed ZRIBI <ahmed.zribi@pivasoftware.com>
> Signed-off-by: Mohamed <mohamed.kallel@pivasoftware.com>
NACK, at least for now. Look at the comments in patch 16.
There are also some othe comments bellow.
> ---
> ext/openwrt/config/freecwmp | 12 +-
> ext/openwrt/scripts/functions/lan_device | 22 +-
> ext/openwrt/scripts/functions/management_server | 323
> ++++++++++++++++++++---
> 3 files changed, 307 insertions(+), 50 deletions(-)
>
> diff --git a/ext/openwrt/config/freecwmp b/ext/openwrt/config/freecwmp
> index 3b2b4c3..1379afd 100644
> --- a/ext/openwrt/config/freecwmp
> +++ b/ext/openwrt/config/freecwmp
> @@ -29,25 +29,25 @@ config scripts
> # freecwmp specific functions
> list location /usr/share/freecwmp/functions/device_info
> list get_value_function get_device_info
> - list get_name_function get_device_info_name
> + list get_name_function get_device_info_name
This should be fixed in the patch where spaces were introduced. Same goes for
all other space/tabs fixes.
> list set_value_function set_device_info
> list get_value_function get_device_info_generic
> - list get_name_function get_device_info_generic_name
> + list get_name_function get_device_info_generic_name
> list set_value_function set_device_info_generic
> list location /usr/share/freecwmp/functions/lan_device
> list get_value_function get_lan_device
> - list get_name_function get_lan_device_name
> + list get_name_function get_lan_device_name
> list set_value_function set_lan_device
> list location /usr/share/freecwmp/functions/management_server
> list get_value_function get_management_server
> - list get_name_function get_management_server_name
> + list get_name_function get_management_server_name
> list set_value_function set_management_server
> list get_value_function get_management_server_generic
> - list get_name_function get_management_server_generic_name
> + list get_name_function get_management_server_generic_name
> list set_value_function set_management_server_generic
> list location /usr/share/freecwmp/functions/wan_device
> list get_value_function get_wan_device
> - list get_name_function get_wan_device_name
> + list get_name_function get_wan_device_name
> list set_value_function set_wan_device
> list location /usr/share/freecwmp/functions/misc
> list get_value_function get_misc
> diff --git a/ext/openwrt/scripts/functions/lan_device
> b/ext/openwrt/scripts/functions/lan_device
> index 712b5e8..64910e2 100644
> --- a/ext/openwrt/scripts/functions/lan_device
> +++ b/ext/openwrt/scripts/functions/lan_device
> @@ -8,13 +8,13 @@ local val=""
> case "$action" in
> get_value)
> val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> wireless.@wifi-device[$num].disabled 2> /dev/null`
> -let num=$num+1
> -if [ "$val" = "1" ]; then
> - val="0"
> -else
> - val="1"
> -fi
> -ubus_freecwmp_output
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable" "$val"
> "$type"
> + let num=$num+1
> + if [ "$val" = "1" ]; then
> + val="0"
> + else
> + val="1"
> + fi
> + ubus_freecwmp_output
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.$num.Enable" "$val"
> "$type"
> ;;
> get_name)
> val="1"
> @@ -138,16 +138,16 @@ case "$1" in
> ubus_freecwmp_output
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration." "1"
> ubus_freecwmp_output
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "1"
> if [ "$2" = "0" ]; then
> - get_wlan_enable 0
> - get_wlan_ssid 0
> + get_wlan_enable 0
> + get_wlan_ssid 0
> fi
> return $FAULT_CPE_NO_FAULT
> ;;
> InternetGatewayDevice.LANDevice.1.WLANConfiguration.1.)
> ubus_freecwmp_output
> "InternetGatewayDevice.LANDevice.1.WLANConfiguration.1." "1"
> if [ "$2" = "0" ]; then
> - get_wlan_enable 0
> - get_wlan_ssid 0
> + get_wlan_enable 0
> + get_wlan_ssid 0
> fi
> return $FAULT_CPE_NO_FAULT
> ;;
> diff --git a/ext/openwrt/scripts/functions/management_server
> b/ext/openwrt/scripts/functions/management_server
> index eca3a61..eed16d1 100644
> --- a/ext/openwrt/scripts/functions/management_server
> +++ b/ext/openwrt/scripts/functions/management_server
> @@ -9,8 +9,16 @@ local
> hostname=`get_management_server_x_freecwmp_org__acs_hostname`
> local port=`get_management_server_x_freecwmp_org__acs_port`
> local path=`get_management_server_x_freecwmp_org__acs_path`
> FLAGS_value=$tmp
> -local val=`echo $scheme://$hostname:$port$path`
> -ubus_freecwmp_output "InternetGatewayDevice.ManagementServer.URL" "$val"
> +local parm="InternetGatewayDevice.ManagementServer.URL"
> +case "$action" in
> + get_value)
> + val=`echo $scheme://$hostname:$port$path`
> + ;;
> + get_name)
> + val="0"
> + ;;
> +esac
> +ubus_freecwmp_output "$parm" "$val"
> }
>
> set_management_server_url() {
> @@ -45,8 +53,17 @@ ubus ${UBUS_SOCKET:+-s $UBUS_SOCKET} call tr069 inform '{
> "event": "value_change
> }
>
> get_management_server_username() {
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].username 2> /dev/null`
> -ubus_freecwmp_output "InternetGatewayDevice.ManagementServer.Username" "$val"
> +local val=""
> +local parm="InternetGatewayDevice.ManagementServer.Username"
> +case "$action" in
> + get_value)
> + val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].username 2> /dev/null`
> + ;;
> + get_name)
> + val="0"
> + ;;
> +esac
> +ubus_freecwmp_output "$parm" "$val"
> }
>
> set_management_server_username() {
> @@ -54,8 +71,17 @@ set_management_server_username() {
> }
>
> get_management_server_password() {
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].password 2> /dev/null`
> -ubus_freecwmp_output "InternetGatewayDevice.ManagementServer.Password" "$val"
> +local val=""
> +local parm="InternetGatewayDevice.ManagementServer.Password"
> +case "$action" in
> + get_value)
> + val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].password 2> /dev/null`
> + ;;
> + get_name)
> + val="0"
> + ;;
> +esac
> +ubus_freecwmp_output "$parm" "$val"
> }
>
> set_management_server_password() {
> @@ -63,9 +89,18 @@ set_management_server_password() {
> }
>
> get_management_server_periodic_inform_enable() {
> +local val=""
> +local type="xsd:boolean"
> local parm="InternetGatewayDevice.ManagementServer.PeriodicInformEnable"
> -freecwmp_get_parameter_value "val" "$parm"
> -ubus_freecwmp_output "$parm" "$val" "xsd:boolean"
> +case "$action" in
> + get_value)
> + freecwmp_get_parameter_value "val" "$parm"
> + ;;
> + get_name)
> + val="1"
> + ;;
> +esac
> +ubus_freecwmp_output "$parm" "$val" "$type"
> }
>
> set_management_server_periodic_inform_enable() {
> @@ -74,9 +109,18 @@ freecwmp_set_parameter_value "$parm" "$1"
> }
>
> get_management_server_periodic_inform_interval() {
> +local val=""
> +local type="xsd:unsignedInt"
> local parm="InternetGatewayDevice.ManagementServer.PeriodicInformInterval"
> -freecwmp_get_parameter_value "val" "$parm"
> -ubus_freecwmp_output "$parm" "$val" "xsd:unsingedInt"
> +case "$action" in
> + get_value)
> + freecwmp_get_parameter_value "val" "$parm"
> + ;;
> + get_name)
> + val="1"
> + ;;
> +esac
> +ubus_freecwmp_output "$parm" "$val" "$type"
> }
>
> set_management_server_periodic_inform_interval() {
> @@ -86,26 +130,42 @@ freecwmp_set_parameter_value "$parm" "$1"
>
> get_management_server_connection_request_url() {
> local val
> -if [ -z "$default_management_server_connection_request_url" ]; then
> - local tmp=${FLAGS_value}
> - FLAGS_value=${FLAGS_TRUE}
> - local ip=`get_wan_device_mng_interface_ip`
> - local
> port=`get_management_server_x_freecwmp_org__connection_request_port`
> - FLAGS_value=$tmp
> -
> - if [ -n "$ip" -a -n "$port" ]; then
> - val="http://$ip:$port/"
> +local parm="InternetGatewayDevice.ManagementServer.ConnectionRequestURL"
> +case "$action" in
> + get_value)
> + if [ -z "$default_management_server_connection_request_url" ]; then
> + local tmp=${FLAGS_value}
> + FLAGS_value=${FLAGS_TRUE}
> + local ip=`get_wan_device_mng_interface_ip`
> + local
> port=`get_management_server_x_freecwmp_org__connection_request_port`
> + FLAGS_value=$tmp
> +
> + if [ -n "$ip" -a -n "$port" ]; then
> + val="http://$ip:$port/"
> + fi
> + else
> + val=$default_management_server_connection_request_url
> fi
> -else
> - val=$default_management_server_connection_request_url
> -fi
> -
> -ubus_freecwmp_output
> "InternetGatewayDevice.ManagementServer.ConnectionRequestURL" "$val"
> + ;;
> + get_name)
> + val="0"
> + ;;
> +esac
> +ubus_freecwmp_output "$parm" "$val"
> }
>
> get_management_server_connection_request_username() {
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@local[0].username 2> /dev/null`
> -ubus_freecwmp_output
> "InternetGatewayDevice.ManagementServer.ConnectionRequestUsername" "$val"
> +local val=""
> +local parm="InternetGatewayDevice.ManagementServer.ConnectionRequestUsername"
> +case "$action" in
> + get_value)
> + val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@local[0].username 2> /dev/null`
> + ;;
> + get_name)
> + val="0"
> + ;;
> +esac
> +ubus_freecwmp_output "$parm" "$val"
> }
>
> set_management_server_connection_request_username() {
> @@ -113,8 +173,17 @@ set_management_server_connection_request_username() {
> }
>
> get_management_server_connection_request_password() {
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@local[0].password 2> /dev/null`
> -ubus_freecwmp_output
> "InternetGatewayDevice.ManagementServer.ConnectionRequestPassword" "$val"
> +local val=""
> +local parm="InternetGatewayDevice.ManagementServer.ConnectionRequestPassword"
> +case "$action" in
> + get_value)
> + val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@local[0].password 2> /dev/null`
> + ;;
> + get_name)
> + val="0"
> + ;;
> +esac
> +ubus_freecwmp_output "$parm" "$val"
> }
>
> set_management_server_connection_request_password() {
> @@ -124,8 +193,16 @@ set_management_server_connection_request_password() {
> # TODO: InternetGatewayDevice.ManagementServer.PeriodicInformTime
>
> get_management_server_x_freecwmp_org__acs_scheme() {
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].scheme 2> /dev/null`
> +local val=""
> local
> parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme"
> +case "$action" in
> + get_value)
> + val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].scheme 2> /dev/null`
> + ;;
> + get_name)
> + val="1"
> + ;;
> +esac
> if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
> ubus_freecwmp_output "$parm" "$val"
> else
> @@ -138,8 +215,16 @@ set_management_server_x_freecwmp_org__acs_scheme() {
> }
>
> get_management_server_x_freecwmp_org__acs_hostname() {
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].hostname 2> /dev/null`
> +local val=""
> local
> parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname"
> +case "$action" in
> + get_value)
> + val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].hostname 2> /dev/null`
> + ;;
> + get_name)
> + val="1"
> + ;;
> +esac
> if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
> ubus_freecwmp_output "$parm" "$val"
> else
> @@ -156,8 +241,16 @@ fi
> }
>
> get_management_server_x_freecwmp_org__acs_port() {
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].port 2> /dev/null`
> +local val=""
> local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port"
> +case "$action" in
> + get_value)
> + val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].port 2> /dev/null`
> + ;;
> + get_name)
> + val="1"
> + ;;
> +esac
> if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
> ubus_freecwmp_output "$parm" "$val"
> else
> @@ -170,8 +263,16 @@ set_management_server_x_freecwmp_org__acs_port() {
> }
>
> get_management_server_x_freecwmp_org__acs_path() {
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].path 2> /dev/null`
> +local val=""
> local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path"
> +case "$action" in
> + get_value)
> + val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@acs[0].path 2> /dev/null`
> + ;;
> + get_name)
> + val="1"
> + ;;
> +esac
> if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
> ubus_freecwmp_output "$parm" "$val"
> else
> @@ -184,8 +285,16 @@ set_management_server_x_freecwmp_org__acs_path() {
> }
>
> get_management_server_x_freecwmp_org__connection_request_port() {
> -local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@local[0].port 2> /dev/null`
> +local val=""
> local
> parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port"
> +case "$action" in
> + get_value)
> + val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get
> freecwmp.@local[0].port 2> /dev/null`
> + ;;
> + get_name)
> + val="1"
> + ;;
> +esac
> if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
> ubus_freecwmp_output "$parm" "$val"
> else
> @@ -287,6 +396,146 @@ esac
> return $FAULT_CPE_INVALID_PARAMETER_NAME
> }
>
> +get_management_server_name() {
> +case "$1" in
> + InternetGatewayDevice.)
> + ubus_freecwmp_output "InternetGatewayDevice.ManagementServer." "0"
> + if [ "$2" = "0" ]; then
> + get_management_server_url
> + get_management_server_username
> + get_management_server_password
> + get_management_server_periodic_inform_enable
> + get_management_server_periodic_inform_interval
> + get_management_server_connection_request_url
> + get_management_server_connection_request_username
> + get_management_server_connection_request_password
> + get_management_server_x_freecwmp_org__acs_scheme
> + get_management_server_x_freecwmp_org__acs_hostname
> + get_management_server_x_freecwmp_org__acs_port
> + get_management_server_x_freecwmp_org__acs_path
> + get_management_server_x_freecwmp_org__connection_request_port
> + fi
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.)
> + ubus_freecwmp_output "InternetGatewayDevice.ManagementServer." "0"
> + get_management_server_url
> + get_management_server_username
> + get_management_server_password
> + get_management_server_periodic_inform_enable
> + get_management_server_periodic_inform_interval
> + get_management_server_connection_request_url
> + get_management_server_connection_request_username
> + get_management_server_connection_request_password
> + get_management_server_x_freecwmp_org__acs_scheme
> + get_management_server_x_freecwmp_org__acs_hostname
> + get_management_server_x_freecwmp_org__acs_port
> + get_management_server_x_freecwmp_org__acs_path
> + get_management_server_x_freecwmp_org__connection_request_port
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.URL)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_url
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.Username)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_username
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.Password)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_password
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.PeriodicInformEnable)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_periodic_inform_enable
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.PeriodicInformInterval)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_periodic_inform_interval
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.ConnectionRequestURL)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_connection_request_url
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.ConnectionRequestUsername)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_connection_request_username
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.ConnectionRequestPassword)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_connection_request_password
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_x_freecwmp_org__acs_scheme
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_x_freecwmp_org__acs_hostname
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_x_freecwmp_org__acs_port
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_x_freecwmp_org__acs_path
> + return $FAULT_CPE_NO_FAULT
> + ;;
> +
> InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_x_freecwmp_org__connection_request_port
> + return $FAULT_CPE_NO_FAULT
> + ;;
> + InternetGatewayDevice.ManagementServer.ParameterKey)
> + if [ "$2" = "1" ]; then
> + return $FAULT_CPE_INVALID_ARGUMENTS
> + fi
> + get_management_server_parameter_key
> + return $FAULT_CPE_NO_FAULT
> + ;;
> +esac
> +return $FAULT_CPE_INVALID_PARAMETER_NAME
> +}
> +
> set_management_server() {
> case "$1" in
> InternetGatewayDevice.ManagementServer.URL)
> @@ -349,6 +598,14 @@ get_management_server_generic() {
> return $FAULT_CPE_NO_FAULT
> }
>
> +get_management_server_generic_name() {
> + check_parameter_management_server_generic "$1" ; _tmp=$? ; if [ "$_tmp"
> -eq 1 ]; then return $FAULT_CPE_INVALID_PARAMETER_NAME; fi
> +
> + local val="1"
> + ubus_freecwmp_output "$1" "$val"
> + return $FAULT_CPE_NO_FAULT
> +}
> +
> set_management_server_generic() {
> check_parameter_management_server_generic "$1" ; _tmp=$? ; if [ "$_tmp"
> -eq 1 ]; then return 0; fi
>
> --
> 1.7.4.1
Luka
|