swmodd uBus

It exposes the SoftwareModules datamodel objectes over ubus. The swmodd registers swmodules namespaces with ubus, that has the shown below functionalities:

root@iopsys:~# ubus -v list swmodules
'swmodules' @19113d4c
        "ee_list":{}
        "reload":{}
        "du_list":{"eeid":"Integer","ee_name":"String"}
        "eu_list":{"eeid":"Integer","ee_name":"String"}
        "du_install":{"eeid":"Integer","ee_name":"String","uuid":"String","url":"String","username":"String","password":"String"}
        "du_update":{"eeid":"Integer","ee_name":"String","uuid":"String","url":"String","username":"String","password":"String"}
        "du_uninstall":{"eeid":"Integer","ee_name":"String","du_name":"String"}
        "eu_set_state":{"eeid":"Integer","ee_name":"String","eu_name":"String","state":"Boolean"}
        "ee_set_state":{"eeid":"Integer","ee_name":"String","state":"String"}
root@iopsys:~#

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

swmodd ubus examples

The outputs shown below are just an example, it can vary on each system. Long outputs are truncated to beautify the document.

List down the available execution environments

root@iopsys:~# ubus call swmodules ee_list
{
        "environment": [
                {
                        "ee_name": "OpenWRT_Linux",
                        "eeid": 1,
                        "status": "Up",
                        "pause": 0,
                        "autoboot": 1,
                        "type": "Virtual_EE",
                        "vendor": "iopsys-eca940fff680",
                        "version": "4.19.235",
                        "allocated_disk_space": 27632,
                        "available_disk_space": 26716,
                        "allocated_memory": 1014988,
                        "available_memory": 476840,
                        "parent_ee_ref": 0
                }
        ]
}
root@iopsys:~#

Install new application container as deployment unit

This requires support to pull images from container registry.

root@iopsys:~# ubus call swmodules du_install '{"url":"docker://httpd:latest"}'
{
        "status": true
}
root@iopsys:~#

List available deployment units/installed services

root@iopsys:~# ubus call swmodules du_list
{
        "deployment_unit": [
                {
                        "du_name": "httpd",
                        "ee_name": "OpenWRT_Linux",
                        "eeid": 1,
                        "uuid": "347dd4bf-6b51-4d62-be61-77c8ded98698",
                        "duid": "w0t0000",
                        "url": "docker://httpd:latest",
                        "version": "",
                        "config": "",
                        "description": "",
                        "du_status": "Installed",
                        "eu_name": "httpd",
                        "vendor": ""
                }
        ]
}
root@iopsys:~#

List execution units/running services

root@iopsys:~# ubus call swmodules eu_list
{
        "execution_unit": [
                {
                        "eu_name": "httpd",
                        "command": "",
                        "state": "Active",
                        "config": "",
                        "version": "4.19.235",
                        "description": "This is a CRUN container",
                        "ee_name": "OpenWRT_Linux",
                        "eeid": 1,
                        "euid": "22728",
                        "disk_space": 91840,
                        "memory_space": 1014988,
                        "vendor": "umoci-default",
                        "req_state": "Active",
                        "autostart": true,
                        "du_name": "httpd"
                }
        ]
}