From 33ba4343ccf24e7f7c7edffbf3bfc22063f3d20a Mon Sep 17 00:00:00 2001 From: vdutta Date: Thu, 3 Jun 2021 13:10:24 +0530 Subject: [PATCH] Added ubus schema for tr069 --- README.md | 5 +- docs/api/tr069.md | 553 ++++++++++++++++++++++++++++++++++++++++ schemas/ubus/tr069.json | 206 +++++++++++++++ 3 files changed, 763 insertions(+), 1 deletion(-) create mode 100644 docs/api/tr069.md create mode 100644 schemas/ubus/tr069.json diff --git a/README.md b/README.md index bd1392c..0b6e2ac 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ config lwn 'lwn' option port '' ``` -For more info on the `cwmp` UCI configuration see [link](./docs/api/uci.cwmp.md) +For more info on the `cwmp` UCI configuration see [link](./docs/api/uci.cwmp.md) or [raw schema](./schemas/uci/cwmp.json) ## RPCs Method supported @@ -112,6 +112,9 @@ You could set the uci config `cwmp.cpe.log_severity` option to `'DEBUG'` in orde 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](./docs/api/tr069.md) or [raw schema](./schemas/ubus/tr069.json) + +### tr069 ubus examples ```bash root@iopsys:~# ubus -v list tr069 'tr069' @04d3de4e diff --git a/docs/api/tr069.md b/docs/api/tr069.md new file mode 100644 index 0000000..f26d10d --- /dev/null +++ b/docs/api/tr069.md @@ -0,0 +1,553 @@ +# tr069 Schema + +``` +https://www.iopsys.eu/tr069.json +``` + +| Custom Properties | Additional Properties | +| ----------------- | --------------------- | +| Forbidden | Forbidden | + +# tr069 + +| List of Methods | +| ------------------- | +| [command](#command) | Method | tr069 (this schema) | +| [inform](#inform) | Method | tr069 (this schema) | +| [status](#status) | Method | tr069 (this schema) | + +## command + +### Ubus method to define cwmp client action + +`command` + +- type: `Method` + +### command Type + +`object` with following properties: + +| Property | Type | Required | +| -------- | ------ | ------------ | +| `input` | object | **Required** | +| `output` | object | Optional | + +#### input + +`input` + +- is **required** +- type: `object` + +##### input Type + +`object` with following properties: + +| Property | Type | Required | +| --------- | ------ | ------------ | +| `command` | string | **Required** | + +#### command + +CWMP supported commands + +`command` + +- is **required** +- type: reference + +##### command Type + +`string` + +The value of this property **must** be equal to one of the [known values below](#command-known-values). + +##### command Known Values + +| Value | +| ------------------ | +| reload_end_session | +| reload | +| reboot_end_session | +| action_end_session | +| exit | + +### Ubus CLI Example + +``` +ubus call tr069 command {"command":"reboot_end_session"} +``` + +### JSONRPC Example + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "method": "call", + "params": ["", "tr069", "command", { "command": "reboot_end_session" }] +} +``` + +#### output + +`output` + +- is optional +- type: `object` + +##### output Type + +`object` with following properties: + +| Property | Type | Required | +| -------- | ------- | ------------ | +| `info` | string | Optional | +| `status` | integer | **Required** | + +#### info + +`info` + +- is optional +- type: `string` + +##### info Type + +`string` + +#### status + +`status` + +- is **required** +- type: `integer` + +##### status Type + +`integer` + +### Output Example + +```json +{ "status": -14386015, "info": "qui anim" } +``` + +## inform + +### Ubus method to handle RPC + +`inform` + +- type: `Method` + +### inform Type + +`object` with following properties: + +| Property | Type | Required | +| -------- | ------ | ------------ | +| `input` | object | **Required** | +| `output` | object | Optional | + +#### input + +`input` + +- is **required** +- type: `object` + +##### input Type + +`object` with following properties: + +| Property | Type | Required | +| --------------- | ------- | -------- | +| `GetRPCMethods` | boolean | Optional | +| `event` | string | Optional | + +#### GetRPCMethods + +If enabled, sends GetRPCMethods to acs + +`GetRPCMethods` + +- is optional +- type: `boolean` + +##### GetRPCMethods Type + +`boolean` + +#### event + +CWMP ubus supported events + +`event` + +- is optional +- type: reference + +##### event Type + +`string` + +The value of this property **must** be equal to one of the [known values below](#inform-known-values). + +##### event Known Values + +| Value | +| ---------------------- | +| 1 BOOT | +| 2 PERIODIC | +| 3 SCHEDULED | +| 4 VALUE CHANGE | +| 6 CONNECTION REQUEST | +| 8 DIAGNOSTICS COMPLETE | + +### Ubus CLI Example + +``` +ubus call tr069 inform {"GetRPCMethods":true,"event":"8 DIAGNOSTICS COMPLETE"} +``` + +### JSONRPC Example + +```json +{ + "jsonrpc": "2.0", + "id": 0, + "method": "call", + "params": ["", "tr069", "inform", { "GetRPCMethods": true, "event": "8 DIAGNOSTICS COMPLETE" }] +} +``` + +#### output + +`output` + +- is optional +- type: `object` + +##### output Type + +`object` with following properties: + +| Property | Type | Required | +| -------- | ------- | -------- | +| `info` | string | Optional | +| `status` | integer | Optional | + +#### info + +`info` + +- is optional +- type: `string` + +##### info Type + +`string` + +#### status + +`status` + +- is optional +- type: `integer` + +##### status Type + +`integer` + +### Output Example + +```json +{ "status": 10889093, "info": "occaecat" } +``` + +## status + +### Get CWMP running status + +List down cwmp status with last session, next session and session statistics details + +`status` + +- type: `Method` + +### status Type + +`object` with following properties: + +| Property | Type | Required | +| -------- | ------ | ------------ | +| `input` | object | **Required** | +| `output` | object | **Required** | + +#### input + +`input` + +- is **required** +- type: `object` + +##### input Type + +`object` with following properties: + +| Property | Type | Required | +| -------- | ---- | -------- | +| None | None | None | + +### Ubus CLI Example + +``` +ubus call tr069 status {} +``` + +### JSONRPC Example + +```json +{ "jsonrpc": "2.0", "id": 0, "method": "call", "params": ["", "tr069", "status", {}] } +``` + +#### output + +`output` + +- is **required** +- type: `object` + +##### output Type + +`object` with following properties: + +| Property | Type | Required | +| -------------- | ------ | ------------ | +| `cwmp` | object | **Required** | +| `last_session` | object | **Required** | +| `next_session` | object | **Required** | +| `statistics` | object | **Required** | + +#### cwmp + +`cwmp` + +- is **required** +- type: `object` + +##### cwmp Type + +`object` with following properties: + +| Property | Type | Required | +| ------------ | ------ | ------------ | +| `acs_url` | string | **Required** | +| `start_time` | string | **Required** | +| `status` | string | **Required** | + +#### acs_url + +`acs_url` + +- is **required** +- type: `string` + +##### acs_url Type + +`string` + +#### start_time + +`start_time` + +- is **required** +- type: `string` + +##### start_time Type + +`string` + +#### status + +`status` + +- is **required** +- type: `string` + +##### status Type + +`string` + +#### last_session + +`last_session` + +- is **required** +- type: `object` + +##### last_session Type + +`object` with following properties: + +| Property | Type | Required | +| ------------ | ------ | ------------ | +| `end_time` | string | **Required** | +| `start_time` | string | **Required** | +| `status` | string | **Required** | + +#### end_time + +`end_time` + +- is **required** +- type: `string` + +##### end_time Type + +`string` + +#### start_time + +`start_time` + +- is **required** +- type: `string` + +##### start_time Type + +`string` + +#### status + +`status` + +- is **required** +- type: `string` + +##### status Type + +`string` + +#### next_session + +`next_session` + +- is **required** +- type: `object` + +##### next_session Type + +`object` with following properties: + +| Property | Type | Required | +| ------------ | ------ | ------------ | +| `end_time` | string | **Required** | +| `start_time` | string | **Required** | +| `status` | string | **Required** | + +#### end_time + +`end_time` + +- is **required** +- type: `string` + +##### end_time Type + +`string` + +#### start_time + +`start_time` + +- is **required** +- type: `string` + +##### start_time Type + +`string` + +#### status + +`status` + +- is **required** +- type: `string` + +##### status Type + +`string` + +#### statistics + +`statistics` + +- is **required** +- type: `object` + +##### statistics Type + +`object` with following properties: + +| Property | Type | Required | +| ------------------ | ------- | ------------ | +| `failure_sessions` | integer | **Required** | +| `success_sessions` | integer | **Required** | +| `total_sessions` | integer | **Required** | + +#### failure_sessions + +`failure_sessions` + +- is **required** +- type: `integer` + +##### failure_sessions Type + +`integer` + +- minimum value: `0` + +#### success_sessions + +`success_sessions` + +- is **required** +- type: `integer` + +##### success_sessions Type + +`integer` + +- minimum value: `0` + +#### total_sessions + +`total_sessions` + +- is **required** +- type: `integer` + +##### total_sessions Type + +`integer` + +- minimum value: `0` + +### Output Example + +```json +{ + "cwmp": { "status": "Ut ipsum in", "start_time": "esse id nostrud minim aliquip", "acs_url": "qui sit amet" }, + "last_session": { + "status": "nisi dolor quis consectetur aliqua", + "start_time": "sint exercitation dolor", + "end_time": "commodo" + }, + "next_session": { "status": "occaecat", "start_time": "officia", "end_time": "adipisicing" }, + "statistics": { "success_sessions": 97229034, "failure_sessions": 38595887, "total_sessions": 8351784 } +} +``` diff --git a/schemas/ubus/tr069.json b/schemas/ubus/tr069.json new file mode 100644 index 0000000..3e7660b --- /dev/null +++ b/schemas/ubus/tr069.json @@ -0,0 +1,206 @@ +{ + "definitions": { + "command_t": { + "type": "string", + "description": "CWMP supported commands", + "enum": [ + "reload_end_session", + "reload", + "reboot_end_session", + "action_end_session", + "exit" + ] + }, + "event_t": { + "type": "string", + "description": "CWMP ubus supported events", + "enum": [ + "1 BOOT", + "2 PERIODIC", + "3 SCHEDULED", + "4 VALUE CHANGE", + "6 CONNECTION REQUEST", + "8 DIAGNOSTICS COMPLETE" + ] + } + }, + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://www.iopsys.eu/tr069.json", + "type": "object", + "title": "tr069", + "object": "tr069", + "additionalProperties": false, + "properties": { + "status": { + "title": "Get CWMP running status", + "description": "List down cwmp status with last session, next session and session statistics details", + "type": "object", + "properties": { + "input": { + "type": "object", + "properties": {} + }, + "output": { + "type": "object", + "properties": { + "cwmp": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "start_time": { + "type": "string" + }, + "acs_url": { + "type": "string" + } + }, + "required": [ + "status", + "start_time", + "acs_url" + ] + }, + "last_session": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "start_time": { + "type": "string" + }, + "end_time": { + "type": "string" + } + }, + "required": [ + "status", + "start_time", + "end_time" + ] + }, + "next_session": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "start_time": { + "type": "string" + }, + "end_time": { + "type": "string" + } + }, + "required": [ + "status", + "start_time", + "end_time" + ] + }, + "statistics": { + "type": "object", + "properties": { + "success_sessions": { + "type": "integer", + "minimum": 0 + }, + "failure_sessions": { + "type": "integer", + "minimum": 0 + }, + "total_sessions": { + "type": "integer", + "minimum": 0 + } + }, + "required": [ + "success_sessions", + "failure_sessions", + "total_sessions" + ] + } + }, + "required": [ + "cwmp", + "last_session", + "next_session", + "statistics" + ] + } + }, + "required": [ + "input", + "output" + ] + }, + "command": { + "title": "Ubus method to define cwmp client action", + "type": "object", + "required": [ + "input" + ], + "properties": { + "input": { + "type": "object", + "required": [ + "command" + ], + "properties": { + "command": { + "$ref": "#/definitions/command_t" + } + } + }, + "output": { + "type": "object", + "properties": { + "status": { + "type": "integer" + }, + "info": { + "type": "string" + } + }, + "required": [ + "status" + ] + } + } + }, + "inform": { + "title": "Ubus method to handle RPC", + "type": "object", + "required": [ + "input" + ], + "properties": { + "input": { + "type": "object", + "properties": { + "GetRPCMethods": { + "type": "boolean", + "description": "If enabled, sends GetRPCMethods to acs" + }, + "event": { + "$ref": "#/definitions/event_t" + } + } + }, + "output": { + "type": "object", + "properties": { + "status": { + "type": "integer" + }, + "info": { + "type": "string" + } + } + } + } + } + } +}