Commit Graph

1398 Commits

Author SHA1 Message Date
Cristian-VM2
944b248300 #2404 rename software patch to fix 2024-03-26 10:51:33 +00:00
Cristian-VM2
600dc3f016 #2404 add application scan, close, and fix actions, fix and enable service scan test 2024-03-25 16:58:27 +00:00
Cristian Genes
8b8940f465 Merged PR 314: Add actions to enable/disable ports in routers/firewalls
## Summary
Added actions to enable/disable ports for routers/firewalls
Added tests for routers and added ticket in the backlog to test on firewalls (it's not possible to test at the moment because the game_and_agent fixture cannot build from a yaml file)

Improved the notebook for training sb3 agents on UC2 to include validated value for learning rate and fix for loading sb3 PPO from IY as well as code to evaluate agents

## Test process
Run new tests locally

## 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: #2403
2024-03-25 12:34:21 +00:00
Cristian-VM2
78b966ace4 fix port/nic enable/disable actions returning failure when they succeed 2024-03-25 11:41:07 +00:00
Cristian-VM2
4a5dd9ba0f fix typo 2024-03-25 11:08:36 +00:00
Cristian-VM2
bef2bd8084 add actions to enable/disable ports in routers/firewalls, improve notebook for training PPO agents 2024-03-22 16:35:53 +00:00
Marek Wolan
cb9c14c87e Merged PR 310: Pull last-minute beta 7 changes into dev
## Summary
the step label for actions was off by one from the step label in the step metadata log. Also the last episode was not outputting an action log because the reset method wasn't being called (there's a close method for this instead).

## Test process
Notebooks, pytests

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

Related work items: #2230
2024-03-18 10:39:01 +00:00
Marek Wolan
bb01619918 Bump version 2024-03-15 16:17:45 +00:00
Marek Wolan
b4d310eda2 Align step counts in logging 2024-03-15 16:17:38 +00:00
Marek Wolan
a8c98c28f1 Merge remote-tracking branch 'origin/dev' into release/3.0.0b7 2024-03-15 16:13:50 +00:00
Czar Echavez
d5fb2f2309 Merged PR 307: #2369: commiting work done so far
## Summary
Added a page to explain how to use the Jupyter notebooks via jupyter command and VSCode

Also added Nick's suggestion to fix #2226

Going to be honest - not my finest pull request

## 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
- [ ] 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

#2369: commiting work done so far

Related work items: #2369
2024-03-15 15:59:42 +00:00
Nick Todd
d8b75a33e4 Merged PR 309: 2384: Updates for 3.0.0b7 release.
## Summary
Updated CHANGELOG.md, lightly edited and corrected.

## 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
- [X] updated the **documentation** if this PR changes or adds functionality
- [ ] written/updated **design docs** if this PR implements new functionality
- [X] updated the **change log**
- [X] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

2384: Updates for 3.0.0b7 release.

Related work items: #2384
2024-03-15 15:06:22 +00:00
Marek Wolan
b217869dd1 Improve clarity in docs 2024-03-15 15:03:27 +00:00
Marek Wolan
fc67fc4833 Fix notebook parsing data 2024-03-15 14:37:28 +00:00
Marek Wolan
9a38fcdae2 Fix broken config 2024-03-15 14:19:30 +00:00
Marek Wolan
8a9d8fb17c Calm logging again 2024-03-15 14:10:34 +00:00
Marek Wolan
7f4f3e9bfe Calm logging 2024-03-15 14:09:02 +00:00
Marek Wolan
c8beb39fac clear notebook output 2024-03-15 14:03:49 +00:00
Marek Wolan
33dd6e4dcd Make sure notebook is using correct dict key 2024-03-15 14:03:37 +00:00
Nick Todd
6f780f20d7 2384: Updates for 3.0.0b7 release. 2024-03-15 13:55:00 +00:00
Marek Wolan
d9b6506572 Mention python version in getting started guide. 2024-03-15 13:42:59 +00:00
Marek Wolan
6ce96f00fe Merge branch 'feature/2369-document-how-to-use-primaite-notebooks' of https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE into feature/2369-document-how-to-use-primaite-notebooks 2024-03-15 13:25:54 +00:00
Marek Wolan
2fde071789 Update docs on example notebooks 2024-03-15 13:25:50 +00:00
Marek Wolan
505f9dfb09 Merge remote-tracking branch 'origin/dev' into feature/2369-document-how-to-use-primaite-notebooks 2024-03-15 13:25:30 +00:00
Marek Wolan
40ba8c5ac0 Merged PR 308: Fix stubborn logs and default config values
## Summary
Ensure that the logging options are being read correctly from the config. Makes logs actually optional.

Also temporarily disable checkhash and replace it with file scan because checkhash is buggy.

## Test process
By inspection

## 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
- [x] attended to any **TO-DOs** left in the code

Fix some stuff

Related work items: #2382
2024-03-15 13:20:26 +00:00
Czar Echavez
e580fa0464 Merge remote-tracking branch 'origin/dev' into feature/2369-document-how-to-use-primaite-notebooks 2024-03-15 13:14:31 +00:00
Czar Echavez
1ed2f48f54 #2369: missed items 2024-03-15 13:13:54 +00:00
Marek Wolan
e0eef8e56e Fix tests 2024-03-15 12:19:56 +00:00
Marek Wolan
04c86e30c9 Fix some stuff 2024-03-15 11:15:02 +00:00
Marek Wolan
d257501703 Merged PR 304: Reward sharing
## Summary
* add ability for agents to share rewards - the calculated reward value for one agent can be used as a component of another agent's reward.
* Update UC2 configs to use the reward sharing functionality - green agents have a reward based on their two actions. Blue agent reward adds green agent rewards to itself.
* Add agent action history - This allows the rewards to react to agent actions.
* Make action logging use the new agent history.
* Make the webpage and database reward components treat failed requests the same as if the webpage was unavailable / database was unreachable.
* reorder the PrimaiteGame step to be the same as the Gymnasium env step
* update uc2 notebook accordingly.

## Test process
Tested with ad-hoc notebooks and debugging tool to verify correct data is being used. Tested notebooks run properly and pytests pass. Added unit and integration tests.

## 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: #2372
2024-03-15 10:42:12 +00:00
Marek Wolan
a9bf0981e6 Doc fixes 2024-03-15 09:22:55 +00:00
Czar Echavez
1d09f0791a #2369: Reduce dependency on manually replacing primaite version across documentation 2024-03-14 23:17:34 +00:00
Czar Echavez
88a3c42f2f #2369: commiting work done so far 2024-03-14 22:15:27 +00:00
Marek Wolan
d33c80d0d6 Minor fixes 2024-03-14 14:33:04 +00:00
Marek Wolan
f438acf745 Add shared reward test 2024-03-13 14:01:17 +00:00
Marek Wolan
ee26554ef0 merge origin/dev into feature branch 2024-03-13 12:11:50 +00:00
Marek Wolan
10ee9b300f Update docs on rewards 2024-03-13 12:08:20 +00:00
Czar Echavez
c7c34e1fb6 Merged PR 301: #2350: Confirm action / observation space conforms to CAOS v0.7
## Summary
### **work related to v0.7 CAOS**
- Split observations.py into:
  - agent_observations.py
  - file_system_observations.py
  - node_observations.py
  - nic_observations.py
  - observation_manager.py
  - observations.py
  - software_observations.py
- added tests to ensure that the observations align with [QTSL-820-2450 - ARCD Track 2 Common Action Observation Space Definition v0.7](https://nscuk.sharepoint.com//r/sites/SSE32ARCDIDT/Shared%20Documents/General/ARCD/Architecture%20%26%20Design%20Documentation/Common/CAOS%20Related%20Documents/QTSL-820-2450%20-%20ARCD%20Track%202%20Common%20Action%20Observation%20Space%20Definition%20v0.7.xlsx?d=wee5713d8640b4b5bb3cb5624936e417e&csf=1&web=1&e=lByVQ5)

### preparation for v0.8 CAOS
WILL NOT AFFECT OBSERVATION SPACE FOR V0.7

**DO NOT PANIC**

these features are needed for v0.8

- integrated `num_access` to file (not used yet in file observations)
- integrated `num_file_deletions` and `num_file_creations` to file_system (not used yet in node observations)

## 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

Related work items: #2350
2024-03-13 09:20:23 +00:00
Marek Wolan
6dedb91099 Remove redundant TODOs 2024-03-13 09:17:29 +00:00
Czar Echavez
f2c6f10c21 #2350: apply PR suggestions 2024-03-12 12:20:02 +00:00
Marek Wolan
045f467407 Update marl config 2024-03-12 11:51:17 +00:00
Marek Wolan
24fdb8dc17 Fix minor reward sharing bugs 2024-03-12 11:40:26 +00:00
Marek Wolan
03ee976a2d remove extra print statement 2024-03-12 11:00:55 +00:00
Marek Wolan
a76f5b0efb Merge remote-tracking branch 'origin/dev' into feature/2327-green-action-failure-part-II 2024-03-12 10:59:41 +00:00
Czar Echavez
ec4818e4d3 Merge remote-tracking branch 'origin/dev' into feature/2350-confirm-action-observation-space-conforms-to-CAOS-0.7 2024-03-12 09:11:30 +00:00
Marek Wolan
c3f1cfb33d Add shared reward 2024-03-11 22:53:39 +00:00
Marek Wolan
7599655879 Add agent action history 2024-03-11 20:10:08 +00:00
Marek Wolan
f46980b5f5 Merged PR 302: Make simulator requests able to provide a response
this PR is a pre-requisite to the work im doing today where green agents actions that fail to reach their target still incur a negative reward.

## Summary
- Requests now return a response.
- Added the request response to the agent logging and info output of env step.
- Changed all request types in the simulator to return a response
- Added a new 'validator' that allows nodes to execute actions only if the node is on (this check happens at the request level rather than in every single function)
- Fixed NMNE - made nic observation responsible for converting total NMNE this episode to NMNE last step because apply_timestep is applied after actions but before observations in the step method.
- Fixed arcd_uc2_network to configure the db clients and web browsers correctly
- Added tests for request responses

## Test process
New tests, existing tests pass.

## 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
- [x] attended to any **TO-DOs** left in the code

Related work items: #2372
2024-03-11 19:48:18 +00:00
Czar Echavez
cd6d6325db #2350: add tests to check spaces + acl obs test + nmne space changes 2024-03-11 17:47:33 +00:00
Marek Wolan
1faefbccac Add docstring for init request manager 2024-03-11 10:20:47 +00:00