Updated Readme

This commit is contained in:
Vivek Kumar Dutta 2021-07-29 13:22:29 +00:00
parent 55e2d94a9e
commit ab883852f9
7 changed files with 768 additions and 359 deletions

View file

@ -7,11 +7,11 @@ It is written in C programming language and depends on a number of libraries of
## 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**.
* 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
@ -37,7 +37,7 @@ config lwn 'lwn'
option port ''
```
For more info on the `cwmp` UCI configuration see [link](./docs/api/uci.cwmp.md) or [raw schema](./schemas/uci/cwmp.json)
> Complete uci for `cwmp` configuration available in [link](./docs/api/uci.cwmp.md) or [raw schema](./schemas/uci/cwmp.json)
## RPCs Method supported
@ -85,7 +85,7 @@ the folowing tables provides a summary of all methods, and indicates the conditi
## 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.
As indicated in the TR069 standard, the icwmpd starts automatically when the system is started. Then it reads the initial configuration from uci and if configured connects to the ACS. ACS configuration in icwmp can be done manually by the admin using uci or by operator using dhcp option 43, 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:
@ -110,15 +110,16 @@ You could set the uci config `cwmp.cpe.log_severity` option to `'DEBUG'` in orde
## 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:
icwmpd must be launched on startup after ubusd. It exposes some cwmp client rpc along with some debug utilities over ubus. The icwmpd registers `tr069` namespaces with ubus, that has below functionalities:
For more info on the `tr069` ubus schema see [link](./docs/api/tr069.md) or [raw schema](./schemas/ubus/tr069.json)
> Note: For more info on the `tr069` ubus schema see [link](./docs/api/tr069.md) or [raw schema](./schemas/ubus/tr069.json)
### tr069 ubus examples
The output shown in below examples are just for demonstration purpose, the actual output shall vary as per the cwmp configuration and state. The schema for ubus is available at [link](./docs/api/tr069.md) or [raw schema](./schemas/ubus/tr069.json)
```bash
root@iopsys:~# ubus -v list tr069
'tr069' @04d3de4e
"notify":{}
'tr069' @aadff65c
"command":{"command":"String"}
"status":{}
"inform":{"GetRPCMethods":"Boolean","event":"String"}
@ -134,23 +135,23 @@ root@iopsys:~# ubus call tr069 status
{
"cwmp": {
"status": "up",
"start_time": "2019-12-24T10:21:18+01:00",
"acs_url": "http:\/\/genieacs:7547"
"start_time": "2021-07-29T09:29:02+02: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"
"start_time": "2021-07-29T09:29:59+02:00",
"end_time": "2021-07-29T09:30:00+02:00"
},
"next_session": {
"status": "waiting",
"start_time": "2019-12-26T12:21:18+01:00",
"end_time": "N\/A"
"start_time": "2021-07-29T09:59:59+02:00",
"end_time": "N/A"
},
"statistics": {
"success_sessions": 1,
"success_sessions": 2,
"failure_sessions": 0,
"total_sessions": 1
"total_sessions": 2
}
}
root@iopsys:~#
@ -206,7 +207,6 @@ icwmpd command line options are described with `--help` option as below:
```bash
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
@ -216,7 +216,7 @@ Usage: icwmpd [OPTIONS]
## icwmpd CLI
The icwmpd CLI is the -c (--cli) option of the icwmpd command line.
The icwmpd CLI is a debug utility and can be invoked using -c (--cli) command line option.
Different options of this CLI are described with help command as below:
@ -231,26 +231,46 @@ Valid commands:
del [object] => delete object
get_notif [path-expr] => get parameter notifications
set_notif [path-expr] [notification] => set parameter notifications
```
> Note: icwmpd CLI is a debug utility and hence it is advised to use for debug and development purpose only.
## icwmpd forced inform parameters
As per the cwmp inform requirements, cwmp client has list of parameters defined internally. The list contains below parameters:
In addition to the forced inform parameters specified in datamodel stanadard, icwmp gives the possibility to add other inform parameters.
Those new inform parameters can be set in a json file as following:
| Parameter name |
| ---------------------------------------------- |
| Device.RootDataModelVersion |
| Device.DeviceInfo.HardwareVersion |
| Device.DeviceInfo.SoftwareVersion |
| Device.DeviceInfo.ProvisioningCode |
| Device.ManagementServer.ParameterKey |
| Device.ManagementServer.ConnectionRequestURL |
| Device.ManagementServer.AliasBasedAddressing |
In addition to the above defined forced inform parameters as specified in datamodel stanadard, icwmp gives the possibility to add other datamodel parameters as forced inform parameters, by defining them in a json file.
Additional inform parameters can be configured in a json file as below:
```bash
root@iopsys:~# cat /etc/icwmpd/forced_inform.json
{
"forced_inform":[
"Device.DeviceInfo.X_IOPSYS_EU_BaseMACAddress",
"Device.DeviceInfo.UpTime"
]
}
root@iopsys:~#
```
And then the path of the json file can be set in the uci option: cwmp.cpe.forced_inform_json like below:
```bash
root@iopsys:~# uci set cwmp.cpe.forced_inform_json=/etc/icwmpd/forced_inform.json
root@iopsys:~# uci commit cwmp
root@iopsys:~# /etc/init.d/icwmpd restart
```
The path of the json file is set in the uci option: cwmp.cpe.forced_inform_json
Please be sure that this json_file shouldn't contain duplicate parameters or parameters of the standard inform parameters specified in the datamodel.
> - It is required to restart icwmp service after the changes to use the new forced inform parameters
> - This json file shouldn't contain duplicate parameters or parameters of the standard inform parameters specified in the datamodel
> - Forced inform parameters defined in json should be leaf elements
## Dependencies
@ -265,3 +285,13 @@ To successfully build icwmp, the following libraries are needed:
| 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 |
Runtime dependencies:
| Dependency | Link | License |
| ----------- | ------------------------------------------- | -------------- |
| ubus | https://git.openwrt.org/project/ubus.git | LGPL 2.1 |
| bbf | https://dev.iopsys.eu/iopsys/bbf.git | LGPLv2.1 |
| uspd | https://dev.iopsys.eu/iopsys/uspd.git | GPL v2.0 |
> icwmpd gets the datamodel from the DUT via ubus using uspd, and also it registers `tr069` ubus namespace to expose some debug and cwmp client rpc funtionalities, so it is required to start it after starting ubusd and uspd.

View file

@ -50,18 +50,20 @@ int get_global_config(struct config *conf)
if (value != NULL) {
log_set_log_file_name(value);
FREE(value);
}
} else
log_set_log_file_name(NULL);
} else {
return error;
log_set_log_file_name(NULL);
}
if ((error = uci_get_value(UCI_CPE_LOG_MAX_SIZE, &value)) == CWMP_OK) {
if (value != NULL) {
log_set_file_max_size(value);
FREE(value);
}
} else
log_set_file_max_size(NULL);
} else {
return error;
log_set_file_max_size(NULL);
}
if ((error = uci_get_value(UCI_CPE_ENABLE_STDOUT_LOG, &value)) == CWMP_OK) {
@ -173,7 +175,7 @@ int get_global_config(struct config *conf)
CWMP_LOG(DEBUG, "CWMP CONFIG - acs compression: %d", conf->compression);
} else {
return error;
conf->compression = COMP_NONE;
}
if ((error = uci_get_value(UCI_ACS_RETRY_MIN_WAIT_INTERVAL, &value)) == CWMP_OK) {
@ -268,18 +270,6 @@ int get_global_config(struct config *conf)
return error;
}
if ((error = uci_get_value(UCI_ACS_SSL_VERSION, &value)) == CWMP_OK) {
if (value != NULL) {
FREE(conf->acs_ssl_version);
conf->acs_ssl_version = strdup(value);
FREE(value);
}
CWMP_LOG(DEBUG, "CWMP CONFIG - acs ssl version: %s", conf->acs_ssl_version ? conf->acs_ssl_version : "");
} else {
return error;
}
if ((error = uci_get_value(UCI_CPE_INTERFACE_PATH, &value)) == CWMP_OK) {
if (value != NULL) {
FREE(conf->interface);

File diff suppressed because one or more lines are too long

View file

@ -67,7 +67,6 @@ typedef struct config {
char *acs_userid;
char *acs_passwd;
char *acs_ssl_capath;
char *acs_ssl_version;
char *https_ssl_capath;
char *cpe_userid;
char *cpe_passwd;

View file

@ -28,7 +28,6 @@
#define UCI_HTTPS_SSL_CAPATH "cwmp.acs.https_ssl_capath"
#define UCI_ACS_INSECURE_ENABLE "cwmp.acs.insecure_enable"
#define UCI_ACS_IPV6_ENABLE "cwmp.acs.ipv6_enable"
#define UCI_ACS_SSL_VERSION "cwmp.acs.ssl_version"
#define UCI_ACS_COMPRESSION "cwmp.acs.compression"
#define UCI_ACS_RETRY_MIN_WAIT_INTERVAL "cwmp.acs.retry_min_wait_interval"
#define HTTP_DISABLE_100CONTINUE "cwmp.acs.http_disable_100continue"

2
log.c
View file

@ -53,6 +53,8 @@ int log_set_file_max_size(char *value)
{
if (value != NULL) {
log_max_size = atol(value);
} else {
log_max_size = 102400;
}
return 1;
}

View file

@ -2,7 +2,7 @@
"cwmp": [
{
"section": "acs",
"description": "This section configure the ACS parameters, used by cwmp client",
"description": "Configure the ACS parameters, used by icwmp",
"multi": false,
"options": [
{
@ -47,13 +47,6 @@
"default": "",
"description": "An absolute time reference to determine when the CPE will initiate the periodic Inform method calls."
},
{
"name": "ParameterKey",
"type": "string",
"required": "no",
"default": "",
"description": "Provides the ACS a reliable and extensible means to track changes made by the ACS."
},
{
"name": "dhcp_discovery",
"type": "string",
@ -73,21 +66,21 @@
"type": "uinteger",
"required": "no",
"default": "",
"description": "The min wait interval of rerty session (in seconds) as described in the standard."
"description": "The minimum wait interval for session retry (in seconds)"
},
{
"name": "retry_interval_multiplier",
"type": "uinteger",
"required": "no",
"default": "",
"description": "The retry interval mulpilier of rerty session as described in the standard."
"description": "The retry interval multiplier for session retry session as described in the standard."
},
{
"name": "https_ssl_capath",
"type": "string",
"required": "no",
"default": "",
"description": "The path of ssl certicafications files. the ssl certification is for Upload and Downlod methods."
"description": "The path of ssl certificates. ssl certificates used for Upload and Download methods."
},
{
"name": "ipv6_enable",
@ -101,14 +94,14 @@
"type": "string",
"required": "no",
"default": "",
"description": "The path of ssl certicafications files. the ssl certification is for TR-069 sessions."
"description": "The path of ssl certificates for TR-069 sessions."
},
{
"name": "insecure_enable",
"type": "boolean",
"required": "no",
"default": "",
"description": "if set to **1**, the CPE checks the validity of the ACS certificates."
"description": "if set to **1**, the CPE skips validation of the ACS certificates."
},
{
"name": "http_disable_100continue",
@ -122,7 +115,7 @@
"type": "string",
"required": "no",
"default": "",
"description": "the **url** of ACS server received from the DHCP server Option 43 when **'dhcp_discovery'** option is enabled. This option is updated automatically by the daemon."
"description": "the **url** of ACS server received from the DHCP server via Option 43. This parameter is automatically updated by daemon, When **'dhcp_discovery'** option is enabled."
},
{
"name": "ip_version",
@ -143,21 +136,21 @@
"type": "string",
"required": "no",
"default": "",
"description": "Specifies the device interface to use for connecting to ACS."
"description": "Configure the Layer3 device interface name to use for connecting to ACS."
},
{
"name": "default_wan_interface",
"type": "string",
"required": "no",
"default": "",
"description": "Specifies the default wan interface of the device."
"description": "Configure the default wan interface of the device."
},
{
"name": "log_to_console",
"type": "string",
"required": "no",
"default": "",
"description": "If set to **1**, the log messages will be shown in the console."
"description": "If set to **1**, the log messages will be shown in the console/stdout."
},
{
"name": "log_to_file",
@ -177,14 +170,14 @@
"name": "log_file_name",
"type": "string",
"required": "no",
"default": "",
"default": "/var/log/icwmpd.log",
"description": "Specifies the path of the log file, by default **'/var/log/icwmpd.log'**."
},
{
"name": "log_max_size",
"type": "uinteger",
"required": "no",
"default": "",
"default": "102400",
"description": "Size of the log file. The default value is **102400**."
},
{
@ -212,8 +205,8 @@
"name": "ubus_socket",
"type": "string",
"required": "no",
"default": "",
"description": "Specifies the path of the ubus socket file, by default **'NULL'**."
"default": "NULL",
"description": "Specifies the path of the ubus socket."
},
{
"name": "provisioning_code",
@ -226,22 +219,22 @@
"name": "amd_version",
"type": "uinteger",
"required": "no",
"default": "",
"description": "Specifies the amendment version to use. The default amendment version is **'5'**."
"default": "5",
"description": "Configure the amendment version to use."
},
{
"name": "instance_mode",
"type": "string",
"required": "no",
"default": "",
"description": "Specifies the instance mode to use, by default **'InstanceNumber'**. Two instance modes are supported: **'InstanceNumber' and 'InstanceNumber'**."
"default": "InstanceNumber",
"description": "Configure the instance mode to use. Supported instance modes are : <B>InstanceNumber</B> and <B>InstanceNumber</B>."
},
{
"name": "session_timeout",
"type": "uinteger",
"required": "no",
"default": "",
"description": "Represents the number of seconds that should be used by the ACS as the amount of time to wait before timing out a CWMP session due to the CPE not responding, by default **60**."
"default": "60",
"description": "Represents the number of seconds that should be used by the ACS as the amount of time to wait before timing out a CWMP session due to the CPE not responding."
},
{
"name": "notification",
@ -257,34 +250,6 @@
"default": "",
"description": "If set to **1**, Specifies if Download method is executed."
},
{
"name": "manufacturer",
"type": "string",
"required":"no",
"default": "",
"description": "Specifies the manafacturer of the device, by default **iopsys**. If set, its value will be the value of **Device.DeviceInfo.Manufacturer** parameter."
},
{
"name": "manufacturer_oui",
"type": "string",
"required":"no",
"default": "",
"description": "Specifies the manafacturer oui of the device, by default empty. If set, its value will be the value of **Device.DeviceInfo.ManufacturerOUI** parameter."
},
{
"name": "model_name",
"type": "string",
"required":"no",
"default": "",
"description": "Specifies the model name of the device, by default empty. If set, its value will be the value of **Device.DeviceInfo.ModelName** parameter."
},
{
"name": "product_class",
"type": "string",
"required":"no",
"default": "",
"description": "Specifies the product class of the device, by default empty. If set, its value will be the value of **Device.DeviceInfo.ProductClass** parameter."
},
{
"name": "log_to_syslog",
"type": "boolean",
@ -298,6 +263,20 @@
"required": "no",
"default": "",
"description": "If set to **1**, icwmp will be able to detect parameter value change at any time."
},
{
"name": "periodic_notify_interval",
"type": "integer",
"required": "no",
"default": "10",
"description": "Interval in sec to check for value change notifications"
},
{
"name": "forced_inform_json",
"type": "string",
"required": "no",
"default": "",
"description": "Define additional parameters as forced inform parameter. See readme for examples."
}
]
},