Align docs structure with doc portal

This commit is contained in:
Suvendhu Hansa 2023-01-09 10:03:00 +00:00 committed by Vivek Kumar Dutta
parent 79284d1f4e
commit 4529b8fbb6
37 changed files with 13995 additions and 479 deletions

1
.gitignore vendored
View file

@ -43,3 +43,4 @@ CMakeFiles/
cmake_install.cmake
install_manifest.txt
/report
docs/index.md

493
README.md
View file

@ -7,6 +7,7 @@ It is written in C programming language and depends on a number of libraries of
## Good to Know
The `icwmpd` 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...
@ -48,483 +49,20 @@ uci set cwmp.cpe.model_name="MODELXXX"
uci set cwmp.cpe.description="This is a test device"
uci commit cwmp
```
> Complete UCI for `cwmp` configuration available in [link](./docs/api/uci.cwmp.md) or [raw schema](./schemas/uci/cwmp.json)
## RPCs Method supported
The following 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 | `Yes` |
| `DUStateChangeComplete` | OPTIONAL | `Yes` |
| `AutonomousDUStateChangeComplete` | OPTIONAL | `Yes` |
| `RequestDownload` | OPTIONAL | No |
| `Kicked` | OPTIONAL | No |
## Concepts and Workflow
In OpenWRT integration, `icwmpd` depends on `procd` based init script `/etc/init.d/icwmpd` to start it in boot-up. Once started, it reads the initial configuration from UCI and if configured connects to the ACS.
Provisioning of the ACS URL can be done in `icwmpd` with a firmware default uci value, or it can be done dynamically using DHCP Option 43 on the configured default_wan_interface.
ACS Session workflow could be checked with sniffer packets tool such as Wireshark or `tcpdump`.
In addition to that, `icwmpd` give provision to configure a log file in uci.
A snapshot of log description is listed below for demonstration(Content of the log can vary based on configuration):
```bash
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
```
Further, it provides different log level that can be configured in uci config `cwmp.cpe.log_severity` to get more verbose log to no logs.
## uBus
`icwmpd` provides some RPCs support over ubus and some debug utilities those can be accessed using `tr069` ubus object. So, it must be launched on startup after `ubusd`.
> 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
Please note, 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' @aadff65c
"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:
```bash
root@iopsys:~# ubus call tr069 status
{
"cwmp": {
"status": "up",
"start_time": "2021-07-29T09:29:02+02:00",
"acs_url": "http://genieacs:7547"
},
"last_session": {
"status": "success",
"start_time": "2021-07-29T09:29:59+02:00",
"end_time": "2021-07-29T09:30:00+02:00"
},
"next_session": {
"status": "waiting",
"start_time": "2021-07-29T09:59:59+02:00",
"end_time": "N/A"
},
"statistics": {
"success_sessions": 2,
"failure_sessions": 0,
"total_sessions": 2
}
}
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:
```bash
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:
```bash
root@iopsys:~# ubus call tr069 command '{"command":"reload"}'
{
"status": 1,
"info": "icwmpd config reloaded"
}
root@iopsys:~#
```
## icwmpd command line
`icwmpd` command line options are described with `--help` option as below:
```bash
root@iopsys:~# icwmpd --help
Usage: icwmpd [OPTIONS]
-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 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:
```bash
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
```
> Note: icwmpd CLI is a debug utility and hence it is advised to use for debug and development purpose only.
> icwmpd CLI utility is independent of icwmpd daemon.
icwmp CLI command success result is displayed in the terminal as following:
```bash
root@iopsys:~# icwmpd -c get Device.DeviceInfo.UpTime
Device.DeviceInfo.UpTime => 91472
root@iopsys:~# icwmpd -c set Device.WiFi.SSID.1.SSID wifi1_ssid
Set value is successfully done
Device.WiFi.SSID.1.SSID => wifi1_ssid
```
In the case of fault the result is displayed as following:
```bash
root@iopsys:~# icwmpd -c get Device.DeviceInfo.UpTme
Fault 9005: Invalid parameter name
root@iopsys:~# icwmpd -c set
Fault 9003: Invalid arguments
root@iopsys:~# icwmpd -c set Device.WiFi.SSID.1.SSID
Fault 9003: Invalid arguments
```
## SPV Response and restart services
In case `icwmpd` receives from the ACS SetParameterValues Request, it will use the uspd setm_values ubus method for all requested parameters.
Basing on setm_values response the icwmp will do the following:
- in case of fault icwmp aborts the set of all parameters and then sends Response to the ACS with FAULT 9003 including all parameters faults as defined in TR069 standard.
- in case of success icwmp commits the set of all parameters, without applying them so without restarting services, and then sends a success Response to the ACS including the status code 1.
> - All restart services are done in the CWMP end session in order to prevent any session interruption.
> - icwmp always returns 1 as status value in case of success SPV because all restart services are done in the end session.
## icwmpd forced inform parameters
As per the cwmp inform requirements, cwmp client has list of parameters defined internally. The list contains below parameters:
| 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 standard, TR-181 datamodel defines the multi instance object Device.ManagementServer.InformParameter.{i}.
So new inform parameter can be added through the ACS by the call of the RPC method AddObject for the object Device.ManagementServer.InformParameter.{i}. and then set its parameters values.
icwmpd defines those new inform parameters in uci sections under the package /var/state/cwmp as below:
```bash
root@iopsys-44d43771aff0:~# cat /var/state/cwmp
config inform_parameter
option enable '1'
option parameter_name "Device.DeviceInfo.UpTime"
option events_list '1 BOOT,6 CONNECTION REQUEST'
config inform_parameter
option enable '0'
```
## Notification management
`icwmpd` support below notification types, which can be configured from an ACS on the datamodel parameters
- 0 = Notification off
- 1 = Passive notification
- 2 = Active notification
- 3 = Passive lightweight notification
- 4 = Passive notification with passive lightweight notification
- 5 = Active lightweight notification
- 6 = Passive notification with active lightweight notification
Along with this it does provide some debug utilities to get the notification from the device root shell as well
```bash
root@iopsys:~# icwmpd -c get_notif Device.Users.User.1.Username
Device.Users.User.1.Username => passive
```
To fulfill the requirement of forced active notification parameters, `icwmpd` internally maintains a list of forced active parameters specified in TR181. The list contains below parameters:
| Parameter name | Notification |
| ------------------------------------- |---------------|
| Device.DeviceInfo.SoftwareVersion | 2 |
| Device.DeviceInfo.ProvisioningCode | 2 |
So, Creation of any other type of notification on the above parameters results in a cwmp fault 9009.
Along with this `icwmpd` support configuration of notification parameters using a JSON file. Users can include this json file in there firmware to override the existing notification parameters, or add new notifications from the firmware itself.
Below is the schema/format of the JSON file:
```bash
root@iopsys:~# cat /etc/icwmpd/inform.json
{
"custom_notification": [
{
"parameter": "Device.Users.",
"notify_type": "2"
},
{
"parameter": "Device.WiFi.SSID.1.SSID",
"notify_type": "1"
}
]
}
```
> Note: In the Above example, parameter has to be defined with a valid datamodel parameter name and notify_type needs to be the notification type (number as present in the above table). Both the parameters are required.
After defining the JSON file with all the required parameters, this information required to update cwmp uci as below:
```bash
root@iopsys:~# uci set cwmp.cpe.custom_notify_json=/etc/icwmpd/inform.json
root@iopsys:~# uci commit cwmp
root@iopsys:~# /etc/init.d/icwmpd restart
```
>- ACS can manage the attributes of parameter added by custom_notification as it does for the other parameters
>- After firmware upgrade, for the 1st bootup, the custom_notify_json has higher priority, latter on ACS configured attributes get priority.
>- Addition of custom notification parameters is one time activity after upgrade, once done It can only be managed through ACS.
>- Parameters with wildcard not supported currently. So parameter like Device.WiFi.SSID.*. will be skipped
## How to configure icwmp client for HTTPS connection to ACS
In order to keep the connection secure, most customers use HTTPS to connect to ACS.
In this case we need to have an ACS that supports HTTPS, And for that we use GenieACS as an example because it's an open source and supports HTTPS.
Find below the required steps to configure GenieACS server and icwmp client to support HTTPS
### Generating the private key and certificate
1. Generate a private key for the CA:
```bash
root@75f824228409:/opt/genieacs# openssl genrsa 2048 > ca-key.pem
Generating RSA private key, 2048 bit long modulus (2 primes)
...................................................................................+++++
...........................+++++
e is 65537 (0x010001)
```
2. Generate the X509 certificate for the CA:
```bash
root@75f824228409:/opt/genieacs# openssl req -new -x509 -nodes -days 365000 -key ca-key.pem -out ca-cert.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:SE
State or Province Name (full name) [Some-State]:Stockholm
Locality Name (eg, city) []:Stockholm
Organization Name (eg, company) [Internet Widgits Pty Ltd]:IOPSYS
Organizational Unit Name (eg, section) []:IOPSYS
Common Name (e.g. server FQDN or YOUR name) []:genieacs
Email Address []:dev@iopsys.eu
root@75f824228409:/opt/genieacs#
```
> Note: When generating the certificate, you must fill the Common Name filed with the correct URL server (for example here 'genieacs') otherwise you will get an error later when trying to connect to the ACS.
### Installing and Configuring GenieACS environment variables
1. Install GenieACS
You can follow the steps described in this [link](http://docs.genieacs.com/en/latest/installation-guide.html) in order to install GenieACS.
2. Configure GenieACS environment variables to support HTTPS
GenieACS offers a list of environment variables to configure the different features, you can see all the information in detail in this [link](http://docs.genieacs.com/en/latest/environment-variables.html).
In fact, the most important to us are these two variables below to configure the SSL functionality.
```bash
GENIEACS_CWMP_SSL_CERT=/path/to/certificate/file/ca-cert.pem
GENIEACS_CWMP_SSL_KEY=/path/to/certificate/key/file/ca-key.pem
```
### Checking the generated Certificate
You can use `openssl` command to check if there is any error in generated certificate.
```bash
openssl s_client -connect genieacs:7547 -CAfile ca-cert.pem
```
### Configuring DUT to support HTTPS
1. Copy the generated certificate under the needed path (default path is '/etc/ssl/certs/')
```bash
scp /path/of/certificate/ca-cert.pem root@192.168.1.1:/etc/ssl/certs
```
2. Set 'ssl_capath' option in cwmp config with certificate directory path (default path is '/etc/ssl/certs/')
```bash
uci set cwmp.acs.url='https://genieacs:7547'
uci set cwmp.acs.ssl_capath="/etc/ssl/certs"
ubus call uci commit '{"config":"cwmp"}'
```
Now, all required configuration are ready and you can start a cwmp connection using HTTPS.
## Manageable devices and Gateway Information (TR069 - Annex F)
> The CPE WAN Management Protocol can be used to remotely manage CPE Devices that are connected via a LAN through a Gateway. When an ACS manages both a Device and the Gateway through which the Device is connected, it can be useful for the ACS to be able to determine the identity of that particular Gateway.
> -- <cite> TR-69 Annex F.</cite>
Below is the sequence diagram for the Device-Gateway association with DHCP Discover.
```mermaid
sequenceDiagram
Lan-Device->>+Gateway: DHCP Discover (Device Identity)
Gateway->>Lan-Device: DHCP Offer (Gateway Identity)
Lan-Device->>Gateway: DHCP Request (Device Identity)
Gateway->>-Lan-Device: DHCP ACK (Gateway Identity)
Note left of Lan-Device: Lan-Device Populate GatewayInfo. table
Note right of Gateway: Gateway Populate ManageableDevice.{i}. table
Lan-Device->>ACS: TR069 Inform (with Gateway Identity)
ACS->>Lan-Device: TR069 Inform response
ACS->>Gateway: TR069 Get (ManageableDevice)
Gateway->>ACS: TR069 GetResp (ManageableDevice) table
```
### Gateway Procedures
A Gateway here in this context means, an Annex-F capable CPE running icwmpd which provide LAN/NAT connectivity.
The Gateway Identity tuple (OUI, ProductClass, SerialNumber) is present in 'db' (Same source used for Device.DeviceInfo. object).
The `/etc/init.d/icwmp` script reads the default lan interface from UCI option `cwmp.cpe.default_lan_interface` and configures the gateway identity in `dhcp` UCI for the corresponding LAN interface section to publish gateway information to its LAN clients.
> Note: If UCI option `cwmp.cpe.default_lan_interface` is not defined then gateway identity would not be published in LAN network.
#### Identification of Manageable Device in LAN network
Gateway device relies on DHCP options (/tmp/dhcp.client.options) file for getting the Manageable Device identities, which is exposed in the TR181 datamodel using (libbbf) API's.
The Device.ManagementServer.ManageableDevice.{i}. object table is populated for the active devices available in `Device.Hosts.` table and their device identity is collected from `/tmp/dhcp.client.options` file.
### Lan-Device procedures
A Lan-Device here in this context means, an Annex-F capable CPE running icwmpd which is connected via a LAN through a Gateway.
The Lan-Device Identity tuple (OUI, ProductClass, SerialNumber) is present in 'db' (Same source used for Device.DeviceInfo. object).
The `/etc/init.d/icwmp` script reads the default wan interface from UCI option `cwmp.cpe.default_wan_interface` and configures the device identity in `network` UCI to publish its own identity to upstream network (DHCP server) using DHCP option 125 for the corresponding wan interface.
> Note: If UCI option `cwmp.cpe.default_wan_interface` is not defined then it assumes the default interface as `wan`.
#### Identification of Gateway Device in WAN network
If lan-device(CPE) receives DHCP option 125 in DHCP offer from upstream network it exposes the same in its UBUS method (e.g. ifstatus wan).
```bash
root@iopsys-44d43771b000:~# ifstatus wan
{
...
...
"data": {
"opt125": "XXXXXXXXXXXXXXXXXXX"
}
}
```
ICWMPD package adds a [DHCP client hook script](files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user), which parses DHCP option 125 to extract gateway identity based on Enterprise ID `3561`.
This script then writes the gateway identity in `/var/state/cwmp` if CWMP is enabled in the device.
Datamodel (libbbf) API's reads the gateway information from `/var/state/cwmp` to populate Device.GatewayInfo. object. If gateway information is not available in `/var/state/cwmp` then it reads the 'db' (Same source used for Device.DeviceInfo. object) and maps that data to populate Device.GatewayInfo. object.
## Provisioning of CWMP Agent through DHCP Server
If CPE receives DHCP option 43 in DHCP offer from upstream network it exposes the same in its UBUS method (e.g. ifstatus wan).
```bash
root@iopsys-44d43771b000:~# ifstatus wan
{
...
...
"data": {
"vendorspecinf": "XXXXXXXXXXXXXXXXXXX"
}
}
```
CWMP Agent uses DHCP option 43 for provisioning if CWMP and DHCP discovery is enabled in the device. ICWMPD package adds a [DHCP client hook script](files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user), which parses DHCP option 43 value to extract informations like ACS URL, minimum interval for session retry, retry interval multiplier for session retry and provisioning code that specifies the primary service provider and other provisioning information, which may be used by the ACS to determine service provider-specific customization and provisioning parameters.
This script then writes the provisioning information in `/etc/config/cwmp`.
CWMP Agent reads the provisioning information from `/etc/config/cwmp` before starting a session.
> Note: If in any time ACS configures `Device.ManagementServer.URL` then DHCP discovery is disabled automatically.
> Complete UCI for `cwmp` configuration available in [link](./docs/api/uci/cwmp.md) or [raw schema](https://dev.iopsys.eu/iopsys/icwmp/-/blob/devel/schemas/uci/cwmp.json)
> 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`.
## Important topics
* [Concepts & Workflow](./docs/guide/workflow.md)
* [Provisioning via DHCP](./docs/guide/dhcp_provisioning.md)
* [HTTPS configuration guide](./docs/guide/https_config.md)
* [Handling of SPV and service restart](./docs/guide/spv_restart.md)
* [Inform and notification management](./docs/guide/notification.md)
* [Manageable devices and Gateway Information (TR069 - Annex F)](./docs/guide/annex_f.md)
* [Supported RPC Methods](./docs/guide/supported_rpc.md)
* [UBUS methods](./docs/guide/ubus_method.md)
* [Command Line Interface](./docs/guide/cli.md)
## Dependencies
@ -548,4 +86,3 @@ Runtime dependencies:
| 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`.

7
docs/.pages Normal file
View file

@ -0,0 +1,7 @@
title: "DOCS"
nav:
- "api"
- "guide"
- "spec"
- "..."

6
docs/api/.pages Normal file
View file

@ -0,0 +1,6 @@
title: "API"
nav:
- "ubus"
- "uci"
- "..."

4
docs/api/ubus/.pages Normal file
View file

@ -0,0 +1,4 @@
title: "UBUS"
nav:
- "..."

View file

@ -1,4 +1,4 @@
# tr069 Schema
# tr069 UBUS Schema
```
https://www.iopsys.eu/tr069.json

4
docs/api/uci/.pages Normal file
View file

@ -0,0 +1,4 @@
title: "UCI"
nav:
- "..."

View file

@ -1,3 +1,5 @@
# UCI schema
<tbody>
<tr>
<td colspan="2">

Binary file not shown.

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

124
docs/css/colors.css Executable file
View file

@ -0,0 +1,124 @@
////
/// Copyright (c) 2016-2021 Martin Donath <martin.donath@squidfunk.com>
///
/// Permission is hereby granted, free of charge, to any person obtaining a
/// copy of this software and associated documentation files (the "Software"),
/// to deal in the Software without restriction, including without limitation
/// the rights to use, copy, modify, merge, publish, distribute, sublicense,
/// and/or sell copies of the Software, and to permit persons to whom the
/// Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in
/// all copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
/// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
/// DEALINGS
////
// ----------------------------------------------------------------------------
// Rules
// ----------------------------------------------------------------------------
// Color variables
:root {
// Default color shades
--md-default-fg-color: hsla(0, 0%, 0%, 0.87);
--md-default-fg-color--light: hsla(0, 0%, 0%, 0.54);
--md-default-fg-color--lighter: hsla(0, 0%, 0%, 0.32);
--md-default-fg-color--lightest: hsla(0, 0%, 0%, 0.07);
--md-default-bg-color: hsla(0, 0%, 100%, 1);
--md-default-bg-color--light: hsla(0, 0%, 100%, 0.7);
--md-default-bg-color--lighter: hsla(0, 0%, 100%, 0.3);
--md-default-bg-color--lightest: hsla(0, 0%, 100%, 0.12);
// Primary color shades
--md-primary-fg-color: hsla(#{hex2hsl($clr-indigo-500)}, 1);
--md-primary-fg-color--light: hsla(#{hex2hsl($clr-indigo-400)}, 1);
--md-primary-fg-color--dark: hsla(#{hex2hsl($clr-indigo-700)}, 1);
--md-primary-bg-color: hsla(0, 0%, 100%, 1);
--md-primary-bg-color--light: hsla(0, 0%, 100%, 0.7);
// Accent color shades
--md-accent-fg-color: hsla(#{hex2hsl($clr-indigo-a200)}, 1);
--md-accent-fg-color--transparent: hsla(#{hex2hsl($clr-indigo-a200)}, 0.1);
--md-accent-bg-color: hsla(0, 0%, 100%, 1);
--md-accent-bg-color--light: hsla(0, 0%, 100%, 0.7);
// Light theme (default)
> * {
// Code color shades
--md-code-fg-color: hsla(200, 18%, 26%, 1);
--md-code-bg-color: hsla(0, 0%, 96%, 1);
// Code highlighting color shades
--md-code-hl-color: hsla(#{hex2hsl($clr-yellow-a200)}, 0.5);
--md-code-hl-number-color: hsla(0, 67%, 50%, 1);
--md-code-hl-special-color: hsla(340, 83%, 47%, 1);
--md-code-hl-function-color: hsla(291, 45%, 50%, 1);
--md-code-hl-constant-color: hsla(250, 63%, 60%, 1);
--md-code-hl-keyword-color: hsla(219, 54%, 51%, 1);
--md-code-hl-string-color: hsla(150, 63%, 30%, 1);
--md-code-hl-name-color: var(--md-code-fg-color);
--md-code-hl-operator-color: var(--md-default-fg-color--light);
--md-code-hl-punctuation-color: var(--md-default-fg-color--light);
--md-code-hl-comment-color: var(--md-default-fg-color--light);
--md-code-hl-generic-color: var(--md-default-fg-color--light);
--md-code-hl-variable-color: var(--md-default-fg-color--light);
// Typeset color shades
--md-typeset-color: var(--md-default-fg-color);
// Typeset `a` color shades
--md-typeset-a-color: var(--md-primary-fg-color);
// Typeset `mark` color shades
--md-typeset-mark-color: hsla(#{hex2hsl($clr-yellow-a200)}, 0.5);
// Typeset `del` and `ins` color shades
--md-typeset-del-color: hsla(6, 90%, 60%, 0.15);
--md-typeset-ins-color: hsla(150, 90%, 44%, 0.15);
// Typeset `kbd` color shades
--md-typeset-kbd-color: hsla(0, 0%, 98%, 1);
--md-typeset-kbd-accent-color: hsla(0, 100%, 100%, 1);
--md-typeset-kbd-border-color: hsla(0, 0%, 72%, 1);
// Typeset `table` color shades
--md-typeset-table-color: hsla(0, 0%, 0%, 0.12);
// Admonition color shades
--md-admonition-fg-color: var(--md-default-fg-color);
--md-admonition-bg-color: var(--md-default-bg-color);
// Footer color shades
--md-footer-fg-color: hsla(0, 0%, 100%, 1);
--md-footer-fg-color--light: hsla(0, 0%, 100%, 0.7);
--md-footer-fg-color--lighter: hsla(0, 0%, 100%, 0.3);
--md-footer-bg-color: hsla(0, 0%, 0%, 0.87);
--md-footer-bg-color--dark: hsla(0, 0%, 0%, 0.32);
}
// Shadow depth 1
--md-shadow-z1:
0 #{px2rem(4px)} #{px2rem(10px)} hsla(0, 0%, 0%, 0.05),
0 0 #{px2rem(1px)} hsla(0, 0%, 0%, 0.1);
// Shadow depth 2
--md-shadow-z2:
0 #{px2rem(4px)} #{px2rem(10px)} hsla(0, 0%, 0%, 0.1),
0 0 #{px2rem(1px)} hsla(0, 0%, 0%, 0.25);
// Shadow depth 3
--md-shadow-z3:
0 #{px2rem(4px)} #{px2rem(10px)} hsla(0, 0%, 0%, 0.2),
0 0 #{px2rem(1px)} hsla(0, 0%, 0%, 0.35);
}

2601
docs/css/extra.css Executable file

File diff suppressed because it is too large Load diff

28
docs/css/iopsys-white.svg Normal file
View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 24.2.3, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Lager_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 460 84" style="enable-background:new 0 0 460 84;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<g>
<g>
<rect x="2.8" y="4.3" class="st0" width="16.7" height="76.1"/>
<path class="st0" d="M88.8,3C65.3,3,48.3,20.8,48.3,42.4v0.2c0,21.6,16.9,39.1,40.3,39.1c23.5,0,40.6-17.7,40.6-39.4v-0.2
C129.1,20.5,112.3,3,88.8,3z M111.6,42.6c0,13-9.4,23.7-22.8,23.7c-13.5,0-23-10.9-23-23.9v-0.2c0-13,9.4-23.7,22.8-23.7
c13.5,0,23.1,10.9,23.1,23.9v0.2H111.6z"/>
<path class="st0" d="M271.4,34.9c-13.2-3.4-16.4-5-16.4-10v-0.2c0-3.7,3.4-6.6,9.8-6.6s13,2.8,19.8,7.5l8.7-12.6
c-7.7-6.2-17.2-9.7-28.3-9.7c-15.5,0-26.6,9.1-26.6,22.9v0.2c0,15.1,9.9,19.4,25.2,23.3c12.7,3.3,15.3,5.4,15.3,9.7v0.2
c0,4.5-4.1,7.2-11,7.2c-8.7,0-15.9-3.6-22.7-9.2l-9.9,11.9c9.1,8.2,20.8,12.2,32.3,12.2c16.4,0,27.9-8.5,27.9-23.6v-0.2
C295.5,44.5,286.8,38.9,271.4,34.9z"/>
<polygon class="st0" points="347.3,34.9 329.1,4.3 309.5,4.3 338.8,50.4 338.8,80.4 355.5,80.4 355.5,50.1 384.8,4.3 365.7,4.3
"/>
<path class="st0" d="M432.2,34.9c-13.2-3.4-16.4-5-16.4-10v-0.2c0-3.7,3.4-6.6,9.8-6.6s13,2.8,19.8,7.5l8.7-12.6
c-7.7-6.2-17.2-9.7-28.3-9.7c-15.6,0-26.6,9.1-26.6,22.9v0.2c0,15.1,9.9,19.4,25.2,23.3c12.7,3.3,15.3,5.4,15.3,9.7v0.2
c0,4.5-4.1,7.2-11,7.2c-8.7,0-15.9-3.6-22.7-9.2l-9.9,11.9c9.1,8.2,20.8,12.2,32.3,12.2c16.4,0,27.9-8.5,27.9-23.6v-0.2
C456.3,44.5,447.6,38.9,432.2,34.9z"/>
<path class="st0" d="M186,4.3h-31.5v15.3h30c8.5,0,13.8,4.1,13.8,11.7v0.2c0,6.6-5,11.7-13.4,11.7h-30.4v37.2h16.9V58.3h12.9
c17.3,0,31.1-9.2,31.1-27.1V31C215.5,15.2,204.3,4.3,186,4.3z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

17
docs/css/pdf.css Normal file
View file

@ -0,0 +1,17 @@
@page {
size: a4 portrait;
margin: 25mm 10mm 25mm 10mm;
counter-increment: page;
font-family: 'Madera', 'Lucida Sans Unicode', 'Lucida Grande', sans-serif;
white-space: pre;
color: grey;
@top-left {
content: '© 2022 IOPSYS';
}
@top-center {
content: string(chapter);
}
@top-right {
content: 'Page ' counter(page);
}
}

4
docs/guide/.pages Normal file
View file

@ -0,0 +1,4 @@
title: "Developer Guide"
nav:
- "..."

58
docs/guide/annex_f.md Normal file
View file

@ -0,0 +1,58 @@
# Manageable devices and gateway information (TR069 - Annex F)
The CPE WAN Management Protocol can be used to remotely manage CPE Devices that are connected via a LAN through a Gateway. When an ACS manages both a Device and the Gateway through which the Device is connected, it can be useful for the ACS to be able to determine the identity of that particular Gateway.
> -- <cite> TR-69 Annex F.</cite>
Below is the sequence diagram for the Device-Gateway association with DHCP Discover.
```mermaid
sequenceDiagram
Lan-Device->>+Gateway: DHCP Discover (Device Identity)
Gateway->>Lan-Device: DHCP Offer (Gateway Identity)
Lan-Device->>Gateway: DHCP Request (Device Identity)
Gateway->>-Lan-Device: DHCP ACK (Gateway Identity)
Note left of Lan-Device: Lan-Device Populate GatewayInfo. table
Note right of Gateway: Gateway Populate ManageableDevice.{i}. table
Lan-Device->>ACS: TR069 Inform (with Gateway Identity)
ACS->>Lan-Device: TR069 Inform response
ACS->>Gateway: TR069 Get (ManageableDevice)
Gateway->>ACS: TR069 GetResp (ManageableDevice) table
```
## Gateway Procedures
A Gateway here in this context means, an Annex-F capable CPE running icwmpd which provide LAN/NAT connectivity.
The Gateway Identity tuple (OUI, ProductClass, SerialNumber) is present in 'db' (Same source used for Device.DeviceInfo. object).
The `/etc/init.d/icwmp` script reads the default lan interface from UCI option `cwmp.cpe.default_lan_interface` and configures the gateway identity in `dhcp` UCI for the corresponding LAN interface section to publish gateway information to its LAN clients.
> Note: If UCI option `cwmp.cpe.default_lan_interface` is not defined then gateway identity would not be published in LAN network.
### Identification of Manageable Device in LAN network
Gateway device relies on DHCP options (/tmp/dhcp.client.options) file for getting the Manageable Device identities, which is exposed in the TR181 datamodel using (libbbf) API's.
The Device.ManagementServer.ManageableDevice.{i}. object table is populated for the active devices available in `Device.Hosts.` table and their device identity is collected from `/tmp/dhcp.client.options` file.
## Lan-Device procedures
A Lan-Device here in this context means, an Annex-F capable CPE running icwmpd which is connected via a LAN through a Gateway.
The Lan-Device Identity tuple (OUI, ProductClass, SerialNumber) is present in 'db' (Same source used for Device.DeviceInfo. object).
The `/etc/init.d/icwmp` script reads the default wan interface from UCI option `cwmp.cpe.default_wan_interface` and configures the device identity in `network` UCI to publish its own identity to upstream network (DHCP server) using DHCP option 125 for the corresponding wan interface.
> Note: If UCI option `cwmp.cpe.default_wan_interface` is not defined then it assumes the default interface as `wan`.
### Identification of Gateway Device in WAN network
If lan-device(CPE) receives DHCP option 125 in DHCP offer from upstream network it exposes the same in its UBUS method (e.g. ifstatus wan).
```bash
root@iopsys-44d43771b000:~# ifstatus wan
{
...
...
"data": {
"opt125": "XXXXXXXXXXXXXXXXXXX"
}
}
```
ICWMPD package adds a [DHCP client hook script](https://dev.iopsys.eu/iopsys/icwmp/-/blob/devel/files/etc/udhcpc.user.d/udhcpc_icwmp_opt125.user), which parses DHCP option 125 to extract gateway identity based on Enterprise ID `3561`.
This script then writes the gateway identity in `/var/state/cwmp` if CWMP is enabled in the device.
Datamodel (libbbf) API's reads the gateway information from `/var/state/cwmp` to populate Device.GatewayInfo. object. If gateway information is not available in `/var/state/cwmp` then it reads the 'db' (Same source used for Device.DeviceInfo. object) and maps that data to populate Device.GatewayInfo. object.

54
docs/guide/cli.md Normal file
View file

@ -0,0 +1,54 @@
# icwmpd command line
`icwmpd` command line options are described with `--help` option as below:
```bash
root@iopsys:~# icwmpd --help
Usage: icwmpd [OPTIONS]
-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 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:
```bash
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
```
> Note: icwmpd CLI is a debug utility and hence it is advised to use for debug and development purpose only.
> icwmpd CLI utility is independent of icwmpd daemon.
icwmp CLI command success result is displayed in the terminal as following:
```bash
root@iopsys:~# icwmpd -c get Device.DeviceInfo.UpTime
Device.DeviceInfo.UpTime => 91472
root@iopsys:~# icwmpd -c set Device.WiFi.SSID.1.SSID wifi1_ssid
Set value is successfully done
Device.WiFi.SSID.1.SSID => wifi1_ssid
```
In the case of fault the result is displayed as following:
```bash
root@iopsys:~# icwmpd -c get Device.DeviceInfo.UpTme
Fault 9005: Invalid parameter name
root@iopsys:~# icwmpd -c set
Fault 9003: Invalid arguments
root@iopsys:~# icwmpd -c set Device.WiFi.SSID.1.SSID
Fault 9003: Invalid arguments
```

View file

@ -0,0 +1,19 @@
# Provisioning of CWMP Agent through DHCP Server
If CPE receives DHCP option 43 in DHCP offer from upstream network it exposes the same in its UBUS method (e.g. ifstatus wan).
```bash
root@iopsys-44d43771b000:~# ifstatus wan
{
...
...
"data": {
"vendorspecinf": "XXXXXXXXXXXXXXXXXXX"
}
}
```
CWMP Agent uses DHCP option 43 for provisioning if CWMP and DHCP discovery is enabled in the device. ICWMPD package adds a [DHCP client hook script](https://dev.iopsys.eu/iopsys/icwmp/-/blob/devel/files/etc/udhcpc.user.d/udhcpc_icwmp_opt43.user), which parses DHCP option 43 value to extract informations like ACS URL, minimum interval for session retry, retry interval multiplier for session retry and provisioning code that specifies the primary service provider and other provisioning information, which may be used by the ACS to determine service provider-specific customization and provisioning parameters.
This script then writes the provisioning information in `/etc/config/cwmp`.
CWMP Agent reads the provisioning information from `/etc/config/cwmp` before starting a session.
> Note: If in any time ACS configures `Device.ManagementServer.URL` then DHCP discovery is disabled automatically.

View file

@ -0,0 +1,86 @@
# How to configure icwmp client for HTTPS connection to ACS
In order to keep the connection secure, most customers use HTTPS to connect to ACS.
In this case we need to have an ACS that supports HTTPS, And for that we use GenieACS as an example because it's an open source and supports HTTPS.
Find below the required steps to configure GenieACS server and icwmp client to support HTTPS
## Generating the private key and certificate
1. Generate a private key for the CA:
```bash
root@75f824228409:/opt/genieacs# openssl genrsa 2048 > ca-key.pem
Generating RSA private key, 2048 bit long modulus (2 primes)
...................................................................................+++++
...........................+++++
e is 65537 (0x010001)
```
2. Generate the X509 certificate for the CA:
```bash
root@75f824228409:/opt/genieacs# openssl req -new -x509 -nodes -days 365000 -key ca-key.pem -out ca-cert.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:SE
State or Province Name (full name) [Some-State]:Stockholm
Locality Name (eg, city) []:Stockholm
Organization Name (eg, company) [Internet Widgits Pty Ltd]:IOPSYS
Organizational Unit Name (eg, section) []:IOPSYS
Common Name (e.g. server FQDN or YOUR name) []:genieacs
Email Address []:dev@iopsys.eu
root@75f824228409:/opt/genieacs#
```
> Note: When generating the certificate, you must fill the Common Name filed with the correct URL server (for example here 'genieacs') otherwise you will get an error later when trying to connect to the ACS.
## Installing and Configuring GenieACS environment variables
1. Install GenieACS
You can follow the steps described in this [link](http://docs.genieacs.com/en/latest/installation-guide.html) in order to install GenieACS.
2. Configure GenieACS environment variables to support HTTPS
GenieACS offers a list of environment variables to configure the different features, you can see all the information in detail in this [link](http://docs.genieacs.com/en/latest/environment-variables.html).
In fact, the most important to us are these two variables below to configure the SSL functionality.
```bash
GENIEACS_CWMP_SSL_CERT=/path/to/certificate/file/ca-cert.pem
GENIEACS_CWMP_SSL_KEY=/path/to/certificate/key/file/ca-key.pem
```
## Checking the generated Certificate
You can use `openssl` command to check if there is any error in generated certificate.
```bash
openssl s_client -connect genieacs:7547 -CAfile ca-cert.pem
```
## Configuring DUT to support HTTPS
1. Copy the generated certificate under the needed path (default path is '/etc/ssl/certs/')
```bash
scp /path/of/certificate/ca-cert.pem root@192.168.1.1:/etc/ssl/certs
```
2. Set 'ssl_capath' option in cwmp config with certificate directory path (default path is '/etc/ssl/certs/')
```bash
uci set cwmp.acs.url='https://genieacs:7547'
uci set cwmp.acs.ssl_capath="/etc/ssl/certs"
ubus call uci commit '{"config":"cwmp"}'
```
Now, all required configuration are ready and you can start a cwmp connection using HTTPS.

View file

@ -0,0 +1,96 @@
# Notifications and Inform event
In this article we will discuss about how `icwmpd` manages inform messages and notifications towards ACS server.
## icwmpd forced inform parameters
As per the cwmp inform requirements, cwmp client has list of parameters defined internally. The list contains below parameters:
| 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 standard, TR-181 datamodel defines the multi instance object Device.ManagementServer.InformParameter.{i}.
So new inform parameter can be added through the ACS by the call of the RPC method AddObject for the object Device.ManagementServer.InformParameter.{i}. and then set its parameters values.
icwmpd defines those new inform parameters in uci sections under the package /var/state/cwmp as below:
```bash
root@iopsys-44d43771aff0:~# cat /var/state/cwmp
config inform_parameter
option enable '1'
option parameter_name "Device.DeviceInfo.UpTime"
option events_list '1 BOOT,6 CONNECTION REQUEST'
config inform_parameter
option enable '0'
```
## Notification management
`icwmpd` support below notification types, which can be configured from an ACS on the datamodel parameters
- 0 = Notification off
- 1 = Passive notification
- 2 = Active notification
- 3 = Passive lightweight notification
- 4 = Passive notification with passive lightweight notification
- 5 = Active lightweight notification
- 6 = Passive notification with active lightweight notification
Along with this it does provide some debug utilities to get the notification from the device root shell as well
```bash
root@iopsys:~# icwmpd -c get_notif Device.Users.User.1.Username
Device.Users.User.1.Username => passive
```
To fulfill the requirement of forced active notification parameters, `icwmpd` internally maintains a list of forced active parameters specified in TR181. The list contains below parameters:
| Parameter name | Notification |
| ------------------------------------- |---------------|
| Device.DeviceInfo.SoftwareVersion | 2 |
| Device.DeviceInfo.ProvisioningCode | 2 |
So, Creation of any other type of notification on the above parameters results in a cwmp fault 9009.
Along with this `icwmpd` support configuration of notification parameters using a JSON file. Users can include this json file in there firmware to override the existing notification parameters, or add new notifications from the firmware itself.
Below is the schema/format of the JSON file:
```bash
root@iopsys:~# cat /etc/icwmpd/inform.json
{
"custom_notification": [
{
"parameter": "Device.Users.",
"notify_type": "2"
},
{
"parameter": "Device.WiFi.SSID.1.SSID",
"notify_type": "1"
}
]
}
```
> Note: In the Above example, parameter has to be defined with a valid datamodel parameter name and notify_type needs to be the notification type (number as present in the above table). Both the parameters are required.
After defining the JSON file with all the required parameters, this information required to update cwmp uci as below:
```bash
root@iopsys:~# uci set cwmp.cpe.custom_notify_json=/etc/icwmpd/inform.json
root@iopsys:~# uci commit cwmp
root@iopsys:~# /etc/init.d/icwmpd restart
```
>- ACS can manage the attributes of parameter added by custom_notification as it does for the other parameters
>- After firmware upgrade, for the 1st bootup, the custom_notify_json has higher priority, latter on ACS configured attributes get priority.
>- Addition of custom notification parameters is one time activity after upgrade, once done It can only be managed through ACS.
>- Parameters with wildcard not supported currently. So parameter like Device.WiFi.SSID.*. will be skipped

13
docs/guide/spv_restart.md Normal file
View file

@ -0,0 +1,13 @@
# Handling of SPV and restart services
In case `icwmpd` receives SetParameterValues Request from the ACS, it will use the `setm_values` ubus method of usp daemon(usp.raw ubus object), for all requested parameters.
Based on the response of setm_values the icwmp will do the following:
- in case of fault icwmp aborts the set of all parameters and then sends Response to the ACS with FAULT 9003 including all parameters faults as defined in TR069 standard.
- in case of success icwmp commits the set of all parameters, without applying them so without restarting services, and then sends a success Response to the ACS including the status code 1.
- All required services(whose configuration has been modified by SPV) are restarted at the end of CWMP session in order to prevent any session interruption.
> icwmp always returns 1 as status value in case of success of SPV because all services are restarted at the end of the session.

View file

@ -0,0 +1,45 @@
# Supported RPC Methods
## Overview
In this article we will discuss about the supported TR-069 standard RPCs.
The following 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 | `Yes` |
| `DUStateChangeComplete` | OPTIONAL | `Yes` |
| `AutonomousDUStateChangeComplete` | OPTIONAL | `Yes` |
| `RequestDownload` | OPTIONAL | No |
| `Kicked` | OPTIONAL | No |

83
docs/guide/ubus_method.md Normal file
View file

@ -0,0 +1,83 @@
# UBUS methods
`icwmpd` provides some RPCs support over ubus and some debug utilities those can be accessed using `tr069` ubus object. So, it must be launched on startup after `ubusd`.
> Note: For more info on the `tr069` ubus schema see [link](../api/ubus/tr069.md) or [raw schema](https://dev.iopsys.eu/iopsys/icwmp/-/blob/devel/schemas/ubus/tr069.json)
### tr069 ubus examples
Please note, the output shown in below examples are just for demonstration purpose, the actual output shall vary as per the cwmp configuration and state.
```bash
root@iopsys:~# ubus -v list tr069
'tr069' @aadff65c
"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:
```bash
root@iopsys:~# ubus call tr069 status
{
"cwmp": {
"status": "up",
"start_time": "2021-07-29T09:29:02+02:00",
"acs_url": "http://genieacs:7547"
},
"last_session": {
"status": "success",
"start_time": "2021-07-29T09:29:59+02:00",
"end_time": "2021-07-29T09:30:00+02:00"
},
"next_session": {
"status": "waiting",
"start_time": "2021-07-29T09:59:59+02:00",
"end_time": "N/A"
},
"statistics": {
"success_sessions": 2,
"failure_sessions": 0,
"total_sessions": 2
}
}
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:
```bash
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:
```bash
root@iopsys:~# ubus call tr069 command '{"command":"reload"}'
{
"status": 1,
"info": "icwmpd config reloaded"
}
root@iopsys:~#
```

27
docs/guide/workflow.md Normal file
View file

@ -0,0 +1,27 @@
## Concepts and Workflow
In OpenWRT integration, `icwmpd` depends on `procd` based init script `/etc/init.d/icwmpd` to start it in boot-up. Once started, it reads the initial configuration from UCI and if configured connects to the ACS.
Provisioning of the ACS URL can be done in `icwmpd` with a firmware default uci value, or it can be done dynamically using DHCP Option 43 on the configured default_wan_interface.
ACS Session workflow could be checked with sniffer packets tool such as Wireshark or `tcpdump`.
In addition to that, `icwmpd` give provision to configure a log file in uci.
A snapshot of log description is listed below for demonstration(Content of the log can vary based on configuration):
```bash
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
```
Further, it provides different log level that can be configured in uci config `cwmp.cpe.log_severity` to get more verbose log to no logs.

90
docs/mkdocs.yml Executable file
View file

@ -0,0 +1,90 @@
site_name: Documentation Instructions
site_url: https://docs.iopsys.se/portal2/icwmp/
edit_uri: "https://dev.iopsys.eu/docs/portal2/icwmp"
site_description: IOWRT Technical Documentation
site_author: IOPSYS
docs_dir: '.'
site_dir: 'site'
theme:
name: material
include_sidebar: true
highlightjs: true
hljs_languages:
- yaml
- python
language: en
font:
text: Roboto
code: Roboto Mono
logo: iopsys-white.svg
icon:
logo: icon.png
repo: fontawesome/brands/gitlab
extra:
social:
- icon: fontawesome/brands/github-alt
link: https://github.com/squidfunk
features:
- toc.autohide
- navigation.tabs
- navigation.tabs.sticky
- navigation.top
- navigation.tracking
- navigation.expand
palette:
# Primary color used for header, sidebar and links, default: indigo
primary: black
# Accent color for highlighting user interaction, default: indigo
accent: deep orange
extra_css:
- css/extra.css
- https://unpkg.com/mermaid@8.5.1/dist/mermaid.css
- https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css
extra_javascript:
- https://unpkg.com/mermaid/dist/mermaid.min.js
- https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js
- https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js
markdown_extensions:
- meta
- admonition
- pymdownx.arithmatex
- pymdownx.betterem:
smart_enable: all
- pymdownx.caret
- pymdownx.critic
- pymdownx.details
- pymdownx.emoji:
emoji_index: !!python/name:materialx.emoji.twemoji
emoji_generator: !!python/name:materialx.emoji.to_svg
- pymdownx.inlinehilite
- pymdownx.magiclink
- pymdownx.mark
- pymdownx.smartsymbols
- pymdownx.tasklist:
custom_checkbox: true
- pymdownx.tilde
- pymdownx.superfences:
# make exceptions to highlighting of code:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:mermaid2.fence_mermaid
- fontawesome_markdown
plugins:
- search:
lang:
- en
separator: '[\s\-\.]+'
- awesome-pages:
collapse_single_pages: true
- mermaid2
- section-index

10
docs/preview.sh Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Copy README.md as index.md and change links
pip install -r requirements.txt
# Copy README.md as index.md and change links
sed -r -e 's![\.\/]*docs[\/]*!./!g' ../README.md > index.md
# Start mkdocs local server
mkdocs serve -f mkdocs.yml

7
docs/requirements.txt Executable file
View file

@ -0,0 +1,7 @@
mkdocs
mkdocs-material
mkdocs-awesome-pages-plugin
mkdocs-section-index
fontawesome_markdown
mkdocs-print-site-plugin
mkdocs-mermaid2-plugin

4
docs/spec/.pages Normal file
View file

@ -0,0 +1,4 @@
title: "Specifications"
nav:
- "..."

4
docs/spec/spec.md Normal file
View file

@ -0,0 +1,4 @@
# Specification
- `icwmpd` client implementation is done based on TR069 Spec. For more details follow the [link](https://www.broadband-forum.org/technical/download/TR-069.pdf).
- It supports the data models that are defined by Broadband Forum. To see the list of data model parameters click [here](https://cwmp-data-models.broadband-forum.org/tr-181-2-15-1-cwmp.html).