Skip to main content

Infrastructure Code Generator: now complete and highly extensible

The Infrastructure Code Generator (ICG) is the PIACERE component that allows generating executable infrastructural code (IaC) from models written in DevSecOps Modelling Language (DOML).

In the PIACERE workflow, the ICG receives the DOML from the IDE (Integrated Development Environment) and generates IaC and configuration files that will be executed by the IEM (IaC Execution Manager).

The ICG is made up by different components that subsequently transform the DOML into the desired output, these components are the following: the Parser extracts from the DOML the data and write them into the ICG intermediate representation (IR), the Controller chooses the Plugin to use, the Plugins take the IR and generate the IaC in the language they are responsible for.

infrastructure code

The main functionalities for the Infrastructural Code Generator are the following:

  1. Read the input DOML model to extract all the needed information
  2. Generate executable code for selected IaC languages
  3. Provide enough extensibility to support the DOML extension mechanism
  4. Provide enough extensibility to generate code for new IaC languages
  5. Generate IaC code that supports different cloud platforms

In the first ICG prototype the functionalities 2 and 5 were implemented and in the current version have been improved. In the current version of ICG, functionalities 1 and 4 have been added producing a complete functioning tool. The main update is the development of the Parser, which navigates the DOML model using the PyEcore Python library and identifies, extracts and reorders the information required by the other ICG components.

Another important improvement introduced involves the extensibility of the ICG. Compared to the first prototype the introduction of new languages, providers and templates is simpler and more flexible. The ICG accepts these new features just updating a dedicated configuration file.

Taking advantage of this new capability, the introduction of another provider in the ICG to setup a new application has been tested.

In the first prototype an example of IaC generated by ICG has been deployed on Azure Cloud simulating the creation of a Wordpress application using MySQL database. For the current version of ICG, a new example has been generated to test the extensibility. The new provider OpenStack has been added and a new application, nginx, was deployed on this provider. To realize this extension, a new template has been developed and the required references have been added in the configuration file.

Another important update is that ICG is now available in a Docker container, exposing REST APIs for the communication with other PIACERE components. The IDE sends the DOML XML model to the ICG, invoking the API, and receives as response all the files required for the provisioning of the infrastructure and the deployment of the required application.

The next planned version of the ICG will be more integrated with other PIACERE components to show the whole workflow of the framework.

Share this post

Comments (0)