The C3PO (Converter of OPen API SPecification to WoT Objects) translates OpenAPI specification (both versions 2 and 3) to W3C WoT Thing Descriptions and deploys them as a Web Thing proxy of the real application.
This application can be deployed as a Docker container. If you do not have Docker installed yet, follow the instructions here.You can check your current Docker version using the following commands:
$ docker version
In order to build and run the container from DockerHub:
$ docker run -p 3333:3333 -p 3334:3334 --name c3po --network host ivanzy/c3po:1.1
To install all dependencies of the C3PO and deploy it execute the following commands:
$ git clone --recurse-submodules https://github.com/UniBO-PRISMLab/c3po.git
$ npm install
$ npm run build
$ npm run start
To test if C3PO is running correctly, check your browser at http://localhost:3334/api-docs/.
C3PO configurations are defined in the config.json file
{
"translator": {
"host": "localhost",
"port": 3334
},
"wot": {
"http": { "host": "localhost", "port": 3333 },
"mqtt": { "broker": "localhost", "port": 1883 },
"coap": { "host": "localhost", "port": 5683 }
},
"cache": {
"enable": false,
"host": "localhost",
"port": 6379,
"manager": { "host": "localhost", "port": 1883 }
},
"logLevel": "info"
}
- translator: the port and hots that C3PO will run execute.
- wot: the port and host for accessing the Web Things created for each different protocol binding.
- cache: if enabled (enable: true), it will connect to a redis host in the specified address
- logLevel: the log level of the adapter. The default is "info", choose "debug" for more details or "warning" for less.