No description
Find a file
2021-06-25 21:46:26 +01:00
bin Build libicwmp by test/cmocka/Makefile instead of bin/Makefile.am 2021-06-25 15:29:02 +01:00
docs/api Added ubus schema for tr069 2021-06-03 13:55:07 +05:30
gitlab-ci Functional test with OpenACS 2021-06-25 21:46:26 +01:00
inc Ticket refs #5445: icwmp: SOAP messages unit tests 2021-06-25 11:47:05 +01:00
schemas Added ubus schema for tr069 2021-06-03 13:55:07 +05:30
test Functional test with OpenACS 2021-06-25 21:46:26 +01:00
.clang-format update clang-format and gitignore 2021-06-25 11:46:39 +01:00
.gitignore update clang-format and gitignore 2021-06-25 11:46:39 +01:00
.gitlab-ci.yml Functional test with OpenACS 2021-06-25 21:46:26 +01:00
backupSession.c Ticket refs #5366: icwmp: fix transaction issue in case there are multiple RPC calls in one session 2021-06-17 15:40:59 +01:00
common.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
config.c Fix some memory leaks when reloading icwmp config 2021-06-24 09:09:49 +01:00
configure.ac Build libicwmp by test/cmocka/Makefile instead of bin/Makefile.am 2021-06-25 15:29:02 +01:00
cwmp.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
cwmp_cli.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
cwmp_du_state.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
cwmp_time.c Linux Kernel code-styling 2021-01-04 09:01:35 +01:00
cwmp_uci.c Fix x86 compilation error using GCC 9 2021-06-04 14:49:41 +01:00
cwmp_zlib.c linux kernel styling complete && other cleanups 2021-01-05 15:59:16 +01:00
datamodel_interface.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
diagnostic.c code enhancements and arrangement: session download upload scheduleInform changedustate 2021-05-18 12:34:29 +01:00
digestauth.c CR: accept a so long username and password 2021-02-09 10:10:39 +01:00
download.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
event.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
http.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
kcwmp.c Ticket refs #3731: icwmpd: Static Code Analysis (flawfinder) 2021-04-20 17:23:04 +01:00
LICENSE COPYING -> LICENSE 2021-04-20 18:34:00 +02:00
log.c Fix x86 compilation error using GCC 9 2021-06-04 14:49:41 +01:00
Makefile.am Ticket refs #3989: icwmpd: Functional Test of CWMP Protocols 2021-06-24 09:09:02 +01:00
md5.c linux kernel styling complete && other cleanups 2021-01-05 15:59:16 +01:00
netlink.c Ticket refs #4935: icwmp: make all free of dynamic memory allocations (malloc, calloc, asprintf, strdup) in the end session 2021-06-04 14:49:28 +01:00
notifications.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
README.md Added ubus schema for tr069 2021-06-03 13:55:07 +05:30
reboot.c Ticket refs #5325: Add support for Device.ManagementServer.ScheduleReboot and DelayReboot 2021-06-04 14:49:50 +01:00
sched_inform.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
session.c Ticket refs #5445: icwmp: SOAP messages unit tests 2021-06-25 11:47:05 +01:00
ubus.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
upload.c exit icwmp properly when catching a signal 2021-06-24 09:10:03 +01:00
xml.c Ticket refs #5445: icwmp: SOAP messages unit tests 2021-06-25 11:47:05 +01:00

CWMP Agent

icwmp is a client implementation of TR-069/CWMP protocol.

It is written in C programming language and depends on a number of libraries of OpenWrt for building and running.

Good to Know

The icwmp client is :

  • tested with several ACS such as Axiros, AVSytem, GenieACS, OpenACS, etc...
  • supports all required TR069 RPCs.
  • supports all DataModel of TR family such as TR-181, TR-104, TR-143, TR-157, etc...
  • supports all types of connection requests such as HTTP, XMPP, STUN.
  • supports integrated file transfer such as HTTP, HTTPS, FTP.

Configuration File

The icwmp UCI configuration is located in '/etc/config/cwmp', and contains 3 sections: 'acs', 'cpe' and 'lwn'.

config acs 'acs'
	option userid 'iopsys'
	option dhcp_discovery 'enable'
	option compression 'Disabled'
	option retry_min_wait_interval '5'
	option retry_interval_multiplier '2000'

config cpe 'cpe'
	option interface 'eth0.1'
	option default_wan_interface 'wan'
	option userid 'iopsys'
	option exec_download '0'
	
config lwn 'lwn'
	option enable '1'
	option hostname ''
	option port ''

For more info on the cwmp UCI configuration see link or raw schema

RPCs Method supported

the folowing tables provides a summary of all methods, and indicates the conditions under which implementation of each RPC method defined in Annex A is REQUIRED or OPTIONAL.

Methods for CPE responding

Method name CPE requirement Supported
GetRPCMethods REQUIRED Yes
SetParameterValues REQUIRED Yes
GetParameterValues REQUIRED Yes
GetParameterNames REQUIRED Yes
SetParameterAttributes REQUIRED Yes
GetParameterAttributes REQUIRED Yes
AddObject REQUIRED Yes
DeleteObject REQUIRED Yes
Reboot REQUIRED Yes
Download REQUIRED Yes
ScheduleDownload OPTIONAL Yes
Upload OPTIONAL Yes
FactoryReset OPTIONAL Yes
GetQueuedTransfers OPTIONAL No
GetAllQueuedTransfers OPTIONAL No
CancelTransfer OPTIONAL Yes
ScheduleInform OPTIONAL Yes
ChangeDUState OPTIONAL Yes
SetVouchers OPTIONAL No
GetOptions OPTIONAL No

Methods for CPE calling

Method name CPE requirement Supported
GetRPCMethods OPTIONAL Yes
Inform REQUIRED Yes
TransferComplete REQUIRED Yes
AutonomousTransferComplete OPTIONAL No
DUStateChangeComplete OPTIONAL Yes
AutonomousDUStateChangeComplete OPTIONAL No
RequestDownload OPTIONAL No
Kicked OPTIONAL No

Concepts and Workflow

As indicated in the TR069 standard, the icwmpd starts automatically when the system is started. Then it connects to the ACS, that can be set manually by the admin or found by dhcp discovery. And later it could start other sessions due to event causes.

Session workflow could be checked with sniffer packets tool such as wireshark or tcpdump. In addition icwmpd has a log file '/var/log/icwmpd.log', that describes the workflow. E.g. below you can find an abstract of a log file content:

24-12-2019, 10:21:18 [INFO]    STARTING ICWMP with PID :7762
24-12-2019, 10:21:18 [INFO]    Periodic event is enabled. Interval period = 180000s
24-12-2019, 10:21:18 [INFO]    Periodic time is Unknown
24-12-2019, 10:21:18 [INFO]    Connection Request server initiated with the port: 7547
24-12-2019, 10:21:18 [INFO]    Start session
24-12-2019, 10:21:18 [INFO]    ACS url: http://genieacs:7547
24-12-2019, 10:21:18 [INFO]    Preparing the Inform RPC message to send to the ACS
24-12-2019, 10:21:18 [INFO]    Send the Inform RPC message to the ACS
24-12-2019, 10:21:19 [INFO]    Get the InformResponse message from the ACS
24-12-2019, 10:21:19 [INFO]    Send empty message to the ACS
24-12-2019, 10:21:19 [INFO]    Receive HTTP 204 No Content
24-12-2019, 10:21:19 [INFO]    End session
24-12-2019, 10:21:19 [INFO]    Waiting the next session

You could set the uci config cwmp.cpe.log_severity option to 'DEBUG' in order to show in details the cwmp log.

icwmp uBus

icwmpd must be launched on startup after ubusd. It exposes the CWMP functionality over ubus. The icwmpd registers tr069 namespaces with ubus, that has the shown below functionalities:

For more info on the tr069 ubus schema see link or raw schema

tr069 ubus examples

root@iopsys:~# ubus -v list tr069
'tr069' @04d3de4e
	"notify":{}
	"command":{"command":"String"}
	"status":{}
	"inform":{"GetRPCMethods":"Boolean","event":"String"}
root@iopsys:~# 

Each object registered with the 'tr069' namespace has a specific functionality.

  • To get the status of cwmp client, use the status ubus method:
root@iopsys:~# ubus call tr069 status
{
	"cwmp": {
		"status": "up",
		"start_time": "2019-12-24T10:21:18+01:00",
		"acs_url": "http:\/\/genieacs:7547"
	},
	"last_session": {
		"status": "success",
		"start_time": "2019-12-24T10:21:18+01:00",
		"end_time": "2019-12-24T10:21:19+01:00"
	},
	"next_session": {
		"status": "waiting",
		"start_time": "2019-12-26T12:21:18+01:00",
		"end_time": "N\/A"
	},
	"statistics": {
		"success_sessions": 1,
		"failure_sessions": 0,
		"total_sessions": 1
	}
}
root@iopsys:~#
  • To trigger a new session to ACS with the event '6 CONNECTION REQUEST' or '8 DIAGNOSTICS COMPLETE', etc.., use the inform ubus method with the appropriate event argument:
root@iopsys:~# ubus call tr069 inform '{"event":"6 connection request"}'
{
	"status": 1,
	"info": "Session started"
}
root@iopsys:~#
root@iopsys:~# ubus call tr069 inform '{"event":"8 diagnostics complete"}'
{
	"status": 1,
	"info": "Session started"
}
root@iopsys:~#
root@iopsys:~# ubus call tr069 inform '{"GetRPCMethods":"1"}'
{
	"status": 1,
	"info": "Session started"
}
root@iopsys:~#
  • To reload the icwmpd config, use the command ubus method with reload argument:
root@iopsys:~# ubus call tr069 command '{"command":"reload"}'
{
	"status": 1,
	"info": "icwmpd config reloaded"
}
root@iopsys:~# 
  • To exit the icwmpd daemod, use the command ubus method with exit argument:
root@iopsys:~# ubus call tr069 command '{"command":"exit"}'
{
	"status": 1,
	"info": "icwmpd daemon stopped"
}
root@iopsys:~# 

icwmpd command line

icwmpd command line options are described with --help option as below:

root@iopsys:~# icwmpd --help
Usage: icwmpd [OPTIONS]
 -s, --ubus_socket                                    Ubus socket path for IPC
 -b, --boot-event                                    (CWMP daemon) Start CWMP with BOOT event
 -g, --get-rpc-methods                               (CWMP daemon) Start CWMP with GetRPCMethods request to ACS
 -c, --cli                              	     CWMP CLI
 -h, --help                                          Display this help text
 -v, --version                                       Display the version

icwmpd CLI

The icwmpd CLI is the -c (--cli) option of the icwmpd command line.

Different options of this CLI are described with help command as below:

root@iopsys:~# icwmpd -c help
Valid commands:
	help 									=> show this help
	get [path-expr] 						=> get parameter values
	get_names [path-expr] [next-level] 		=> get parameter names
	set [path-expr] [value] 				=> set parameter value
	add [object] 							=> add object
	del [object] 							=> delete object
	get_notif [path-expr]					=> get parameter notifications
	set_notif [path-expr] [notification]	=> set parameter notifications

Dependencies

To successfully build icwmp, the following libraries are needed:

Dependency Link License
libuci https://git.openwrt.org/project/uci.git LGPL 2.1
libubox https://git.openwrt.org/project/libubox.git BSD
libubus https://git.openwrt.org/project/ubus.git LGPL 2.1
libjson-c https://s3.amazonaws.com/json-c_releases MIT
libopenssl http://ftp.fi.muni.cz/pub/openssl/source/ OpenSSL
libcurl https://dl.uxnr.de/mirror/curl MIT
libmicroxml https://dev.freecwmp.org/microxml LGPL 2.0