-
Notifications
You must be signed in to change notification settings - Fork 3
docs: add WireGuard service example, generally update manual to current repo state #35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,15 @@ | ||
| There are several ways to create a new simulation scenario in NSE2, depending on your preferences and requirements. | ||
| This section covers the three main methods: using the `netedit` tool, converting CSV/JSON files, and manually creating a scenario file. | ||
| Depending on whether you prefer a graphical interface, command-line tools, or manual editing, you can choose the method that best suits your workflow. | ||
| The recommended way to create an NSE2 scenario is to start with a scenario in | ||
| the https://github.com/esa/ccsds-dtn-reference-scenarios[CCSDS DTN Reference | ||
| Scenarios] format. The repository provides the scenario data as CSV files; | ||
| these can be converted directly into the NSE2 contact plan and Docker Compose | ||
| files. The generated files keep node names and links synchronized, avoiding the | ||
| need to understand the specifics of the <<contactplan-format,CCP format>> and | ||
| <<compose-format,Compose format>>. | ||
|
|
||
| The CSV scenario can be used unchanged, adapted before conversion, or used as | ||
| the basis for a more substantial modification. Alternatively, an already | ||
| converted scenario from NSE2's `scenarios/` directory can be copied and | ||
| adapted. Creating both files manually should generally be avoided, but remains | ||
| useful for small examples or special-purpose topologies. `netedit` is another | ||
| alternative for graphical topology editing, though its GraphML conversion to NSE2 | ||
| files is currently not yet supported. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,89 +1,122 @@ | ||
| == Generate Files from CSV | ||
| The following commands implement the CCSDS CSV workflow described above. Use | ||
| the same contact CSV to generate both a contact plan and a Docker Compose | ||
| topology. | ||
|
|
||
| The helper scripts in `tools/helpers` can generate a contact plan and a | ||
| Docker Compose file from the same contact CSV. The CSV contains one link | ||
| per row with the columns `source`, `destination`, `start`, `end`, | ||
| `bandwidth`, `delay`, and an optional label. The scripts skip the header | ||
| row. | ||
| The generators are available as the `csv_to_ccp` and `csv_to_compose` commands | ||
| (or directly under `tools/helpers/` in a source checkout). | ||
|
|
||
| === Generate a Contact Plan | ||
| ==== Contact CSV | ||
|
|
||
| Use `csv_to_ccp.py` to create a `.ccp` file: | ||
| The input CSV has a header followed by one row per directed link: | ||
|
|
||
| [cols="1,1,1,1,1,1,1",options="header"] | ||
| |=== | ||
| | Source | Destination | Start | End | Bandwidth | Delay | Label | ||
|
|
||
| | Node name | Node name | Seconds | Seconds | Bits per second | Milliseconds | Optional | ||
| |=== | ||
|
|
||
| The header row is skipped. The label column is optional. Loss and jitter are | ||
| not CSV columns and are generated as zero. A row with `start=0` and `end=-1` | ||
| becomes a fixed link. Matching rows in opposite directions are combined into a | ||
| symmetric link where their timing and link properties match. | ||
|
|
||
| Use the `Label` column to distinguish multiple links between the same pair of | ||
| nodes when they have different properties. Generated Docker network and | ||
| interface names are based on the node names and, where needed, the link label. | ||
| Keep node names short; if a generated name exceeds Linux's 15-character | ||
| interface-name limit, it is replaced by a 12-character MD5 prefix. A long | ||
| common prefix can sometimes be avoided with `--strip-prefix PREFIX`; link | ||
| labels ending in `high` or `low` are shortened to `hi` or `lo` when names are | ||
| constructed. | ||
|
|
||
| ==== Generate a Contact Plan | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| csv_to_ccp.py contacts.csv --output contacts.ccp | ||
| csv_to_ccp contacts.csv --output contacts.ccp | ||
| ---- | ||
|
|
||
| Options: | ||
| The available options are: | ||
|
|
||
| * `--output`, `-o`: output file; `-` (the default) writes to standard output. | ||
| * `--output`, `-o`: output file; `-` writes to standard output. | ||
| * `--strip-prefix PREFIX`: remove `PREFIX` from source and destination names. | ||
| * `--speedup FACTOR`: divide contact timestamps by `FACTOR`, useful for a | ||
| shorter test run. The default is `1`. | ||
| * `--bw-scale FACTOR` (also `--bandwidth-scale`): multiply bandwidths by | ||
| `FACTOR`. The default is `1`. | ||
|
|
||
| Rows with a start time of `0` and an end time of `-1` become fixed links. | ||
| Matching reverse-direction rows are combined into a symmetric link using | ||
| `=`. When a node pair has multiple labels, the label is used to generate a | ||
| dedicated destination interface such as `dev:n1_n2_payload`. | ||
| * `--speedup FACTOR`: divide contact times by `FACTOR` to shorten a scenario. | ||
| * `--bw-scale FACTOR` or `--bandwidth-scale FACTOR`: scale bandwidth values. | ||
|
|
||
| === Generate a Compose File | ||
| When multiple labelled links connect the same pair of nodes, the label is used | ||
| to select a destination interface such as `dev:n1_n2_payload`. | ||
|
|
||
| Use `csv_to_compose.py` with the same CSV: | ||
| ==== Generate a Compose Topology | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| csv_to_compose.py contacts.csv --output compose.yml | ||
| csv_to_compose contacts.csv --output compose.yml | ||
| ---- | ||
|
|
||
| Options: | ||
| The optional node mapping JSON supplies stable metadata for each CSV node. Its | ||
| entries contain `node_label`, `node_name`, and `node_id`: | ||
|
|
||
| * `--output`, `-o`: output file; `-` writes to standard output. | ||
| * `--strip-prefix PREFIX`: remove `PREFIX` from node names. | ||
| * `--nodes FILE` (also `--mapping`): JSON file containing node labels, names, | ||
| and IDs. | ||
| * `--name NAME`, `-n`: Compose project name. | ||
| * `--image IMAGE`, `-i`: container image; the default is `alpine`. | ||
| * `--entrypoint COMMAND`, `-e`: container entrypoint. The default installs | ||
| `iproute2` and `bash`, then keeps the container running. | ||
| * `--build PATH`, `-b`: use a build directory instead of an image. | ||
| * `--base-subnet PREFIX`: first two subnet octets; the default is `172.33`. | ||
| * `--export-graphml FILE`, `-g`: additionally export the topology as GraphML. | ||
| * `--node-volumes DIRECTORY`: create per-node data directories and mount them | ||
| into the containers. | ||
| * `--mount-compose`: mount the generated Compose file read-only in each | ||
| container. | ||
|
|
||
| The generated Compose topology uses one Docker bridge network for each link. | ||
| Every such network connects exactly two nodes; this keeps each link isolated | ||
| and gives both endpoints a predictable interface. Network names are based on | ||
| the sorted node names, and, when several differently labelled links connect | ||
| the same pair, also include the link label. Direction suffixes `_ul` and | ||
| `_dl` are removed and `high`/`low` are shortened to `hi`/`lo`. | ||
|
|
||
| Linux limits network interface names to 15 characters including the | ||
| terminating null byte. Therefore names with 14 or more characters are | ||
| replaced by the first 12 characters of their MD5 hash, with a warning printed | ||
| by the script. Use `--strip-prefix` when node labels share a long common | ||
| prefix, for example: | ||
| [source,json] | ||
| ---- | ||
| [ | ||
| { | ||
| "node_label": "n1", | ||
| "node_name": "spacecraft-1", | ||
| "node_id": "ipn:1.0" | ||
| } | ||
| ] | ||
| ---- | ||
|
|
||
| If a mapping is not supplied, metadata is generated from the CSV labels. Use | ||
| the mapping when the CCSDS scenario provides stable names and IDs. | ||
|
|
||
| The available `csv_to_compose` options are: | ||
|
|
||
| * `--output`, `-o`: Compose output file; `-` writes to standard output. | ||
| * `--strip-prefix PREFIX`: remove `PREFIX` from node labels. | ||
| * `--nodes FILE` or `--mapping FILE`: read node metadata from JSON. | ||
| * `--name NAME`, `-n`: set the Compose project name. | ||
| * `--image IMAGE`, `-i`: select the node image; the default is `alpine`. | ||
| * `--entrypoint COMMAND`, `-e`: override the default Alpine entrypoint. | ||
| * `--base-subnet PREFIX`: choose the first two subnet octets; the default is | ||
| `172.33`. | ||
| * `--node-volumes DIRECTORY`: create and mount a data directory per node. | ||
| * `--build PATH`, `-b`: build nodes from the specified path instead of an image. | ||
| * `--mount-compose`: mount the generated Compose file read-only in each node. | ||
| * `--export-graphml FILE`, `-g`: additionally write the generated topology as | ||
| GraphML. This is an output option; the script does not read GraphML as input. | ||
|
|
||
| The generator creates one Docker bridge network for each link, with predictable | ||
| interfaces for the endpoints. | ||
|
|
||
| ==== Generate Both Files | ||
|
|
||
| Generate the two NSE2 inputs from the same CCSDS contact CSV: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| csv_to_compose.py --strip-prefix eo --nodes nodes.json \ | ||
| --output compose.yml actual_contacts.csv | ||
| csv_to_ccp --strip-prefix eo actual_contacts.csv --output contacts.ccp | ||
| csv_to_compose --strip-prefix eo --nodes nodes.json \ | ||
| --name earth-orbit actual_contacts.csv --output compose.yml | ||
| ---- | ||
|
|
||
| Removing the prefix can keep the generated network and interface names short | ||
| and human-readable instead of forcing the hash fallback. | ||
| Both generators record the generation date and command in their output. Review | ||
| the generated files before starting the scenario, then use the normal NSE2 | ||
| workflow from <<running>>. | ||
|
|
||
| Both scripts write the generation date and complete command to the generated | ||
| file. A typical scenario therefore uses the same CSV to generate both files: | ||
| ==== Shortening Realistic Contact Plans | ||
|
|
||
| As an alternative to `csv_to_ccp` 's time and bandwidth scaling, `random_contacts` | ||
| keeps the topology and link properties but replaces long, realistic contact | ||
| windows with short random ones for a compact test run: | ||
|
|
||
| [source,bash] | ||
| ---- | ||
| csv_to_ccp.py --strip-prefix eo --output contacts.ccp actual_contacts.csv | ||
| csv_to_compose.py --strip-prefix eo --nodes nodes.json \ | ||
| --name earth-orbit --output compose.yml actual_contacts.csv | ||
| random_contacts contacts.ccp contacts-short.ccp \ | ||
| --length 300 --min-contact 5 --max-contact 20 --seed 42 | ||
| ---- | ||
|
|
||
| The `--length` option sets the plan duration; `--min-contact`, `--max-contact`, | ||
| and `--seed` control the generated windows. Fixed links and all link properties | ||
| are preserved. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.