OSATE 2 on the command-line

From AadlWiki

Jump to: navigation, search

This page provides guidelines to use OSATE with a command line interface. For further information, please contact Etienne Borde (etienne.borde@telecom-paristech.fr).


Contents

Prerequisites

a - proceed to installation of osage sources, as specified here:

https://wiki.sei.cmu.edu/aadl/index.php/Getting_Osate_2_sources (only steps "Getting the Eclipse and XText environment" and "Getting the sources of Osate 2" are necessary for this tutorial).

b - Install ATL/EMFTVM

From the Eclipse market place, install the ATL/EMFTVM version 3.6.0

Download sources

Invoke the following commands in a shell in order to retreive sources:

   $mkdir sources

a - Download sources of OSATE (develop branch):

   $git clone https://github.com/osate/osate2-core.git 

b - Download sources of AADLBA-FrontEnd and AADLUtils:

   $git clone https://github.com/osate/osate2-ba.git

c - Download RAMSES sources

   $git clone https://github.com/ramses-project/ramses.git

Import sources in your Eclipse workspace

Import sources in your Eclipse workspace, as described in following pictures : Click on File → Import…

Image:Menu_File_Import.png

Select General → Existing Projects into Workspace and click on Next.

Image:Select_Import_Existing_Project.png

Select the folders "sources", and click on open. The "sources" folder should contain source code of OSATE (folder osate2-core), AADLBA-FronEnd (folder osate2-ba) and RAMSES (folder ramses).

Select all existing projects and click on Finish.

Image:Select_All_Projects.png

Wait until « build workspace » finishes.

Note 1 : you might have errors with project org.osate.core.tests, but you can ignore them in this tutorial: just close this project.

Note 2 : you might have errors with « .mwe2 » files in osate projects, but you can ignore them in this tutorial.

Launch OSATE Command Line Interface

Once the code of OSATE, AADLBA-FronEnd, AADLUtils and RAMSES are compiled, you can launch OSATE with the command line interface. A set of examples have been added in the Eclipse projects you have dowloaded at step 1-a.

For instance, to know the options of OSATE with a command line interface, launch the « help » Eclipse launch configuration as follows: Click on Run → Run configurations…

Image:Menu_Run_Configurations.png

Select Eclipse Applications → test_help and select the Plug-ins tab, and Deselect all the Target Platform plugins.

Image:Command_Line_Example_osgi.png

Click on "Add Required Plug-ins"

Then click on "Validate Plug-ins". You should have something like this:

Image:Plugins_Dependencies_Validation.png

Select missing plug-ins (with the required version) from the list of "Target Platform" plug-ins. Once all the required plug-ins have been added, click on run.

The result of this execution displays (in the concole view of Eclipse) the set of available options in order to use OSATE with the CLI :


  info: 
General Configuration Usage:

[-h|--help] [--parse] [(-l|--log) <logging>] (-m|--model) source_models1,source_models2,...,source_modelsN  [(-i|--include) include_directories1,include_directories2,...,include_directoriesN ] [--analysis] [-a[:analysis_list1,analysis_list2,...,analysis_listN ]] [(-s|--system) <system_to_instantiate>] [(-o|--output) <output_directory>] [(-g|--generation) <target_platform>] [(-r|--runtime-path) <runtime_path>] [--workflow <workflow_path>] [(-p|--parameter) key=value1,key=value2,...,key=valueN ]

  [-h|--help]
        Print help for usage

  [--parse]
        Only parse input models

  [(-l|--log) <logging>]
        enable the logging file and set the level (all | trace | debug | info |
        warn | error | fatal

  (-m|--model) source_models1,source_models2,...,source_modelsN 
        List of input aadl files

  [(-i|--include) include_directories1,include_directories2,...,include_directoriesN ]
        List of path to find input models

  [--analysis]
        Parse, instantiate and analyze the instance model

  [-a[:analysis_list1,analysis_list2,...,analysis_listN ]]
        List of analysis to be performed on instance model; available analysis
        identifiers are: 

  [(-s|--system) <system_to_instantiate>]
        Name of the system to instantiate in input aadl files

  [(-o|--output) <output_directory>]
        Directory where files will be generated

  [(-g|--generation) <target_platform>]
        Targeted platform for code generation (pok, etc.).

  [(-r|--runtime-path) <runtime_path>]
        Path to the targeted platform runtime

  [--workflow <workflow_path>]
        The specified ecore file contains the workflow

  [(-p|--parameter) key=value1,key=value2,...,key=valueN ]
        additional parameters given as key=value format

Read the different options proposed by RAMSES and configure your own launch to either generate code or perform some analysis.

Integrate your OSATE plugin in the Command Line Interface

Create a new eclipse plugin project. There are three artefacts this project should contain in order to be register in the CLI version of osate:

1) a plugin.xml file 2) a factory for your analysis or code generation tool 3) the analysis or code generation entry point

To guide you in this process, we consider the case of an analysis plugin we have developped on OSATE, and we want to execute with a CLI. This plugin is a memory footprint analysis plugin.

1) Content of the plugin.xml file

<?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <plugin>

  <extension
        point="fr.tpt.aadl.ramses.control.support.analyzer">
     <analyzer
           analysisName="RAMSES-MemoryFootprintAnalysis"
           class="fr.tpt.aadl.launch.MemoryFootprintAnalysisFactory"
           id="fr.tpt.aadl.sched.tools.memoryfootprint">
     </analyzer>
  </extension>

</plugin>

2) The factory class:

public class MemoryFootprintAnalysisFactory implements fr.tpt.aadl.ramses.control.support.analysis.AnalyzerFactory
{

  @Override
  public Analyzer createAnalyzer(AadlModelInstantiatior modelInstantiatior,
                                 PredefinedAadlModelManager predefinedAadlModels)
  {
    return new MemoryFootprintAnalyzer (modelInstantiatior, predefinedAadlModels);
  }
}
</code>

3) The analysis class itself

<code|java>

public class MemoryFootprintAnalyzer extends AbstractAnalyzer
{

  private static final String REGISTRY_NAME = "RAMSES-MemoryFootprintAnalysis";
  public final static String PLUGIN_NAME = "Name_Of_Your_Choice" ;
  private final static String PLUGIN_ID = "Name_Of_Your_Choice"  ;

  protected final AadlModelInstantiatior modelInstantiator;
  protected final PredefinedAadlModelManager predefinedAadlModels;

  public MemoryFootprintAnalyzer(AadlModelInstantiatior modelInstantiator,
                                 PredefinedAadlModelManager predefinedAadlModels)
  {
    this.modelInstantiator = modelInstantiator;
    this.predefinedAadlModels = predefinedAadlModels;
  }
  
  @Override
  public void performAnalysis(SystemInstance systemInstance,
                              RamsesConfiguration config,
                              AnalysisErrorReporterManager errManager,
                              IProgressMonitor monitor)
                                                       throws AnalysisException
  {
    // Put your analysis code here.
  }

  @Override
  public String getRegistryName()
  {
    return REGISTRY_NAME ;
  }

  @Override
  public void setParameters(Map<String, Object> parameters)
  {
    // you can ignore this for now
  }

}


Then the plugin can be called with an Eclipse launch configuration, with options -a RAMSES-MemoryFootprintAnalysis (the plugin registry identifier given in plugin.xml file and MemoryFootprintAnalyzer class.

Personal tools