freecwmp
[Top] [All Lists]

ubus data model patch [11/27]

To: freecwmp@linux-mips.org, freecwmp@lukaperkov.net
Subject: ubus data model patch [11/27]
From: KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
Date: Thu, 06 Dec 2012 14:46:48 +0100
Original-recipient: rfc822;freecwmp@linux-mips.org
Sender: freecwmp-bounce@linux-mips.org
User-agent: Mozilla/5.0 (Windows NT 6.1; rv:17.0) Gecko/17.0 Thunderbird/17.0
Hi Luka

  ubus data model patch [11/27] enclosed

Regards
MOHAMED Kallel

------------------------ubus data model patch [11/27] ---------------------------------


>From 1c3ddcdb4827bbecf99220963031c934a9b1fbe1 Mon Sep 17 00:00:00 2001
From: Mohamed <mohamed.kallel@pivasoftware.com>
Date: Sat, 1 Dec 2012 21:14:35 +0100
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


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>
  • ubus data model patch [11/27], KALLEL Mohamed <=