Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
OTA-2294: Update doc with details on running multiple IP secondaries
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Sul <ext-mykhaylo.sul@here.com>
  • Loading branch information
Mike Sul committed Jun 20, 2019
1 parent 994635c commit c0d13d1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
20 changes: 19 additions & 1 deletion docs/posix-secondaries-bitbaking.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= Posix Secondaries: bitbaking and usage of Primary and Secondary images

The goal of this doc is to guide a reader on bitbaking of two type of images `primary` and `secondary` that are targeted for QEMU (and RPi TBD)
The goal of this doc is to guide a reader on bitbaking of two type of images `primary` and `secondary` that are targeted for QEMU or RPi
and running of which on the target makes it act as `Primary` and `Secondary` ECU of a single device.

Please, refer to link:https://uptane.github.io/uptane-standard/uptane-standard.html[the Uptane standard] in order to grok the meaning of the `Primary` and `Secondary` terms in the given context from a theoretical standpoint.
Expand Down Expand Up @@ -45,6 +45,9 @@ bitbake primary-image
| A space separated list of TCP/IP addresses of the Secondaries to be included into the list of ECUs served by the given Primary
|===

Please, note that PRIMARY_SECONDARIES can be a list of TCP/IP addresses in order to fulfill multiple secondaries use case.
For example, `PRIMARY_SECONDARIES = "10.0.3.2:9050 10.0.3.3:9050 10.0.3.4:9050"`.


=== Secondary
To bitbake an image for `Secondary` run the following
Expand All @@ -66,6 +69,21 @@ bitbake secondary-image
|A TCP port that Secondary listen on for connections from Primary
|===

==== Multiple secondaries use case
In order to support multiple secondaries use case an user should

* repeat the secondary bitbaking procedure corresponding number of times, each time
** specifying unique TCP/IP address by means of `SECONDARY_IP` and `SECONDARY_PORT` configuration variables
** copying and naming uniquely the resultant image file (e.g. `cp tmp/deploy/images/qemux86-64/secondary-image-qemux86-64.ota-ext4 secondary-images/secondary-image-qemux86-64.ota-ext4-001`)
* bitbake the primary image with `PRIMARY_SECONDARIES` listing the corresponding secondaries TCP/IP addresses
* run the primary by following the guide in <<Running>>
* run the secondaries by running the command specified in <<Running>> with a parameter pointing to corresponding secondary image.
For example,

`../meta-updater/scripts/run-qemu-ota --no-gui --secondary-network secondary-images/secondary-image-qemux86-64.ota-ext4-001`

`../meta-updater/scripts/run-qemu-ota --no-gui --secondary-network secondary-images/secondary-image-qemux86-64.ota-ext4-002`

=== Specifics of bitbaking for Raspberry Pi

It is assumed that a reader is a familiar with bitbaking for Raspberry Pi in general, see link:https://docs.ota.here.com/quickstarts/raspberry-pi.html[Build a Raspberry Pi image].
Expand Down
27 changes: 25 additions & 2 deletions docs/posix-secondaries.adoc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
= Posix Secondaries aka IP Secondaries
= Posix Secondaries aka IP Secondaries: configuration and emulation of Primary and Secondary on a local host

The goal of this doc is to guide a reader on configuring and running two executables that can be built out of the given repository source code and act as Primary and Secondary correspondingly.

Expand Down Expand Up @@ -45,7 +45,11 @@ The Primary executable is built by default, thus following build instructions ou

A default configuration of aktualizr acting as Primary can be found in link:../config/sota-local-with-secondaries.toml[<src-root>/config/sota-local-with-secondaries.toml].

One configuration parameter that is worth mentioning is `[uptane]: secondary_config_file` which specifies a path to secondary(ies) configuration file containing input parameters for aktualizr/Primary to communicate with any secondaries. This is a link:../config/posix-secondary-config.json[default secondary configuration for Primary]. In order to use the given default config file, either copy it into your current working directory or update `[uptane]: secondary_config_file` value so it defines a full path to the secondary config file (e.g. ``<src-root>/config/posix-secondary-config.json``).
One configuration parameter that is worth mentioning is `[uptane]: secondary_config_file` which specifies a path
to secondary(ies) configuration file containing input parameters for aktualizr/Primary to communicate with any secondaries.
This is a link:../config/posix-secondary-config.json[default secondary configuration for Primary].
In order to use the given default config file, either copy it into your current working directory or update
`[uptane]: secondary_config_file` value so it defines a full path to the secondary config file (e.g. ``<src-root>/config/posix-secondary-config.json``).

Configuration parameters of secondaries for Primary/aktualizr that are worth mentioning are:

Expand Down Expand Up @@ -84,3 +88,22 @@ $AKT_SECNDR -c $AKT_PROJ_HOME/config/posix-secondary.toml
....
* Add --loglevel 0 to the aforementioned launch commands if you would like to see more logs
* To re-register your emulated multi-ECU device (or start playing it from scratch) remove ``storage`` directory from `PRIMARY_HOME_DIR`

=== Multiple secondaries

In order to emulate a device containing one primary ECU along with more than one secondary ECUs the following should be done.

* Run the secondary executable `<build-dir>/src/aktualizr_secondary/aktualizr-secondary` desired number of times each from different directories.
Prior to running secondary executables, please,

** copy the configuration file <src-root>/config/posix-secondary.toml to each directory the secondary will be launched from.
Let's call such directory as `SECONDARY_HOME_DIR`;

** update a value of `[network]:port` parameter of the config file in each `SECONDARY_HOME_DIR` directory in such way
that each secondary config specifies different port number (9050 by default) hence each secondary will listen on different port;

* Update posix-secondary-config.json located in `PRIMARY_HOME_DIR` (see instructions in p. `Primary`) with details of each secondary
that was executed in previous step, specifically, add corresponding values to "secondaries" list field (e.g. `"secondaries": [{"addr": "127.0.0.1:9050"}, {"addr": "127.0.0.1:9051"}]`).
Once posix-secondary-config.json is updated run the primary, as result you should see that it is connected with multiple secondaries
in aktualizr logs as well as on UI.

0 comments on commit c0d13d1

Please sign in to comment.