Commit Graph

1090 Commits

Author SHA1 Message Date
Czar Echavez
a4d372d3eb #2151: utilise set_health_state method instead of directly changing software states 2024-01-09 16:29:40 +00:00
Czar Echavez
9eb0102069 Merge remote-tracking branch 'origin/dev' into bugfix/2151-service-status-set-to-overwhelmed-at-incorrect-actions 2024-01-09 15:29:49 +00:00
Czar Echavez
6fc4e15660 #2151: remove changing of health_state_actual in actions and tests 2024-01-09 15:18:31 +00:00
Marek Wolan
91addee09d Merged PR 248: Make observation flattening optional for agents.
## Summary
Same as other PR but this time we are merging into DEV.

The Proxy agent has a new config option, `flatten_obs`. If true, we use gymnasium flatten.

## Test process
Unit tests and inspection.

Related work items: #2143, #2154, #2161
2024-01-09 14:28:36 +00:00
Marek Wolan
5d89820a15 Apply PR review suggestions 2024-01-09 12:38:01 +00:00
Christopher McCarthy
7c0ab1a19e Merged PR 243: #2139 - Implemented routing
## Summary
- Integrated the RouteTable into the Routers frame processing.
- Frames are now dropped when their TTL reaches 0

## Test process
Added five tests that check routing passes and fails with correct/incorrect route tables.

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

#2139 - Implemented routing

Related work items: #2139
2024-01-08 11:17:16 +00:00
Chris McCarthy
8b43f6abe3 #2139 - updated docstring in send_arp_request function in base.py 2024-01-08 10:30:38 +00:00
Chris McCarthy
59d1a6668e #2139 - Updated the CHANGELOG.md with broadcast entry 2024-01-05 22:19:54 +00:00
Chris McCarthy
d2d628b676 #2139 - Fixed unicast and broadcast functionality properly 2024-01-05 22:11:37 +00:00
Chris McCarthy
ddf7fbf88b #2139 - Included a test that tests services over multi-hop routing. Added some PR suggestions around logging. 2024-01-05 15:27:10 +00:00
Marek Wolan
d038f63fda Clear notebook output 2024-01-05 13:11:47 +00:00
Marek Wolan
f75c10aafb Make flattening observation spaces optional. 2024-01-05 13:10:49 +00:00
Marek Wolan
b8312b8a2b Merged PR 244: Make pcap and sys logging optional (beta 4)
## Summary
Very straightforward change. Just added some config parameters to make pcap and sys logs optional. These options default to false.

## Test process
Verified that both options produce the desired result by running a primaite session with logs enabled and disabled in the config. Unit tests still 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
- [ ] 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
- [x] 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: #2143, #2154
2024-01-05 12:40:13 +00:00
Marek Wolan
4266618ba5 Make pcap logs and sys logs optional 2024-01-05 11:25:57 +00:00
Marek Wolan
81734e7ad3 Merged PR 241: Add service patch and fix apply timestep issues.
## Summary
Replaces Action ID 13 in UC2 with SERVICE.PATCH.
Fixes issue where apply_timestep was not happening at all
Fixes issue where file actions were not correctly being forwarded

## Test process
All pytests passing including a new one for service patch.

## 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: #2143
2024-01-05 09:58:16 +00:00
Marek Wolan
bc08db6b7e Merged PR 240: Add service patch action and fix some clangers.
## Summary
- Replaces Action ID 13 in UC2 with SERVICE.PATCH.
- Fixes issue where `apply_timestep` was not happening at all
- Fixes issue where file actions were not correctly being forwarded

## Test process
Unit tests passing
Running primaite session works without errors
Ran primaite session on UC2 in debug mode and inspected that correct changes are being reflected after actions are applied.

## 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**
- [ ] ran **pre-commit** checks for code style
- [ ] attended to any **TO-DOs** left in the code

Related work items: #2143
2024-01-05 09:56:33 +00:00
Marek Wolan
7d81b1cb07 Merged PR 242: Change software describe state keys
## Summary
Tiny change to change the names of the keys in `software.describe_state()`
Also fixed the observation to use the visible health state instead of the actual health state (and therefore the blue agent will actually have to scan to learn the health state)

## Test process
Unit 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
- [ ] 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

Change software describe state keys

Related work items: #2160
2024-01-04 14:50:37 +00:00
Marek Wolan
bc367222a8 Change software describe state keys 2024-01-04 12:55:46 +00:00
Marek Wolan
3adf1f9f6a bump version 2024-01-03 14:49:40 +00:00
Marek Wolan
2aa7c18ad3 Merge remote-tracking branch 'origin/dev' into bugfix/2143-node-service-patch-main 2024-01-03 14:43:46 +00:00
Chris McCarthy
ade5f133d0 #2139 - Implemented routing 2023-12-22 10:31:11 +00:00
Marek Wolan
2135bdcd10 Add unit test 2023-12-21 16:08:09 +00:00
Marek Wolan
fa585168de update marl config with service patch bugfix 2023-12-21 15:10:23 +00:00
Marek Wolan
96f8435c5e Add service patch and fix other bugs 2023-12-21 15:07:41 +00:00
Marek Wolan
e33f74e3f2 bump version to 3.0.0b3dev 2023-12-21 09:28:14 +00:00
Marek Wolan
ffeb04d6ed Merged PR 235: Refactor describe_state to use name/hostname instead of UUID as primary key
## Summary
- Refactor Simulator state to use service/application name instead of UUID, and node hostname instead of UUID.
- Refactor observations to read the hostname/name instead of UUID.
- Refactor rewards as well.
- Refactor configs to specify name instead of reference that will be translated to UUID.

## Test process
Existing unit tests pass. Inspected the printout from running 'describe_state' on arcd_uc2_network' to verify that names are used to report state.

## Checklist
- [x] PR is linked to a **work item**
- [x] **acceptance criteria** of linked ticket are met
- [x] performed **self-review** of the code
- [na] written **tests** for any new functionality added with this PR
- [na] updated the **documentation** if this PR changes or adds functionality
- [x] written/updated **design docs** if this PR implements new functionality
- [na] 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: #2131
2023-12-15 16:02:29 +00:00
Nick Todd
360a86188c Merged PR 233: NTP server and client
## Summary
The NTP Server and Client are created as two separate classes NTPServer and NTPClient which define the methods used to send and receive time data. A set of classes used in the sending and receiving of requests and data is in ntp.py. A single file, test_ntp_client_server.py is used to run the unit tests.
The changes have no impact on other parts of the codebase.

## Test process
Created simple two node network representing NTP server and client. Created NTP server and client objects and client requests and receives date/time from server.

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

Related work items: #2041, #2042
2023-12-15 14:26:17 +00:00
Marek Wolan
7a1abb1ef8 Minor fixes based on code review 2023-12-15 13:09:50 +00:00
Nick Todd
2d892d4a5a 2041: Tidy up test comments 2023-12-15 10:52:46 +00:00
Nick Todd
0cfd525ab8 2041: change comparison operator in test 2023-12-15 10:14:35 +00:00
Nick Todd
fab39b1506 Merge branch 'dev' into feature/2041_2042-Add-NTP-Services 2023-12-15 09:50:19 +00:00
Marek Wolan
6a80f4cc77 Make game layer work with new state api 2023-12-14 14:04:43 +00:00
Marek Wolan
1ec7df1170 Change describe_state to use names instead of uuids 2023-12-14 11:19:32 +00:00
Czar Echavez
0aeaeaa60f Merged PR 234: #2059: Denial of Service Bot
## Summary
- Moved DataManipulationBot into red applications - these are applications, not services
- moved the connection handling from Service base class to the IOSoftware base class
  - Applications and Services can track the connections they make
  - increased default max sessions to 100
  - made sure the services/applications that are dependent on connections use the IOSoftware connections
- DoSBot follows some sort of kill chain, although at the moment it just:
  - runs a port scan with a 10% success chance (by default)
  - runs a DoS attack that fills a service's max sessions

## Test process
unit test in https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/234?path=/tests/unit_tests/_primaite/_simulator/_system/_applications/_red_applications/test_dos_bot.py&_a=files

integration test in https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/234?path=/tests/integration_tests/system/red_applications/test_dos_bot_and_server.py&_a=files

## 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: #2059
2023-12-14 10:16:34 +00:00
Czar Echavez
592e1a3610 #2059: apply suggestions from PR + adding another test that checks for dos affecting green agent 2023-12-13 11:56:25 +00:00
Nick Todd
f7b5c8ae2f 2041: Remove NTPRequest class (review comment) 2023-12-13 10:34:52 +00:00
Czar Echavez
f0be77c79b #2059: configure missing configurable items 2023-12-12 17:20:31 +00:00
Nick Todd
e620771c8d 2041: Remove IP address from NTP client (review comment) 2023-12-12 17:08:11 +00:00
Czar Echavez
4f79d2ad36 #2059: moved connection handling from Service to IOSoftware + changes that now utilise connections from IOSoftware + dos bot attacking now works + tests 2023-12-12 17:01:03 +00:00
Czar Echavez
1b124035a1 Merge remote-tracking branch 'origin/dev' into feature/2059-denial-of-service-bot-post-beta-2 2023-12-11 08:57:59 +00:00
Czar Echavez
cd5ed48b00 #2059: implementing the service connections limit 2023-12-08 17:07:57 +00:00
Czar Echavez
094e89fff1 #2059: Renamed Red service to red application and moved the datamanipulation bot to the red application folder 2023-12-08 14:54:29 +00:00
Nick Todd
c3015b7f0e Merge branch 'dev' into feature/2041_2042-Add-NTP-Services 2023-12-07 14:55:01 +00:00
Nick Todd
44ada941e6 2041: Reinstate test for ntp_server failure 2023-12-07 14:22:27 +00:00
Marek Wolan
e93fb85672 Merged PR 232: Allow cancelling jobs
## Summary
Fix the azure build pipeline job conditions to correctly stop the job if we cancel the build.

Related work items: #2103
2023-12-07 13:49:08 +00:00
Marek Wolan
385a4997ce New parameter for publishing code coverage 2023-12-07 10:35:50 +00:00
Nick Todd
50a6e17fab 2041: Make NTP work with TCP transport layer 2023-12-06 16:42:28 +00:00
Nick Todd
12ede2329b 2041: Add network config and pytest fixture 2023-12-06 16:41:10 +00:00
Marek Wolan
75f732dacf bump version to 3.0.0b2 2023-12-04 13:08:13 +00:00
Marek Wolan
30b0f12a8d Allow cancelling jobs 2023-12-04 11:34:17 +00:00