Solution Strategy

The MDD approach developed is focused on developing applications to run on top of AGL. The AGL architecture specifies different layers of abstraction and the MDD workflows shall be compliant with this architecture. Therefore, the MDD process presented in this work focuses on the development of AGL Services that use AGL’s Applications Framework APIs.

AGL services expose functionality to all the applications that might run on top [32]. To be more specific AGL services are implemented as systemd user-defined services in AGL. The way they expose the functionality is exposing a RESTfull API through a Web Sockets (or dbus). Meaning that in order to access functionality exposed by an AGL service, the application has to open a Web Socket use the RESTfull API.

The MDD approach presented in this document focuses in defining a model of the RESTfull API. The model is then used as an input for automatically generate the communication components of both the AGL service and the AGL application.

For modeling the RESTfull API, RAML was used. RAML is a recently developed community standard that has already been widely adopted in other projects like; API Workbench and API Designer [17]. It’s a markup language based in YAML, which makes it both; machine readable and human readable.

raml2agl is written in Python (Python 3), which makes it really fast to develop and portable. Although Python has already two reference implementations of a RAML parser called pyraml-parser [13] and ramlifications (developed by Spotify) [36], they were not used for developing raml2agl since they only support RAML 0.8 and raml2agl plans to support RAML 1.0. Therefore, a custom RAML 1.0 parser was designed and implemented. ramlifications plans to support RAML 1.0 in the future. [36] Therefore, raml2agl could adopt it in the future.

Another reason to use Python to write raml2agl is the variety of already implemented components. Especially the support for Jinja2 templating language was of high importance here. Jinja2 is a very powerful and complete templating language with bindings for Python. [35] The code generation was implemented using Jinja2 templates, which makes the code generation highly flexible and fast to develop.

The final outcome of the automatic code generation is a set of C++ classes that implement the entire RESTfull API communication. Moreover, simple C++ classes methods abstract the complex Web Socket handling and RESTfull API message marshaling and unmarshaling. This approach can be compared with other projects like Google’s protobuffer [25] that aims to automatically generate the communication components.

[13]Pyraml. URL: https://github.com/an2deg/pyraml-parser.
[17]Raml projects. URL: https://raml.org/projects.
[25]Google. Protobuffers. URL: https://developers.google.com/protocol-buffers/.
[32]Automotive Grade Linux. Automotive grade linux requirements specifications. May 2015. URL: http://docs.automotivelinux.org/docs/architecture/en/dev/reference/AGL_Specifications/agl_spec_v1.0_final.pdf.
[35]Armin Ronacher. Welcome to Jinja2. URL: http://jinja.pocoo.org/docs/2.10/.
[36](1, 2) Spotify. Ramlfications. URL: https://github.com/spotify/ramlfications.