## Integration of the lighty.io with the CCSDK These artifacts contain the examples of how can be the CCSDK integrated with the lighty.io. This integration removes the dependency on the OSGi framework (Karaf) and the Blueprint dependency injection - instead it uses only the plain java like _main_ method to start the application and plain java constructors as DI (but it is ready to be integrated with other frameworks). The CCSDK lighty.io modules can be all started at once (as in this example) or only the selected group of them - in case there is no need to run them all. For more information about the lighty.io visit the official web-page [https://lighty.io](https://lighty.io) or the [GitHub repository](https://github.com/PantheonTechnologies/lighty-core). ### Artifact `ccsdk-lighty-module` The artifact `ccsdk-lighty-module` contains implementation of the lighty.io module that groups all the other lighty.io modules from the other repositories (core, adaptors, plugins, northbound). These grouped modules can be started all at once using just a few lines of code. In addition it contains implementation of the lighty.io module that groups the lighty.io controller (base services from the ODL), the RESTCONF lighty.io module (the RESTCONF from the ODL integrated with the lighty.io) and the CCSDK lighty.io module ### Artifact `ccsdk-lighty-distribution` The CCSDK lighty.io application can be started via _main_ method from the _Main_ class. This artifact generates the _.zip_ file containing the _.jar_ file and all other necessary libraries. The path to the lighty.io configuration file can be passed to the _main_ method (or to the _.jar_ file) as an argument. This configuration file contains configuration for the lighty.io controller and the RESTCONF (for example the port or the IP address where should the RESTCONF listen or the yang modules that should be imported into the application). The example of the configuration file can be found in the _resources_ directory. If path to the configuration file will not be passed through the _main_ method then the default configuration will be used. ### Artifact `distribution-lighty-ubuntu-docker` The artifact `distribution-lighty-ubuntu-docker` contains the _Dockerfile_ and the _docker-compose.yml_ files for the CCSDK lighty.io. _Dockerfile_ is very similar to the original file from the `distribution-odlsli-ubuntu` artifact and the _docker-compose.yml_ to the original file from the `src/main/yaml` directory in the root of this repository. Necessary configuration files and the _.zip_ file containing the CCSDK lighty.io application are copied by the maven plugins into the respective directories during the the maven build. The _Dockerfile_ unpacks the _.zip_ distribution generated by the `ccsdk-lighty-distribution` artifact and runs the _startODL.sh_ script that starts the CCSDK lighty.io _.jar_ file using the `src/main/properties/lightyCcsdkConfig.json` configuration file. The _docker-compose.yml_ file contains three images - database, CCSDK lighty.io application and the _DG builder_. ### How to run In order to run the CCSDK lighty.io application build the `distribution-lighty` repository using the maven with the _docker_ profile enabled (command: `mvn clean install -P docker`). Then run the _docker-compose_ from the `src/main/docker` directory (command: `docker-compose -f docker-compose.yml up`). After a few seconds CCSDK lighty.io application should be up and running together with the database and the _DG builder_. _DG builder_ web UI can be accessed through the `http://localhost:3000` address and RESTCONF at the `http://localhost:8383/restconf` address. #### DG Builder and the CCSDK lighty.io application example In the browser open the `localhost:3000` URL. Login with the default username `dguser` and the password `test123`. In the top right corner click on the menu -> import -> Clipboard. Copy and paste the content of the `hello_world.json` file (from the same directory where is this readme file located) to the text box. Then click on the OK button and place the graph to the sheet. To upload and activate the imported graph click on the small empty square on the left side of the `DGSTART` node and then click on the `Upload XML` button. Then click on the `ViewDG List` button and on the `Activate` link in the row where imported graph is. After the graph is activated it can be called using the POST REST request on the address: `http:///restconf/operations/SLI-API:execute-graph` With the body like: ``` { "input": { "module-name": "", "rpc-name": "", "mode": "sync", "sli-parameter": [ ] } } ``` So in order to call imported _hello world_ graph send the POST request to the address: `http://localhost:8383/restconf/operations/SLI-API:execute-graph` with the body: ``` { "input": { "module-name": "Test", "rpc-name": "helloWorld", "mode": "sync", "sli-parameter": [ ] } } ``` Now the _hello world_ message should be displayed in the console where the CCSDK lighty.io application is running.