freecwmp
[Top] [All Lists]

[PATCH 11/27] Update wan_device script to support communicte data of get

To: freecwmp@linux-mips.org
Subject: [PATCH 11/27] Update wan_device script to support communicte data of get parameter values to the core via ubus Contributed by Inteno Broadband Technology AB
From: Mohamed <mohamed.kallel@pivasoftware.com>
Date: Thu, 6 Dec 2012 16:54:36 +0100
Cc: freecwmp@lukaperkov.net, Mohamed <mohamed.kallel@pivasoftware.com>, Ahmed ZRIBI <ahmed.zribi@pivasoftware.com>
In-reply-to: <1354809292-2467-1-git-send-email-mohamed.kallel@pivasoftware.com>
Original-recipient: rfc822;freecwmp@linux-mips.org
References: <mohamed.kallel@pivasoftware.com> <1354809292-2467-1-git-send-email-mohamed.kallel@pivasoftware.com>
Sender: freecwmp-bounce@linux-mips.org
Signed-off-by: Ahmed ZRIBI <ahmed.zribi@pivasoftware.com>
Signed-off-by: Mohamed <mohamed.kallel@pivasoftware.com>
---
 ext/openwrt/scripts/functions/wan_device |   39 +++++++++++++++++++++++++----
 1 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/ext/openwrt/scripts/functions/wan_device 
b/ext/openwrt/scripts/functions/wan_device
index 77cb63f..a8b6361 100644
--- a/ext/openwrt/scripts/functions/wan_device
+++ b/ext/openwrt/scripts/functions/wan_device
@@ -4,26 +4,37 @@
 get_wan_device_mng_status() {
 # TODO: Unconfigured ; Connecting ; Connected ; PendingDisconnect ; 
Disconneting ; Disconnected 
 local val="Connected"
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ConnectionStatus"
 "$val"
+ubus_freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ConnectionStatus"
 "$val" "xsd:boolean"
 }
 
 get_wan_device_mng_interface_ip() {
 local val
+local 
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress"
 if [ -z "$default_wan_device_mng_interface_ip" ]; then
        val=`network_get_ipaddr val mng`
 else
        val=$default_wan_device_mng_interface_ip
 fi
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress"
 "$val"
+if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
+       ubus_freecwmp_output "$parm" "$val"
+else
+       freecwmp_output "$parm" "$val"
+fi
 }
 
 get_wan_device_mng_interface_mac() {
+local val=""
+local 
parm="InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress"
 if [ -z "$default_wan_device_mng_interface_mac" ]; then
        val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
network.mng.macaddr`
 else
        val=$default_wan_device_mng_interface_mac
 fi
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress"
 "$val"
+if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
+       ubus_freecwmp_output "$parm" "$val"
+else
+       freecwmp_output "$parm" "$val"
+fi
 }
 
 get_wan_device_wan_ppp_enable() {
@@ -31,7 +42,7 @@ local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} 
get network.wan.auto
 if [ -z $val ]; then
        val="1"
 fi
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable"
 "$val"
+ubus_freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable"
 "$val" "xsd:boolean"
 }
 
 set_wan_device_wan_ppp_enable() {
@@ -47,7 +58,7 @@ fi
 
 get_wan_device_wan_ppp_username() {
 local val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get 
network.wan.username 2> /dev/null`
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username"
 "$val"
+ubus_freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username"
 "$val"
 }
 
 set_wan_device_wan_ppp_username() {
@@ -55,7 +66,9 @@ set_wan_device_wan_ppp_username() {
 }
 
 get_wan_device_wan_ppp_password() {
-freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password"
 ""
+local val=""
+val=`/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} get network.wan.password 
2> /dev/null`
+ubus_freecwmp_output 
"InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password"
 "$val"
 }
 
 set_wan_device_wan_ppp_password() {
@@ -71,6 +84,7 @@ case "$1" in
        get_wan_device_wan_ppp_enable
        get_wan_device_wan_ppp_username
        get_wan_device_wan_ppp_password
+       return $FAULT_CPE_NO_FAULT
        ;;
        InternetGatewayDevice.WANDevice.)
        get_wan_device_mng_status
@@ -79,6 +93,7 @@ case "$1" in
        get_wan_device_wan_ppp_enable
        get_wan_device_wan_ppp_username
        get_wan_device_wan_ppp_password
+       return $FAULT_CPE_NO_FAULT
        ;;
        InternetGatewayDevice.WANDevice.1.)
        get_wan_device_mng_status
@@ -87,6 +102,7 @@ case "$1" in
        get_wan_device_wan_ppp_enable
        get_wan_device_wan_ppp_username
        get_wan_device_wan_ppp_password
+       return $FAULT_CPE_NO_FAULT
        ;;
        InternetGatewayDevice.WANDevice.1.WANConnectionDevice.)
        get_wan_device_mng_status
@@ -95,6 +111,7 @@ case "$1" in
        get_wan_device_wan_ppp_enable
        get_wan_device_wan_ppp_username
        get_wan_device_wan_ppp_password
+       return $FAULT_CPE_NO_FAULT
        ;;
        InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.)
        get_wan_device_mng_status
@@ -103,36 +120,46 @@ case "$1" in
        get_wan_device_wan_ppp_enable
        get_wan_device_wan_ppp_username
        get_wan_device_wan_ppp_password
+       return $FAULT_CPE_NO_FAULT
        ;;
        
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.)
        get_wan_device_mng_status
        get_wan_device_mng_interface_ip
        get_wan_device_mng_interface_mac
+       return $FAULT_CPE_NO_FAULT
        ;;
        
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.)
        get_wan_device_mng_status
        get_wan_device_mng_interface_ip
        get_wan_device_mng_interface_mac
+       return $FAULT_CPE_NO_FAULT
        ;;
        
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ConnectionStatus)
        get_wan_device_mng_status
+       return $FAULT_CPE_NO_FAULT
        ;;
        
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress)
        get_wan_device_mng_interface_ip
+       return $FAULT_CPE_NO_FAULT
        ;;
        
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.MACAddress)
        get_wan_device_mng_interface_mac
+       return $FAULT_CPE_NO_FAULT
        ;;
        
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Enable)
        get_wan_device_wan_ppp_enable
+       return $FAULT_CPE_NO_FAULT
        ;;
        
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Username)
        get_wan_device_wan_ppp_username
+       return $FAULT_CPE_NO_FAULT
        ;;
        
InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.1.Password)
        get_wan_device_wan_ppp_password
+       return $FAULT_CPE_NO_FAULT
        ;;
 esac
+return $FAULT_CPE_INVALID_PARAMETER_NAME
 }
 
 set_wan_device() {
-- 
1.7.4.1


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