diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..a94e0067377b580904583ac441905a6b7b749375 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +*.gcno +*.gcda +/*.xml +*.swp +*.swa +/*.log diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 09a8a19f1ada7b155b227072ab2f22cecac38d2a..7678ee9617559595c1ffe1be68364b3c11275d52 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,27 +4,27 @@ include: stages: - static_code_analysis -# - functional_test + - functional_test variables: DEBUG: 'TRUE' SOURCE_FOLDER: "." -#run_functional_test: -# stage: functional_test -# image: iopsys/code-analysis-dev:latest -# allow_failure: false -# script: -# - "./gitlab-ci/install-dependencies.sh" -# - "./gitlab-ci/setup.sh" -# - "./gitlab-ci/functional-test.sh" +run_functional_test: + stage: functional_test + image: iopsys/code-analysis-dev:latest + allow_failure: true + script: + - "./gitlab-ci/install-dependencies.sh" + - "./gitlab-ci/setup.sh" + - "./gitlab-ci/functional-test.sh" -# artifacts: -# when: always -# reports: -# junit: ./report/tap.xml -# paths: -# - funl-result.log -# - funl-test-coverage.xml -# - memory-report.xml -# - timestamp.log + artifacts: + when: always + reports: + junit: ./report/tap.xml + paths: + - funl-result.log + - funl-test-coverage.xml + - memory-report.xml + - timestamp.log diff --git a/Makefile b/Makefile index c9f8139d0936a14d600cc8433bc69bc7679ccf5f..eb67e4c44150cbdaf61ea4e082273842451cb9d6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -PROG = xmppd -LIB = libxmpp.so +PROG = xmppc +LIB = libxmppc.so PROG_OBJS = xmpp.o xuci.o cmd.o log.o LIB_OBJS = datamodel.o diff --git a/README.md b/README.md index 114357d7fbb39cff1832c18549b8611ce9169816..f3f4676a64651a514a9ca3477d1b295d46a2a0d4 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # XMPP Client # -In order to reach the devices that are connected behind NAT, the cwmp protocol introduces alternative method of executing Connection Request via NAT based on XMPP. The xmppd is an implementation of XMPP functionality that performs this feature. +In order to reach the devices that are connected behind NAT, the cwmp protocol introduces alternative method of executing Connection Request via NAT based on XMPP. The xmppc is an implementation of XMPP functionality that performs this feature. ## Configuration File ## -The xmppd UCI configuration is located in **'/etc/config/xmpp'**, and contains 3 sections: **xmpp**, **xmpp\_connection** and **xmpp\_connection\_server**. +The xmppc UCI configuration is located in **'/etc/config/xmpp'**, and contains 3 sections: **xmpp**, **xmpp\_connection** and **xmpp\_connection\_server**. -``` +```bash config xmpp 'xmpp' option enable '0' option id '0' @@ -27,51 +27,7 @@ config connection_server option port '5222' ``` -### xmpp section ### - -It defines **the xmpp section configuration**: enable, id, etc... The possible options for **xmpp** section are listed in the table below. - -| Name | Type | Description | -| --------------| ------- | --------------------------------------------- | -| `enable` | boolean | If set to **1**, it enables the XMPP feature. | -| `id` | integer | The id of XMPP connection. | -| `allowed_jid` | string | The list of Jabber IDs or addresses that are allowed to initiate an XMPP Connection Request. | -| `loglevel` | integer | The log type to use, by default it is set to **'INFO'**. The possible types are **'EMERG', 'ALERT', 'CRITIC' ,'ERROR', 'WARNING', 'NOTICE', 'INFO' and 'DEBUG'**. | - -### connection section ### - -It defines the xmpp\_connection section configuration**: enable, connection\_instance, username, etc... The possible options for **xmpp\_connection** section are listed in the table below. - -| Name | Type | Description | -| --------------------------- | ------- | ----------------------------------------------------- | -| `con_inst` | integer | The instance number of the XMPP connection. | -| `enable` | boolean | If set to **1**, it enables the XMPP connection. | -| `con_alias` | string | The alias of the XMPP connection. | -| `username` | string | The username of the XMPP connection. | -| `password` | string | The password of the XMPP connection. | -| `domain` | string | The proposed domain-part of the Jabber ID of the XMPP connection. | -| `resource` | string | The proposed resource-part of the Jabber ID of the XMPP connection. | -| `usetls` | boolean | If set to **1**, the CPE will initiate TLS negotiation. | -| `interval` | integer | The number of seconds, that keep alive events are sent by the XMPP connection. | -| `attempt` | string | The number of times that the Connection attempts to connect to a given IP address. | -| `initial_retry_interval` | integer | The maximum first reconnection wait interval in seconds. | -| `retry_interval_multiplier` | integer | The reconnection interval multiplier. | -| `retry_max_interval` | integer | The maximum reconnection wait interval in seconds. | -| `serveralgorithm` | string | The algorithm used when connecting with the XMPP server. Two algorithms are supported: **'DNS-SRV' and 'ServerTable'**. | - - -### connection_server section ### - -It defines **the xmpp\_connection\_server section configuration**: id\_connection, enable, port, etc... The possible options for **xmpp\_connection\_server** section are listed in the table below. - -| Name | Type | Description | -| ---------------------------- | ------- | ------------------------------ | -| `con_id` | string | The id XMPP connection to use. | -| `con_srv_inst` | integer | The instance number of the XMPP server. | -| `enable` | boolean | If set to **1**, it enables this XMPP server. | -| `con_srv_alias` | string | The alias of the XMPP connection. | -| `port` | integer | The port of the XMPP connection. | -| `server_address` | string | The server address of the XMPP connection. | +For more info on the `xmppc` UCI configuration see [link](./docs/api/uci.xmpp.md) ## Dependencies ## diff --git a/docs/api/uci.xmpp.md b/docs/api/uci.xmpp.md new file mode 100644 index 0000000000000000000000000000000000000000..ff2de45942bb2c105e6a1914e7297d97fe4cea78 --- /dev/null +++ b/docs/api/uci.xmpp.md @@ -0,0 +1 @@ +<tbody><tr><td colspan="2"><div style="font-weight: bold">xmpp</div><table style="width:100%"><tbody><tr><td><div style="font-weight: bold; font-size: 14px">section</div></td><td><div style="font-weight: bold; font-size: 14px">description</div></td><td><div style="font-weight: bold; font-size: 14px">multi</div></td><td><div style="font-weight: bold; font-size: 14px">options</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">xmpp</div></td><td class="td_row_even"><div class="td_row_even">xmppc daemon Settings</div></td><td class="td_row_even"><div class="td_row_even">false</div></td><td class="td_row_even"><table style="width:100%"><tbody><tr><td><div style="font-weight: bold; font-size: 14px">name</div></td><td><div style="font-weight: bold; font-size: 14px">type</div></td><td><div style="font-weight: bold; font-size: 14px">required</div></td><td><div style="font-weight: bold; font-size: 14px">default</div></td><td><div style="font-weight: bold; font-size: 14px">description</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">enable</div></td><td class="td_row_even"><div class="td_row_even">boolean</div></td><td class="td_row_even"><div class="td_row_even">yes</div></td><td class="td_row_even"><div class="td_row_even">0</div></td><td class="td_row_even"><div class="td_row_even">Enable xmpp feature</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">id</div></td><td class="td_row_odd"><div class="td_row_odd">uinteger</div></td><td class="td_row_odd"><div class="td_row_odd">yes</div></td><td class="td_row_odd"><div class="td_row_odd">0</div></td><td class="td_row_odd"><div class="td_row_odd">The id of XMPP connection</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">allowed_jid</div></td><td class="td_row_even"><div class="td_row_even">string</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even"></div></td><td class="td_row_even"><div class="td_row_even">The list of Jabber IDs or addresses that are allowed to initiate an XMPP Connection Request.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">loglevel</div></td><td class="td_row_odd"><div class="td_row_odd">uinteger</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd"></div></td><td class="td_row_odd"><div class="td_row_odd">The log type to use, by default it is set to **'INFO'**. The possible types are **'EMERG', 'ALERT', 'CRITIC' ,'ERROR', 'WARNING', 'NOTICE', 'INFO' and 'DEBUG'**.</div></td></tr></tbody></table></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">connection</div></td><td class="td_row_odd"><div class="td_row_odd">Configure xmpp connections</div></td><td class="td_row_odd"><div class="td_row_odd">false</div></td><td class="td_row_odd"><table style="width:100%"><tbody><tr><td><div style="font-weight: bold; font-size: 14px">name</div></td><td><div style="font-weight: bold; font-size: 14px">type</div></td><td><div style="font-weight: bold; font-size: 14px">required</div></td><td><div style="font-weight: bold; font-size: 14px">default</div></td><td><div style="font-weight: bold; font-size: 14px">description</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">con_inst</div></td><td class="td_row_even"><div class="td_row_even">uinteger</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even"></div></td><td class="td_row_even"><div class="td_row_even">The instance number of the XMPP connection.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">enable</div></td><td class="td_row_odd"><div class="td_row_odd">boolean</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd"></div></td><td class="td_row_odd"><div class="td_row_odd">If set to **1**, it enables the XMPP connection.</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">con_alias</div></td><td class="td_row_even"><div class="td_row_even">string</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even"></div></td><td class="td_row_even"><div class="td_row_even">The alias of the XMPP connection.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">username</div></td><td class="td_row_odd"><div class="td_row_odd">string</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd"></div></td><td class="td_row_odd"><div class="td_row_odd">The username of the XMPP connection.</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">password</div></td><td class="td_row_even"><div class="td_row_even">string</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even"></div></td><td class="td_row_even"><div class="td_row_even">The password of the XMPP connection.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">domain</div></td><td class="td_row_odd"><div class="td_row_odd">string</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd"></div></td><td class="td_row_odd"><div class="td_row_odd">The proposed domain-part of the Jabber ID of the XMPP connection.</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">resource</div></td><td class="td_row_even"><div class="td_row_even">string</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even"></div></td><td class="td_row_even"><div class="td_row_even">The proposed resource-part of the Jabber ID of the XMPP connection.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">usetls</div></td><td class="td_row_odd"><div class="td_row_odd">boolean</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd"></div></td><td class="td_row_odd"><div class="td_row_odd">If set to **1**, the CPE will initiate TLS negotiation.</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">interval</div></td><td class="td_row_even"><div class="td_row_even">uinteger</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even"></div></td><td class="td_row_even"><div class="td_row_even">The number of seconds, that keep alive events are sent by the XMPP connection.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">attempt</div></td><td class="td_row_odd"><div class="td_row_odd">string</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd"></div></td><td class="td_row_odd"><div class="td_row_odd">The number of times that the Connection attempts to connect to a given IP address.</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">initial_retry_interval</div></td><td class="td_row_even"><div class="td_row_even">uinteger</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even"></div></td><td class="td_row_even"><div class="td_row_even">The maximum first reconnection wait interval in seconds.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">retry_interval_multiplier</div></td><td class="td_row_odd"><div class="td_row_odd">uinteger</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd"></div></td><td class="td_row_odd"><div class="td_row_odd">The reconnection interval multiplier.</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">retry_max_interval</div></td><td class="td_row_even"><div class="td_row_even">uinteger</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even"></div></td><td class="td_row_even"><div class="td_row_even">The maximum reconnection wait interval in seconds.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">serveralgorithm</div></td><td class="td_row_odd"><div class="td_row_odd">string</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd"></div></td><td class="td_row_odd"><div class="td_row_odd">The algorithm used when connecting with the XMPP server. Two algorithms are supported: **'DNS-SRV' and 'ServerTable'**.</div></td></tr></tbody></table></td></tr><tr><td class="td_row_even"><div class="td_row_even">connection_server</div></td><td class="td_row_even"><div class="td_row_even">xmpp connection server configuration</div></td><td class="td_row_even"><div class="td_row_even">false</div></td><td class="td_row_even"><table style="width:100%"><tbody><tr><td><div style="font-weight: bold; font-size: 14px">name</div></td><td><div style="font-weight: bold; font-size: 14px">type</div></td><td><div style="font-weight: bold; font-size: 14px">required</div></td><td><div style="font-weight: bold; font-size: 14px">default</div></td><td><div style="font-weight: bold; font-size: 14px">description</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">con_id</div></td><td class="td_row_even"><div class="td_row_even">string</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even">0</div></td><td class="td_row_even"><div class="td_row_even">The id XMPP connection to use.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">con_srv_inst</div></td><td class="td_row_odd"><div class="td_row_odd">integer</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd">0</div></td><td class="td_row_odd"><div class="td_row_odd">The instance number of the XMPP server.</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">enable</div></td><td class="td_row_even"><div class="td_row_even">boolean</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even">0</div></td><td class="td_row_even"><div class="td_row_even">If set to **1**, it enables this XMPP server.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">con_srv_alias</div></td><td class="td_row_odd"><div class="td_row_odd">string</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd">0</div></td><td class="td_row_odd"><div class="td_row_odd">The alias of the XMPP connection.</div></td></tr><tr><td class="td_row_even"><div class="td_row_even">port</div></td><td class="td_row_even"><div class="td_row_even">integer</div></td><td class="td_row_even"><div class="td_row_even">no</div></td><td class="td_row_even"><div class="td_row_even">0</div></td><td class="td_row_even"><div class="td_row_even">The port of the XMPP connection.</div></td></tr><tr><td class="td_row_odd"><div class="td_row_odd">server_address</div></td><td class="td_row_odd"><div class="td_row_odd">string</div></td><td class="td_row_odd"><div class="td_row_odd">no</div></td><td class="td_row_odd"><div class="td_row_odd">0</div></td><td class="td_row_odd"><div class="td_row_odd">The server address of the XMPP connection.</div></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody> \ No newline at end of file diff --git a/gitlab-ci/functional-test.sh b/gitlab-ci/functional-test.sh new file mode 100755 index 0000000000000000000000000000000000000000..358a9ceef2baed5e8eb36f22292d72df070125ec --- /dev/null +++ b/gitlab-ci/functional-test.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +echo "$0 preparation script" +pwd + +source ./gitlab-ci/shared.sh + +# build package +date +%s > timestamp.log +make_clean +make_build +make_install_lib + +supervisorctl status all +supervisorctl update +exec_cmd ubus wait_for usp.raw +supervisorctl restart xmppc +supervisorctl status all + +sleep 30 + +supervisorctl stop all +supervisorctl status + +#report part +gcovr -r . --xml -o ./funl-test-coverage.xml +gcovr -r . + +echo "Checking memory leaks ..." +grep -q "<kind>UninitCondition</kind>" memory-report.xml +check_ret $? + +grep -q "<kind>Leak_PossiblyLost</kind>" memory-report.xml +check_ret $? + +grep -q "<kind>Leak_DefinitelyLost</kind>" memory-report.xml +check_ret $? + +echo "Functional Test :: PASS" diff --git a/gitlab-ci/install-dependencies.sh b/gitlab-ci/install-dependencies.sh new file mode 100755 index 0000000000000000000000000000000000000000..c6e0d6ea84c50245d6d007720d81fe7608cc135c --- /dev/null +++ b/gitlab-ci/install-dependencies.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +echo "install dependencies for unit-test script" +pwd + +source ./gitlab-ci/shared.sh + +# install required packages +exec_cmd apt update +exec_cmd apt install -y python3-pip libstrophe-dev +exec_cmd pip3 install pexpect ubus + +# install uspd +cd /opt/dev +[ -d uspd ] && rm -fr uspd +exec_cmd git clone https://dev.iopsys.eu/iopsys/uspd.git +cd uspd +#exec_cmd git checkout origin/transaction_id +exec_cmd ./gitlab-ci/install-dependencies.sh +exec_cmd ./gitlab-ci/setup.sh +exec_cmd make +exec_cmd cp uspd /usr/sbin/uspd diff --git a/gitlab-ci/iopsys-supervisord.conf b/gitlab-ci/iopsys-supervisord.conf new file mode 100644 index 0000000000000000000000000000000000000000..416af314715a17032b047cb5cd37080a78597c3c --- /dev/null +++ b/gitlab-ci/iopsys-supervisord.conf @@ -0,0 +1,24 @@ +[program:ubusd] +autorestart=false +startretries=0 +priority=1 +command=/bin/bash -c "/usr/sbin/ubusd" + +[program:rpcd] +autorestart=false +startretries=0 +priority=2 +command=/bin/bash -c "/usr/sbin/rpcd" + +[program:uspd] +autorestart=false +startretries=0 +priority=3 +command=/bin/bash -c "/usr/sbin/uspd" + +[program:xmppc] +autorestart=false +startretries=0 +priority=4 +command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=/builds/iopsys/xmppc/memory-report.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/xmppc/xmppc" + diff --git a/gitlab-ci/setup.sh b/gitlab-ci/setup.sh new file mode 100755 index 0000000000000000000000000000000000000000..efd686604ef6eee4de7f8c243dbfab0c0cc80afd --- /dev/null +++ b/gitlab-ci/setup.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +echo "preparation script" + +mkdir -p /var/state/ +cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/ +cp -rf ./test/files/* / + +ls /etc/config/ +ls /etc/supervisor/conf.d/ diff --git a/gitlab-ci/shared.sh b/gitlab-ci/shared.sh new file mode 100644 index 0000000000000000000000000000000000000000..513cff459013b25ab03272dea82317bb5ea43459 --- /dev/null +++ b/gitlab-ci/shared.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +function cleanup() +{ + echo "" +} + +function check_ret() +{ + ret=$1 + if [ "$ret" -ne 0 ]; then + echo "Validation of last command failed, ret(${ret})" + exit $ret + fi + +} + +function error_on_zero() +{ + ret=$1 + if [ "$ret" -eq 0 ]; then + echo "Validation of last command failed, ret(${ret})" + exit $ret + fi + +} + +function exec_cmd() +{ + echo "executing $@" + $@ >/dev/null 2>&1 + + if [ $? -ne 0 ]; then + echo "Failed to execute $@" + exit 1 + fi +} + +function make_clean() +{ + make clean + rm *.gcno + rm *.gcda +} + +function make_build() +{ + export CFLAGS="-g -O0 -fprofile-arcs -ftest-coverage" + export LDFLAGS="--coverage" + exec_cmd make +} + +function make_install_lib() +{ + mkdir -p /usr/lib/bbfdm/ + exec_cmd cp libxmppc.so /usr/lib/bbfdm/ +} + diff --git a/schemas/uci/xmpp.json b/schemas/uci/xmpp.json new file mode 100644 index 0000000000000000000000000000000000000000..8313c4c10471b7d36beb9f7cc09239068375f1d7 --- /dev/null +++ b/schemas/uci/xmpp.json @@ -0,0 +1,193 @@ +{ + "xmpp": [ + { + "section": "xmpp", + "description": "xmppc daemon Settings", + "multi": false, + "options": [ + { + "name": "enable", + "type": "boolean", + "required": "yes", + "default": "0", + "description": "Enable xmpp feature" + }, + { + "name": "id", + "type": "uinteger", + "required": "yes", + "default": "0", + "description": "The id of XMPP connection" + }, + { + "name": "allowed_jid", + "type": "string", + "required": "no", + "default": "", + "description": "The list of Jabber IDs or addresses that are allowed to initiate an XMPP Connection Request." + }, + { + "name": "loglevel", + "type": "uinteger", + "required": "no", + "default": "", + "description": "The log type to use, by default it is set to **'INFO'**. The possible types are **'EMERG', 'ALERT', 'CRITIC' ,'ERROR', 'WARNING', 'NOTICE', 'INFO' and 'DEBUG'**." + } + ] + }, + { + "section": "connection", + "description": "Configure xmpp connections", + "multi": false, + "options": [ + { + "name": "con_inst", + "type": "uinteger", + "required": "no", + "default": "", + "description": "The instance number of the XMPP connection." + }, + { + "name": "enable", + "type": "boolean", + "required": "no", + "default": "", + "description": "If set to **1**, it enables the XMPP connection." + }, + { + "name": "con_alias", + "type": "string", + "required": "no", + "default": "", + "description": "The alias of the XMPP connection." + }, + { + "name": "username", + "type": "string", + "required": "no", + "default": "", + "description": "The username of the XMPP connection." + }, + { + "name": "password", + "type": "string", + "required": "no", + "default": "", + "description": "The password of the XMPP connection." + }, + { + "name": "domain", + "type": "string", + "required": "no", + "default": "", + "description": "The proposed domain-part of the Jabber ID of the XMPP connection." + }, + { + "name": "resource", + "type": "string", + "required": "no", + "default": "", + "description": "The proposed resource-part of the Jabber ID of the XMPP connection." + }, + { + "name": "usetls", + "type": "boolean", + "required": "no", + "default": "", + "description": "If set to **1**, the CPE will initiate TLS negotiation." + }, + { + "name": "interval", + "type": "uinteger", + "required": "no", + "default": "", + "description": "The number of seconds, that keep alive events are sent by the XMPP connection." + }, + { + "name": "attempt", + "type": "string", + "required": "no", + "default": "", + "description": "The number of times that the Connection attempts to connect to a given IP address." + }, + { + "name": "initial_retry_interval", + "type": "uinteger", + "required": "no", + "default": "", + "description": "The maximum first reconnection wait interval in seconds." + }, + { + "name": "retry_interval_multiplier", + "type": "uinteger", + "required": "no", + "default": "", + "description": "The reconnection interval multiplier." + }, + { + "name": "retry_max_interval", + "type": "uinteger", + "required": "no", + "default": "", + "description": "The maximum reconnection wait interval in seconds." + }, + { + "name": "serveralgorithm", + "type": "string", + "required": "no", + "default": "", + "description": "The algorithm used when connecting with the XMPP server. Two algorithms are supported: **'DNS-SRV' and 'ServerTable'**." + } + ] + }, + { + "section": "connection_server", + "description": "xmpp connection server configuration", + "multi": false, + "options": [ + { + "name": "con_id", + "type": "string", + "required": "no", + "default": "0", + "description": "The id XMPP connection to use." + }, + { + "name": "con_srv_inst", + "type": "integer", + "required": "no", + "default": "0", + "description": "The instance number of the XMPP server." + }, + { + "name": "enable", + "type": "boolean", + "required": "no", + "default": "0", + "description": "If set to **1**, it enables this XMPP server." + }, + { + "name": "con_srv_alias", + "type": "string", + "required": "no", + "default": "0", + "description": "The alias of the XMPP connection." + }, + { + "name": "port", + "type": "integer", + "required": "no", + "default": "0", + "description": "The port of the XMPP connection." + }, + { + "name": "server_address", + "type": "string", + "required": "no", + "default": "0", + "description": "The server address of the XMPP connection." + } + ] + } + ] +} diff --git a/test/files/etc/config/xmpp b/test/files/etc/config/xmpp new file mode 100644 index 0000000000000000000000000000000000000000..4829e422b5b4c796e8cf40243225f00e08ea4bf0 --- /dev/null +++ b/test/files/etc/config/xmpp @@ -0,0 +1,29 @@ + +config xmpp 'xmpp' + option enable '1' + option id '1' + option allowed_jid '' + #Log levels: Critical=0, Warning=1, Notice=2, Info=3, Debug=4 + option loglevel '3' + +config connection + option xmpp_id '1' + option enable '1' + option username 'test' + option password 'test' + option domain 'xmpp.jp' + option resource '' + option usetls '0' + option interval '30' + option attempt '16' + option initial_retry_interval '1' + option retry_interval_multiplier '1000' + option retry_max_interval '1' + option serveralgorithm 'DNS-SRV' + +config connection_server + option con_id '1' + option enable '0' + option port '5222' + option server_address '172.17.0.1' + diff --git a/test/files/usr/libexec/rpcd/tr069 b/test/files/usr/libexec/rpcd/tr069 new file mode 100755 index 0000000000000000000000000000000000000000..d535bbe9646bf712e0b7020e084b0d14645782c9 --- /dev/null +++ b/test/files/usr/libexec/rpcd/tr069 @@ -0,0 +1,17 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + echo '{ "inform":{"GetRPCMethods":"Boolean","event":"String"} }' + ;; + call) + case "$2" in + inform) + echo "### CWMP inform called [$@]">/dev/console + ;; + esac + ;; +esac +