freecwmp
[Top] [All Lists]

ubus data model patch [09/27]

To: freecwmp@linux-mips.org
Subject: ubus data model patch [09/27]
From: KALLEL Mohamed <mohamed.kallel@pivasoftware.com>
Date: Thu, 06 Dec 2012 14:44:25 +0100
Cc: freecwmp@lukaperkov.net
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 [09/27] enclosed

Regards
MOHAMED Kallel

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

>From 7b88e2ac25543be6c319822d96ae379395f55fc3 Mon Sep 17 00:00:00 2001
From: Mohamed <mohamed.kallel@pivasoftware.com>
Date: Sat, 1 Dec 2012 21:09:08 +0100
Subject: [PATCH 09/27] Update management_server 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/management_server | 72 ++++++++++++++++++-----
 1 files changed, 57 insertions(+), 15 deletions(-)

diff --git a/ext/openwrt/scripts/functions/management_server b/ext/openwrt/scripts/functions/management_server
index 9d1447e..eca3a61 100644
--- a/ext/openwrt/scripts/functions/management_server
+++ b/ext/openwrt/scripts/functions/management_server
@@ -10,7 +10,7 @@ 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`
-freecwmp_output "InternetGatewayDevice.ManagementServer.URL" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.ManagementServer.URL" "$val"
 }

 set_management_server_url() {
@@ -46,7 +46,7 @@ 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`
-freecwmp_output "InternetGatewayDevice.ManagementServer.Username" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.ManagementServer.Username" "$val"
 }

 set_management_server_username() {
@@ -55,7 +55,7 @@ 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`
-freecwmp_output "InternetGatewayDevice.ManagementServer.Password" "$val"
+ubus_freecwmp_output "InternetGatewayDevice.ManagementServer.Password" "$val"
 }

 set_management_server_password() {
@@ -65,7 +65,7 @@ set_management_server_password() {
 get_management_server_periodic_inform_enable() {
 local parm="InternetGatewayDevice.ManagementServer.PeriodicInformEnable"
 freecwmp_get_parameter_value "val" "$parm"
-freecwmp_output "$parm" "$val"
+ubus_freecwmp_output "$parm" "$val" "xsd:boolean"
 }

 set_management_server_periodic_inform_enable() {
@@ -76,7 +76,7 @@ freecwmp_set_parameter_value "$parm" "$1"
 get_management_server_periodic_inform_interval() {
 local parm="InternetGatewayDevice.ManagementServer.PeriodicInformInterval"
 freecwmp_get_parameter_value "val" "$parm"
-freecwmp_output "$parm" "$val"
+ubus_freecwmp_output "$parm" "$val" "xsd:unsingedInt"
 }

 set_management_server_periodic_inform_interval() {
@@ -100,12 +100,12 @@ else
     val=$default_management_server_connection_request_url
 fi

-freecwmp_output "InternetGatewayDevice.ManagementServer.ConnectionRequestURL" "$val" +ubus_freecwmp_output "InternetGatewayDevice.ManagementServer.ConnectionRequestURL" "$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` -freecwmp_value_output "InternetGatewayDevice.ManagementServer.ConnectionRequestUsername" "$val" +ubus_freecwmp_output "InternetGatewayDevice.ManagementServer.ConnectionRequestUsername" "$val"
 }

 set_management_server_connection_request_username() {
@@ -114,7 +114,7 @@ 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` -freecwmp_value_output "InternetGatewayDevice.ManagementServer.ConnectionRequestPassword" "$val" +ubus_freecwmp_output "InternetGatewayDevice.ManagementServer.ConnectionRequestPassword" "$val"
 }

 set_management_server_connection_request_password() {
@@ -125,7 +125,12 @@ set_management_server_connection_request_password() {

 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` -freecwmp_output "InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme" "$val" +local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme"
+if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
+    ubus_freecwmp_output "$parm" "$val"
+else
+    freecwmp_output "$parm" "$val"
+fi
 }

 set_management_server_x_freecwmp_org__acs_scheme() {
@@ -134,7 +139,12 @@ 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` -freecwmp_output "InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname" "$val" +local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname"
+if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
+    ubus_freecwmp_output "$parm" "$val"
+else
+    freecwmp_output "$parm" "$val"
+fi
 }

 set_management_server_x_freecwmp_org__acs_hostname() {
@@ -147,7 +157,12 @@ 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` -freecwmp_output "InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port" "$val" +local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port"
+if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
+    ubus_freecwmp_output "$parm" "$val"
+else
+    freecwmp_output "$parm" "$val"
+fi
 }

 set_management_server_x_freecwmp_org__acs_port() {
@@ -156,7 +171,12 @@ 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` -freecwmp_output "InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path" "$val" +local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path"
+if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
+    ubus_freecwmp_output "$parm" "$val"
+else
+    freecwmp_output "$parm" "$val"
+fi
 }

 set_management_server_x_freecwmp_org__acs_path() {
@@ -165,7 +185,12 @@ 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` -freecwmp_output "InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port" "$val" +local parm="InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port"
+if [ "$FLAGS_value" != "${FLAGS_TRUE}" ]; then
+    ubus_freecwmp_output "$parm" "$val"
+else
+    freecwmp_output "$parm" "$val"
+fi
 }

 set_management_server_x_freecwmp_org__connection_request_port() {
@@ -188,6 +213,7 @@ case "$1" in
     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.)
     get_management_server_url
@@ -203,47 +229,62 @@ case "$1" in
     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)
     get_management_server_url
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.ManagementServer.Username)
     get_management_server_username
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.ManagementServer.Password)
     get_management_server_password
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.ManagementServer.PeriodicInformEnable)
     get_management_server_periodic_inform_enable
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.ManagementServer.PeriodicInformInterval)
     get_management_server_periodic_inform_interval
+    return $FAULT_CPE_NO_FAULT
     ;;
     InternetGatewayDevice.ManagementServer.ConnectionRequestURL)
     get_management_server_connection_request_url
+    return $FAULT_CPE_NO_FAULT
     ;;
InternetGatewayDevice.ManagementServer.ConnectionRequestUsername)
     get_management_server_connection_request_username
+    return $FAULT_CPE_NO_FAULT
     ;;
InternetGatewayDevice.ManagementServer.ConnectionRequestPassword)
     get_management_server_connection_request_password
+    return $FAULT_CPE_NO_FAULT
     ;;
InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Scheme)
     get_management_server_x_freecwmp_org__acs_scheme
+    return $FAULT_CPE_NO_FAULT
     ;;
InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Hostname)
     get_management_server_x_freecwmp_org__acs_hostname
+    return $FAULT_CPE_NO_FAULT
     ;;
InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Port)
     get_management_server_x_freecwmp_org__acs_port
+    return $FAULT_CPE_NO_FAULT
     ;;
InternetGatewayDevice.ManagementServer.X_freecwmp_org__ACS_Path)
     get_management_server_x_freecwmp_org__acs_path
+    return $FAULT_CPE_NO_FAULT
     ;;
InternetGatewayDevice.ManagementServer.X_freecwmp_org__Connection_Request_Port)
     get_management_server_x_freecwmp_org__connection_request_port
+    return $FAULT_CPE_NO_FAULT
     ;;
 esac
+return $FAULT_CPE_INVALID_PARAMETER_NAME
 }

 set_management_server() {
@@ -301,10 +342,11 @@ return 1
 }

 get_management_server_generic() {
- check_parameter_management_server_generic "$1" ; _tmp=$? ; if [ "$_tmp" -eq 1 ]; then return 0; fi + check_parameter_management_server_generic "$1" ; _tmp=$? ; if [ "$_tmp" -eq 1 ]; then return $FAULT_CPE_INVALID_PARAMETER_NAME; fi

     freecwmp_get_parameter_value "val" "$1"
-    freecwmp_value_output "$1" "$val"
+    ubus_freecwmp_output "$1" "$val"
+    return $FAULT_CPE_NO_FAULT
 }

 set_management_server_generic() {
--
1.7.4.1


<Prev in Thread] Current Thread [Next in Thread>
  • ubus data model patch [09/27], KALLEL Mohamed <=