Commit Graph

1862 Commits

Author SHA1 Message Date
Archer.Bowen
feb9763f62 Merge https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE into feature/2716-Red-Agent-Logging 2024-07-10 13:40:54 +01:00
Archer.Bowen
239f5b86c0 #2716 Agent logging now sits outside of the simulation output log directory, updated dev-mode CLI to include agent logging and added additional tests. 2024-07-10 13:36:37 +01:00
Christopher McCarthy
2c46fb8b04 Merged PR 452: Automate the benchmark process
## Summary
This pull request integrates full automation of the PrimAITE benchmarking process into our Azure DevOps pipeline, enhancing consistency and minimizing manual effort.

#### Key Changes:

1.  **Pipeline Automation**: Configured to trigger on commits to `dev` and `release` branches, with scheduled runs during off-peak hours.

2.  **Error Handling Improvements**: The pipeline is set to fail on any Python execution errors, ensuring immediate identification of issues.

3.  **Artifact Publishing**: Benchmark results are now automatically compressed and published as artifacts, facilitating easy access and analysis.

## Test process
Tested the pipeline runs from end-to-end and produces a working benchmark report: https://dev.azure.com/ma-dev-uk/PrimAITE/_build/results?buildId=5280&view=results

## Checklist
- [ ] PR is linked to a **work item**
- [ ] **acceptance criteria** of linked ticket are met
- [ ] performed **self-review** of the code
- [ ] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [ ] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

Related work items: #2739
2024-07-09 19:39:27 +00:00
Christopher McCarthy
2eb9d970bf Apply suggestions from code review 2024-07-09 19:25:13 +00:00
Archer.Bowen
48645d2e72 #2716 Initial Implementation + Initial Tests and updated changelog and sphinx documentation. 2024-07-09 16:46:31 +01:00
Christopher McCarthy
b45f6bbd40 Merged PR 447: Bandwidth load / capacity checks before transmission
## Summary

This pull request introduces significant enhancements to the AirSpace class within our network simulation software, aimed at improving the realism, configurability, and accuracy of wireless network simulations. These changes include the addition of new enums and attributes, enhancements to the configuration schema, and improvements in bandwidth management and transmission logic.

**Additions**

-   **Enums and Attributes:**

-   **AirSpaceEnvironmentType Enum**: Defines various environmental settings that affect wireless signal propagation and interference.
-   **ChannelWidth Enum**: Specifies available channel width options for wireless interfaces.
-   **Channel Width Attribute**: Added to WirelessNetworkInterface for dynamic adjustments based on the operational environment.
-   **airspace_key Attribute**: A tuple identifying the frequency and channel width combination for bandwidth management.
-   **airspace_environment_type Attribute**: Sets the overall environmental context of the airspace, influencing all contained devices.

-   **Functional Enhancements:**

-   **SNR and Capacity Calculation Functions**: New functions estimate_snr and calculate_total_channel_capacity have been implemented to compute signal-to-noise ratios and channel capacities dynamically.
-   **show_bandwidth_load Function**: Provides a visual representation of the current bandwidth load across different channels.
-   **Dynamic Speed Setting**: The speed attribute of WirelessInterface is now adjusted dynamically based on frequency, channel width, and environment.

-   **Configuration and Testing:**

-   **Configuration Schema Update**: The simulation.network config file schema now supports setting the airspace_environment_type.

**Changes**

-   **Interface and Performance Adjustments:**

-   **NetworkInterface Speed Type**: Changed from int to float for more precise speed definitions.
-   **Transmission Feasibility Check**: Updated the _can_transmit function in Link to better handle current load and bandwidth capacities.
-   **WirelessRouter Configurations**: The configure_wireless_access_point function now takes channel_width as an additional parameter.
-   **Grouping Adjustments**: WirelessNetworkInterfaces are now categorized by both AirSpaceFrequency and ChannelWidth.

-   **Transmission Logic Overhaul:**

-   **Interface Adjustments**: Modifying an interface's settings now necessitates its temporary removal from the airspace, followed by a recalculation of its data rate and reintegration under new settings.
-   **Blocking Overloads**: Strengthened the logic in AirSpace to prevent transmissions that would surpass the available capacity.

**Fixes**

-   **Transmission Permission Logic**: Fixed the can_transmit_frame function to accurately enforce transmission limits based on current network load and available bandwidth.

**Conclusion**

These updates significantly enhance the fidelity and flexibility of our network simulation tool, enabling more accurate m...
2024-07-09 10:47:56 +00:00
Czar Echavez
1fdd05a0d1 Merged PR 449: #2688: apply the request validators + fixing the fix duration test + refactor...
## Summary
*Replace this text with an explanation of what the changes are and how you implemented them. Can this impact any other parts of the codebase that we should keep in mind?*

## Test process
*How have you tested this (if applicable)?*

## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [X] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

#2688: apply the request validators + fixing the fix duration test + refactor test class names

Related work items: #2688
2024-07-09 08:26:31 +00:00
Czar Echavez
a3f74087fa #2688: refactor test classes 2024-07-08 15:26:30 +01:00
Czar Echavez
829a6371de #2688: tests 2024-07-08 14:39:37 +01:00
Christopher McCarthy
2d2f2df360 Added set -e to the Run Benchmark Script step in azure-benchmark-pipeline.yaml so that the pipeline fails if the python script fails. 2024-07-08 08:26:52 +00:00
Christopher McCarthy
2a003eece9 Updated v3.0.0_benchmark_metadata.json so that combined_av_reward_per_episode is now named combined_total_reward_per_episode to match the new script 2024-07-08 08:25:05 +00:00
Chris McCarthy
c146992307 #2739 - updated azure-benchmark-pipeline.yaml to run on ubuntu-latest while we wait for authorisation to use the yak pool 2024-07-05 17:02:35 +01:00
Chris McCarthy
5e8343ca91 #2739 - update job name in azure-benchmark-pipeline.yaml 2024-07-05 16:57:40 +01:00
Chris McCarthy
7173c329b0 #2739 - Updated azure-benchmark-pipeline.yaml to allow it to run for unlimited time on the Imaginary Yak Pool 2024-07-05 16:56:07 +01:00
Chris McCarthy
4410e05e3e #2967 - Updated the DB filesize so that it doesn't fill the 100mbit link. moved the can transmit checks to the network interface to enable frame dropped syslog. narrowed the scope of the NODE_NMAP_PORT_SCAN action in nmap_port_scan_red_agent_config.yaml to select ports and protocols as the link was filling up on the full box scan. 2024-07-05 16:27:03 +01:00
Czar Echavez
2a0695d0d1 #2688: apply the request validators + fixing the fix duration test + refactor test class names 2024-07-05 15:06:17 +01:00
Chris McCarthy
9468adb606 #2967 - Updated the airspace configuration description in simulation.rst 2024-07-04 20:52:20 +01:00
Chris McCarthy
c6b1d35215 #2967 - Enhance AirSpace simulation with dynamic environment and bandwidth/channel management
This commit introduces several key enhancements to the AirSpace class, improving the realism and configurability of the wireless network. Major additions include the AirSpaceEnvironmentType and ChannelWidth enums, dynamic adjustment of interface speeds based on environmental settings, and comprehensive bandwidth management features. Additionally, the software now supports configuration of channel widths via the config file, incorporates accurate SNR and capacity calculations, and enforces bandwidth limits more effectively across wireless interfaces. Updated tests ensure that the new functionalities integrate seamlessly with existing systems.
2024-07-04 20:45:42 +01:00
Czar Echavez
20e5e40d0d Merged PR 446: Add fix duration in config
## Summary
Added a ``fix_duration`` config property in applications and services
Defaults to using 2 if none is specified

## Test process
https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/446?_a=files&path=/tests/integration_tests/configuration_file_parsing/test_software_fix_duration.py

## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [X] written **tests** for any new functionality added with this PR
- [X] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

Related work items: #2725
2024-07-03 10:21:17 +00:00
Czar Echavez
797afc99ab Merge remote-tracking branch 'origin/dev' into feature/2725-add-software-fix-duration-config 2024-07-03 10:37:02 +01:00
Czar Echavez
55c457a87d #2725: apply PR suggestions 2024-07-03 10:34:44 +01:00
Marek Wolan
bd23ee2083 Merged PR 444: Refactor application install
## Summary
* Remove the ip address parameter from application install
* Make it possible to install any application that exists
* Add new configuration actions for applications
* Add an application registry to match names to application classes

## Test process
* several new tests
* notebooks still running

## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [X] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [X] attended to any **TO-DOs** left in the code

Related work items: #2438, #2705
2024-07-02 15:57:59 +00:00
Czar Echavez
fcd1209156 #2725: documentation 2024-07-02 16:55:28 +01:00
Czar Echavez
6a72f6af42 #2725: add fix duration to application and service configuration 2024-07-02 15:52:18 +01:00
Marek Wolan
eb1f7555f8 Merged PR 445: #2702 - update data manipulation notebook text
## Summary
*Replace this text with an explanation of what the changes are and how you implemented them. Can this impact any other parts of the codebase that we should keep in mind?*

## Test process
*How have you tested this (if applicable)?*

## Checklist
- [ ] PR is linked to a **work item**
- [ ] **acceptance criteria** of linked ticket are met
- [ ] performed **self-review** of the code
- [ ] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [ ] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

#2702 - update data manipulation notebook text

Related work items: #2702
2024-07-02 14:29:05 +00:00
Marek Wolan
cbc414bddf #2702 - update data manipulation notebook text 2024-07-02 15:25:40 +01:00
Marek Wolan
59b4a162ef Merged PR 442: Add application configuration actions
## Summary
* Add new actions for configuring applications

## Test process
Integration tests.

## Checklist
- [x] PR is linked to a **work item**
- [x] **acceptance criteria** of linked ticket are met
- [x] performed **self-review** of the code
- [x] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [x] ran **pre-commit** checks for code style
- [x] attended to any **TO-DOs** left in the code

Related work items: #2700
2024-07-02 13:56:34 +00:00
Marek Wolan
feabe5117c #2700 Fix docstrings in application configure methods 2024-07-02 12:48:23 +01:00
Marek Wolan
b27ac52d9e #2700 add E2E tests for application configure actions 2024-07-02 11:10:19 +01:00
Marek Wolan
33b9c5f6b3 Merge branch 'feature/2701-refactor-install-action' into feature/2700-application-configure-actions 2024-07-02 10:41:17 +01:00
Czar Echavez
eee7a68f28 Merged PR 440: #2620: add nbmake and pytest xdist to run the notebooks as part of pieline
![image.png](https://dev.azure.com/ma-dev-uk/b50a61ee-86c4-48bc-9a0b-a67645ba12ee/_apis/git/repositories/2825053e-bd3b-45b2-8680-1281809eefa2/pullRequests/440/attachments/image.png)
![image (2).png](https://dev.azure.com/ma-dev-uk/b50a61ee-86c4-48bc-9a0b-a67645ba12ee/_apis/git/repositories/2825053e-bd3b-45b2-8680-1281809eefa2/pullRequests/440/attachments/image%20%282%29.png)

## Summary
Added nbmake so that the pytest can be used to run the notebooks in primaite as part of the pipeline

## Test process
n/a

## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [ ] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

#2620: add nbmake and pytest xdist to run the notebooks as part of pieline

Related work items: #2620
2024-07-02 08:21:29 +00:00
Czar Echavez
e2429df220 #2620: remove div zero from notebook 2024-07-02 02:52:08 +01:00
Czar Echavez
a5a93fe850 #2620: commit a div zero to check that the pipeline fails 2024-07-02 02:10:40 +01:00
Czar Echavez
12a6aa5e7f #2620: make the windows script work 2024-07-02 01:31:59 +01:00
Czar Echavez
88ab3c3ca1 #2620: remove shell 2024-07-02 00:45:24 +01:00
Czar Echavez
1faacc8d7c #2620: fix indentation 2024-07-02 00:28:59 +01:00
Czar Echavez
918eba2217 #2620: fix indentation 2024-07-02 00:25:30 +01:00
Czar Echavez
8097884ae2 #2620: modify script 2024-07-02 00:00:20 +01:00
Czar Echavez
ab3e84b8b9 #2620: remove irrelevant change 2024-07-01 17:03:14 +01:00
Czar Echavez
afcb844501 #2620: remove cell that fails on purpose 2024-07-01 16:45:28 +01:00
Marek Wolan
dc2c64b2f6 #2701 - Remove ip address option from node application install 2024-07-01 16:23:10 +01:00
Czar Echavez
9c568b0ff3 Merged PR 439: #2641: Added a check for software health state in db service + tests
## Summary
Added a check in the database service process_sql method that checks if the Database Service is in a GOOD state (mainly so that the database service being in a fixed state returns an error)

## Test process
https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/439?_a=files&path=/tests/integration_tests/system/test_database_on_node.py

https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/439?_a=files&path=/tests/integration_tests/system/test_web_client_server_and_database.py

## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [X] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

#2641: Added a check for software health state in db service + tests

Related work items: #2641
2024-07-01 15:22:22 +00:00
Czar Echavez
a47a14b86e #2620: Going around azure dev ops to fail the script 2024-07-01 15:57:15 +01:00
Marek Wolan
91727f7fde Merged PR 438: #2705 - Move application registry into application module instead of hardcodi...
## Summary
- Add a registry class variable to Application.
- Add an identifier string for all existing applications
- Utilise application registry in game from_config method.

## Test process
New unit test for new features
existing tests pass
notebooks run as before

## Checklist
- [x] PR is linked to a **work item**
- [x] **acceptance criteria** of linked ticket are met
- [x] performed **self-review** of the code
- [x] written **tests** for any new functionality added with this PR
- [~] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [x] ran **pre-commit** checks for code style
- [x] attended to any **TO-DOs** left in the code

#2705 - Move application registry into application module instead of hardcoding in game module

Related work items: #2705
2024-07-01 14:33:44 +00:00
Marek Wolan
f2db8b0fb5 Merge remote-tracking branch 'origin/feature/2438-application-install-action-refactor' into feature/2700-application-configure-actions 2024-07-01 15:26:19 +01:00
Marek Wolan
bf8ec60833 #2700 Add configure dosbot action 2024-07-01 15:25:20 +01:00
Marek Wolan
ab73ac20e8 #2700 add ransomware configure action 2024-07-01 14:41:41 +01:00
Czar Echavez
4dd50be11a #2620: run notebooks after test so that the results can be published 2024-07-01 14:31:58 +01:00
Charlie Crane
96f62a3229 Merged PR 436: 2656 - Implement Optional Negative Reward
## Summary
This PR implements an "ActionPenalty" Reward class, that can be used for penalising an agent when it carries out an action other than DONOTHING.

The value for this can be configured within the scenario YAML file.

## Test process
I've written unit tests to check that the action penalty is correctly calculated and applied, another to check that the config is read correctly and loads into PrimaiteGymEnv correctly.

## Checklist
- [X] PR is linked to a **work item**
- [X] **acceptance criteria** of linked ticket are met
- [X] performed **self-review** of the code
- [X] written **tests** for any new functionality added with this PR
- [ ] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [ ] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

Related work items: #2656
2024-07-01 13:25:05 +00:00
Marek Wolan
2dd7546f3d 2705 Fix application tests by correctly renaming fixture 2024-07-01 13:25:16 +01:00