Extracting information from AUTOSAR models

RED

Ways to use RED's scripting facilities

As you browse an AUTOSAR model, you navigate in the tree editor: open elements in the data structure like ARObjects,
follow references, and you get deeper and deeper into the model.
There's a Script Editor widget in RED that can be used to write simple code snippets quickly
that run on the AUTOSAR root element to try something.

A more convenient and flexible way to do this is to create a groovy project in your favorite IDE
with a dependency on RED's library or command line tool build.
The API documentation is available in Javadoc format,
and the documentation sources are available in both the library and the command line tool build,
so you can browse it easily while editing your script.
Also, full-featured context help of your IDE is at your hand.

WorkingOnAScriptWithIDE

Testing

Creating automated tests for your scripts as you work is highly recommended.
Above the usually mentioned things, your scripts will likely work on huge models, which might take a few minutes to load.

TestingScripts

Building your simple model is very easy, using RED to test your scripts immediately
while making it fast enough for your CI/CD environment.

EditingModel

The AUTOSAR metamodel is quite complex and not always straightforward.
RED helps you create a valid arxml model without restricting you from creating elements and setting valid attributes.

EditingModelAttribute

Testing manually

One way to test your scripts manually is to use the command line tool.
This tool is also the way to use RED to get the job done automatically.

```shell
java -jar libs/command-line-scripting-1.17.0.jar \
--license=your/license.lic \
--files=src/test/resources/routing.arxml \
--scripts=src/scripts/main.groovy,src/scripts/ResultWriter.groovy \
--object=/gateways/Gateway1
```

RED extensions

You may decide to extend RED's functionality.
A script developed the way described above can also be used as an extension to RED.
Copy the scripts and some metadata files into your RED directory in your home folder,
and RED will offer it on right-click on a tree element.

RightClickScript

Features

With the scripting environment, you get a whole toolset to work with, including built-in file handling, templating,
JSON serialization, testing infrastructure, and more.