Skip to content

Commit

Permalink
csle-cyborg [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
Limmen committed Jan 11, 2024
1 parent 64a2aef commit 027ace7
Show file tree
Hide file tree
Showing 21 changed files with 134 additions and 134 deletions.
8 changes: 4 additions & 4 deletions docs/_docs/code_analysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To run the Python linter on the CSLE code base, execute the command:
```

<p class="captionFig">
Listing 132: Command to run the Python linter.
Listing 138: Command to run the Python linter.
</p>

Alternatively, the following commands can be executed for the same effect as the command above:
Expand All @@ -30,7 +30,7 @@ flake8 examples/
```

<p class="captionFig">
Listing 133: Commands to run the Python linter.
Listing 139: Commands to run the Python linter.
</p>

To run the Python static type checker, execute the command:
Expand All @@ -40,7 +40,7 @@ simulation-system/libs/type_checker.sh
```

<p class="captionFig">
Listing 134: Command to run the Python static type checker.
Listing 140: Command to run the Python static type checker.
</p>

To run the JavaScript linter, run the commands:
Expand All @@ -51,5 +51,5 @@ cd management-system/csle-mgmt-webapp/; npm run lint:fix
```

<p class="captionFig">
Listing 135: Commands to run the JavaScript linter.
Listing 141: Commands to run the JavaScript linter.
</p>
8 changes: 4 additions & 4 deletions docs/_docs/development_conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ csle/.flake8
```

<p class="captionFig">
Listing 113: Configuration file for the `flake8` Python linter.
Listing 119: Configuration file for the `flake8` Python linter.
</p>

Configuration file for the `flake8` Python linter.
Expand All @@ -78,7 +78,7 @@ csle/management-system/csle-mgmt-webapp/.eslintrc.json
```

<p class="captionFig">
Listing 114: Configuration file for the `eslint` JavaScript linter.
Listing 120: Configuration file for the `eslint` JavaScript linter.
</p>


Expand Down Expand Up @@ -119,7 +119,7 @@ def stop_all_executions() -> None:
```

<p class="captionFig">
Listing 115: Example of a Python function with a comment.`
Listing 121: Example of a Python function with a comment.`
</p>

Example of a comment to a JavaScript function:
Expand All @@ -146,7 +146,7 @@ const convertListToCommaSeparatedString = (listToConvert) => {
```
<p class="captionFig">
Listing 116: Example of a JavaScript function with a comment.
Listing 122: Example of a JavaScript function with a comment.
</p>
### Unit and Integration Testing
Expand Down
8 changes: 4 additions & 4 deletions docs/_docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ traces = MetastoreFacade.list_emulation_traces()
```

<p class="captionFig">
Listing 109: Example of collecting attack and system traces with CSLE.
Listing 111: Example of collecting attack and system traces with CSLE.
</p>

### System Identification
Expand Down Expand Up @@ -94,7 +94,7 @@ gaussian_mixture_system_model=system_model)
```

<p class="captionFig">
Listing 110: Example of system identification through expectation maximization with CSLE.
Listing 112: Example of system identification through expectation maximization with CSLE.
</p>

### Strategy Training
Expand Down Expand Up @@ -142,7 +142,7 @@ for policy in experiment_execution.result.policies.values():
```

<p class="captionFig">
Listing 111: Example of strategy optimization through the Proximal Policy Optimization (PPO) reinforcement learning algorithm in CSLE.
Listing 113: Example of strategy optimization through the Proximal Policy Optimization (PPO) reinforcement learning algorithm in CSLE.
</p>

### Strategy Evaluation
Expand Down Expand Up @@ -181,6 +181,6 @@ StoppingGamePomdpDefenderEnv.emulation_evaluation(
```

<p class="captionFig">
Listing 112: Example of evaluating learned security strategies in the emulation system of CSLE.
Listing 114: Example of evaluating learned security strategies in the emulation system of CSLE.
</p>

10 changes: 5 additions & 5 deletions docs/_docs/how_to_base_container.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@ To add a base container with the name "`my_container`", do the following steps:
csle/emulation-system/base_images/docker_files
```
<p class="captionFig">
Listing 147: Directory with base Docker images.
Listing 153: Directory with base Docker images.
</p>
2. Add a Dockerfile to the following directory:
```bash
csle/emulation-system/base_images/docker_files/my_container
```
<p class="captionFig">
Listing 148: Directory with the Dockerfile of a container with the name `my_container`.
Listing 154: Directory with the Dockerfile of a container with the name `my_container`.
</p>
3. Add build and push instructions to the following Makefile:
```bash
csle/emulation-system/base_images/Makefile
```
<p class="captionFig">
Listing 149: Makefile for base Docker images.
Listing 155: Makefile for base Docker images.
</p>
4. Update the following README file:
```bash
csle/emulation-system/base_images/README.md
```
<p class="captionFig">
Listing 150: README file for base Docker images.
Listing 156: README file for base Docker images.
</p>
5. Build and push the image to DockerHub by running the commands:
```bash
cd csle/emulation-system/base_images; make my_container
cd csle/emulation-system/base_images; make push_my_container
```
<p class="captionFig">
Listing 151: Commands to build and push the base Docker image `my_container` to DockerHub.
Listing 157: Commands to build and push the base Docker image `my_container` to DockerHub.
</p>
4 changes: 2 additions & 2 deletions docs/_docs/how_to_config_param.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ To add a new configuration parameter, perform the following steps:
csle/simulation-system/libs/csle-common/src/csle_common/dao/emulation_config/config.py
```
<p class="captionFig">
Listing 174: Python file that manages the CSLE configuration.
Listing 180: Python file that manages the CSLE configuration.
</p>
3. Add the new parameter to an appropriate class in the following file (add a new class if needed):
```bash
csle/simulation-system/libs/csle-common/src/csle_common/constants/constants.py
```
<p class="captionFig">
Listing 175: Python file with constants in `csle-common`.
Listing 181: Python file with constants in `csle-common`.
</p>
10 changes: 5 additions & 5 deletions docs/_docs/how_to_derived_container.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,34 @@ To add a derived container with the name "`my_container`", perform the following
csle/emulation-system/derived_images/
```
<p class="captionFig">
Listing 152: Directory with derived Docker images.
Listing 158: Directory with derived Docker images.
</p>
2. Add a Dockerfile inside the directory:
```bash
csle/emulation-system/derived_images/my_container/
```
<p class="captionFig">
Listing 153: Directory with the Dockerfile for a derived Docker image with the name `my_container`.
Listing 159: Directory with the Dockerfile for a derived Docker image with the name `my_container`.
</p>
3. Add build and push instructions to the following Makefile:
```bash
csle/emulation-system/derived_images/Makefile
```
<p class="captionFig">
Listing 154: Makefile for derived Docker images.
Listing 160: Makefile for derived Docker images.
</p>
4. Update the following README file:
```bash
csle/emulation-system/derived_images/README.md
```
<p class="captionFig">
Listing 155: README file for derived Docker images.
Listing 161: README file for derived Docker images.
</p>
5. Build and push the image to DockerHub by running the commands:
```bash
cd csle/emulation-system/derived_images; make my_container
cd csle/emulation-system/derived_images; make push_my_container
```
<p class="captionFig">
Listing 156: Commands to build and push the derived Docker image `my_container` to DockerHub.
Listing 162: Commands to build and push the derived Docker image `my_container` to DockerHub.
</p>
10 changes: 5 additions & 5 deletions docs/_docs/how_to_emulation_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,33 @@ To add a new emulation configuration with the name "`level_13`" and version 0.1.
csle/emulation-system/envs/010/
```
<p class="captionFig">
Listing 157: Directory with emulation configurations with version 0.1.0.
Listing 163: Directory with emulation configurations with version 0.1.0.
</p>
2. Add the emulation configuration file `config.py` to the directory:
```bash
csle/emulation-system/envs/010/level_13/
```
<p class="captionFig">
Listing 158: Directory with emulation configuration file for the emulation with the name `level_13` and version 0.1.0.
Listing 164: Directory with emulation configuration file for the emulation with the name `level_13` and version 0.1.0.
</p>
3. Update the following README file:
```bash
csle/emulation-system/envs/010/README.md
```
<p class="captionFig">
Listing 159: README file for emulation configurations with version 0.1.0.
Listing 165: README file for emulation configurations with version 0.1.0.
</p>
4. Update the following Makefile with installation instructions:
```bash
csle/emulation-system/envs/010/README.md
```
<p class="captionFig">
Listing 160: Makefile for emulation configurations with version 0.1.0.
Listing 166: Makefile for emulation configurations with version 0.1.0.
</p>
5. Insert the emulation configuration into the metastore by running the command:
```bash
csle/emulation-system/envs; make install
```
<p class="captionFig">
Listing 161: Command to insert emulation configurations into the metastore.
Listing 167: Command to insert emulation configurations into the metastore.
</p>
6 changes: 3 additions & 3 deletions docs/_docs/how_to_monitoring_agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ To update the monitoring agents that run on the emulated devices, perform the fo
csle/simulation-system/libs/csle-collector/src/
```
<p class="captionFig">
Listing 167: Directory with source code of the monitoring agents in CSLE.
Listing 173: Directory with source code of the monitoring agents in CSLE.
</p>
2. Update the gRPC API by editing the protocol-buffer files in the directory:
```bash
csle/simulation-system/libs/csle-collector/protos/
```
<p class="captionFig">
Listing 168: Directory with protocol buffers for the monitoring agents in CSLE.
Listing 174: Directory with protocol buffers for the monitoring agents in CSLE.
</p>
3. Regenerate the gRPC Python files by running the commands:
```bash
Expand All @@ -33,5 +33,5 @@ To update the monitoring agents that run on the emulated devices, perform the fo
python -m grpc_tools.protoc -I./protos/ --python_out=./src/csle_collector/. --grpc_python_out=./src/csle_collector/ryu_manager/. ./protos/ryu_manager.proto
```
<p class="captionFig">
Listing 169: Commands to generate gRPC Python files from protobuf files.
Listing 175: Commands to generate gRPC Python files from protobuf files.
</p>
8 changes: 4 additions & 4 deletions docs/_docs/how_to_numerical_algo.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ perform the following steps:
csle/simulation-system/libs/csle-agents/src/csle_agents/agents/
```
<p class="captionFig">
Listing 170: Directory with numerical algorithms in CSLE.
Listing 176: Directory with numerical algorithms in CSLE.
</p>
2. Implement the algorithm in a file called `my_algorithm.py` in the directory:
```bash
csle/simulation-system/libs/csle-agents/src/csle_agents/agents/my_agent
```
<p class="captionFig">
Listing 171: Directory with algorithm implementation for the algorithm with the name `my_agent` in CSLE.
Listing 177: Directory with algorithm implementation for the algorithm with the name `my_agent` in CSLE.
</p>
The implementation should be a Python class called `MyAlgorithm` that inherits from the class `BaseAgent`,
which is defined in the file:
```bash
csle/simulation-system/libs/csle-agents/src/csle_agents/agents/base/base_agent.py
```
<p class="captionFig">
Listing 172: Base agent file in CSLE.
Listing 178: Base agent file in CSLE.
</p>
3. Add an example of how to use the algorithm to the following folder:
```bash
csle/examples
```
<p class="captionFig">
Listing 173: Directory with example usages of CSLE.
Listing 179: Directory with example usages of CSLE.
</p>
10 changes: 5 additions & 5 deletions docs/_docs/how_to_simulation_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,34 @@ perform the following steps:
csle/simulation-system/envs/
```
<p class="captionFig">
Listing 162: Directory with simulation configurations.
Listing 168: Directory with simulation configurations.
</p>
2. Add the simulation configuration file `config_v_001.py` to the directory:
```bash
1 csle/simulation-system/envs/test_env
```
<p class="captionFig">
Listing 163: Directory with configuration file for the simulation environment with the name `test_env`.
Listing 169: Directory with configuration file for the simulation environment with the name `test_env`.
</p>
3. Update the following README file:
```bash
csle/simulation-system/envs/README.md
```
<p class="captionFig">
Listing 164:
Listing 170:
</p>
4. Update the following Makefile with installation instructions:
```bash
csle/simulation-system/envs/Makefile
```
<p class="captionFig">
Listing 165: Makefile for simulation configurations.
Listing 171: Makefile for simulation configurations.
</p>
5. Insert the simulation configuration into the metastore by running the command:
```bash
csle/simulation-system/envs; make install
```
<p class="captionFig">
Listing 166: Command to insert simulation configurations into the metastore.
Listing 172: Command to insert simulation configurations into the metastore.
</p>

Loading

0 comments on commit 027ace7

Please sign in to comment.