Commit Graph

604 Commits

Author SHA1 Message Date
Marek Wolan
61fa83a00d Fix failing test 2023-08-31 14:55:14 +01:00
Marek Wolan
bd5aacaf0c Remove todo comments 2023-08-31 11:32:11 +01:00
Marek Wolan
f60f775f03 Improve logging 2023-08-31 11:27:52 +01:00
Marek Wolan
7759c178bb Add logging and service restarting 2023-08-31 11:20:16 +01:00
Marek Wolan
62be66205c Fix unit tests 2023-08-31 10:57:45 +01:00
Marek Wolan
40d3e04e64 Move init action manager function to the top 2023-08-29 14:33:28 +01:00
Marek Wolan
f0b82cbdfb Add ability to uninstall service 2023-08-29 14:15:49 +01:00
Marek Wolan
9c8b7a7b7a Merge remote-tracking branch 'origin/feature/1789-add-convenience-methods-to-network-object' into feature/1801-Database 2023-08-29 13:22:14 +01:00
Marek Wolan
94325d1fde Add Install method to software. 2023-08-29 13:21:34 +01:00
Marek Wolan
7b61322e70 Add service actions 2023-08-29 12:34:41 +01:00
Marek Wolan
1eff41c786 Update docs based on new action options 2023-08-29 11:10:29 +01:00
Marek Wolan
319e87d200 Make changes to the way actions work 2023-08-28 22:34:20 +01:00
Marek Wolan
6e602aa151 Fix unit tests by removing warning checks 2023-08-25 17:56:05 +01:00
Marek Wolan
ae6e835955 Apply suggestions from code review. 2023-08-25 15:58:07 +01:00
Marek Wolan
a9e969aa13 init work on database 2023-08-25 15:29:53 +01:00
Marek Wolan
2dd191bf32 Merge branch 'feature/1789-add-convenience-methods-to-network-object' into feature/1801-Database 2023-08-24 14:41:09 +01:00
Marek Wolan
05bb0f295b Update notebook tutorial on creating a simulation 2023-08-24 13:06:45 +01:00
Marek Wolan
fec44aef53 Rename connect_nodes to connect and fix minor bug 2023-08-24 13:03:16 +01:00
Marek Wolan
78008e3c6e Fix container test 2023-08-24 12:52:38 +01:00
Marek Wolan
7058c7e9a8 Rename networkcontainer to network 2023-08-24 12:41:46 +01:00
Marek Wolan
a818de8f01 Add ability to connect nodes via the network. 2023-08-24 12:40:00 +01:00
Marek Wolan
f38b423886 Update comment 2023-08-24 10:27:30 +01:00
Marek Wolan
4077eb3a5c Add tests for network node adding/removal 2023-08-24 10:26:17 +01:00
Marek Wolan
01e8501bc1 Merged PR 169: Connect all components and add describe_state() methods
## Summary
- Add an object that holds the entire simulation, and a container for the network that keeps track of a list of nodes and links.
- Implement `describe_state()` for all existing sim components and take advantage of the inheritance relationships to avoid repetition.
- Fix some minor mistakes like typehints and indentation errors.
- Write a jupyter notebook which uses the python API to create a simulation and verify that it's `describe_state()` method outputs a correct value.
- Currently the notebook creates the simulation in a janky way, because the API for simulation creation is not fleshed out yet. Further tickets have been added to the backlog to address some of these shortcomings. They are:
  - #1790

## Test process
I have tested that the notebook runs and that after populating a simulation, the describe_state function returns a dictionary full of only serialisable data types.

## Checklist
- [y] This PR is linked to a **work item**
- [y] I have performed **self-review** of the code
- [~] I have written **tests** for any new functionality added with this PR
- [n] I have updated the **documentation** if this PR changes or adds functionality
- [na] I have written/updated **design docs** if this PR implements new functionality
- [y] I have update the **change log**
- [y] I have run **pre-commit** checks for code style

Note:
This ticket also makes a small amount of progress against: #1705, it adds a shell of a network class, but only by creating the class, not implementing any functionality.

Related work items: #1787
2023-08-23 15:24:17 +00:00
Marek Wolan
a82ffb9747 Add notebook outputs back into src control 2023-08-23 15:44:23 +01:00
Marek Wolan
72b019287a Add scratch notebook to gitignore. 2023-08-23 14:41:59 +01:00
Marek Wolan
1613bbe27a Add methods for adding/removing nodes form network 2023-08-23 14:41:30 +01:00
Marek Wolan
7e64acd368 Update container docstrings 2023-08-21 10:04:23 +01:00
Marek Wolan
07b740a81e Update docs and changelog. 2023-08-21 09:49:31 +01:00
Marek Wolan
7c16a9cdde Update notebook 2023-08-20 18:43:21 +01:00
Marek Wolan
3911010777 update notebook 2023-08-20 18:42:58 +01:00
Marek Wolan
01c912c094 fix type hints and describe state functions 2023-08-20 18:38:02 +01:00
Marek Wolan
6ca53803cd Describe state 2023-08-17 15:32:12 +01:00
Marek Wolan
ced45d4275 Connect actions of top-level sim components 2023-08-16 16:45:52 +01:00
Czar Echavez
d972fcc07e Merged PR 164: File System Class setup fixing tests
## Summary
Attempting to fix a test which seems to be broken when integrated with https://dev.azure.com/ma-dev-uk/PrimAITE/_git/PrimAITE/pullrequest/160

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

## Checklist
- [x] This PR is linked to a **work item**
- [x] I have performed **self-review** of the code
- [x] I have written **tests** for any new functionality added with this PR
- [ ] I have updated the **documentation** if this PR changes or adds functionality
- [ ] I have written/updated **design docs** if this PR implements new functionality.
- [x] I have run **pre-commit** checks for code style

#1714: fixing minor error in test + adding a check for existing uuid when adding file

Related work items: #1714
2023-08-14 08:27:09 +00:00
Czar Echavez
c4aacb8c69 #1714: Change file and folder uuid checking to check for file or folder names already existing 2023-08-11 15:33:07 +01:00
Christopher McCarthy
1b84d28c48 Merged PR 161: Working base Node class
## Summary
- Network Hardware - Added base hardware module with NIC, SwitchPort, Node, Switch, and Link. Nodes and Switches have
fundamental services like ARP, ICMP, and PCAP running them by default.
- Network Transmission - Modelled OSI Model layers 1 through to 5 with various classes for creating network frames and
transmitting them from a Service/Application, down through the layers, over the wire, and back up through the layers to
a Service/Application another machine.
- system - Added the core structure of Application, Services, and Components. Also added a SoftwareManager and
SessionManager.

- #1706 - Got the core Node class build and working with ARP and the ability to ping another node. Added some basic tests in. Next job is to create the Node subclasses. Then move ARP and ICMP into a ser
- #1706 - Added some extra logging
- #1706 - Started adding the core node software required by all nodes. Made some tweaks to the Frame to have send and receive timestamp.
- #1706 - Got the code services, application, and process base classes stubbed out. Need them now so that I can leverage them for core node services required.
- #1706 - Tidied up the SysLog ARPCache, and ICMP classes and integrated them into the Node. Tidied up the base implementation of SoftwareManager and SessionManager. Tidies up the public API for Service

## Test process
Tests really asses how components fit together and that it all does work. They tests don't yet check that things like ICMP work, as in the ping is received and responded to.

## Checklist
- [X] This PR is linked to a **work item**
- [X] I have performed **self-review** of the code
- [X] I have written **tests** for any new functionality added with this PR
- [X] I have updated the **documentation** if this PR changes or adds functionality
- [X] I have written/updated **design docs** if this PR implements new functionality.
- [X] I have run **pre-commit** checks for code style

Related work items: #1706
2023-08-10 14:30:04 +00:00
Chris McCarthy
49f855c320 #1706 - Synced with Dev 2023-08-10 13:33:32 +01:00
Chris McCarthy
b902d945ee Merge remote-tracking branch 'devops/dev' into feature/1706_node_class_and_node_type_subclasses
# Conflicts:
#	CHANGELOG.md
#	src/primaite/simulator/core.py
2023-08-10 13:29:14 +01:00
Chris McCarthy
9ee0ef2fd6 #1706 - Applied some final changes from PR. Fixed the PCAP log name on SwitchPort so that a pcap file is generated for each port. 2023-08-10 13:26:51 +01:00
Marek Wolan
586f210402 Merged PR 160: Permission system, account skeleton, and group skeleton
## Summary
This PR implements an outline of accounts and domain controller. However, the main contribution is the permissions system and the changes to `SimComponent`. The domain skeleton will probably change after the node/folder/file/app/service classes exist.

The big idea of the permissions is that the simulator itself is built in a way that permits everything, i.e. the methods of each component that make something happen don't have any permissions checking. Therefore, if you can use primaite without any agents and you will essentially have superadmin, any action you perform will go through. The permissions come into play when you try to interact with the components via the actions. Every action has a configurable permission validator attached to it that will either allow or block the action.

For this reason, I've had to modify the way actions work. To keep everything neatly contained, there is a new Action class that holds a reference to both the action function itself but also to a permission validation function.

## Test process
Unit tests and integration tests.
I will write the design documentation for permissions and update the design for SimComponent once others are happy that the design makes sense.

## Checklist
- [x] This PR is linked to a **work item**
- [x] I have performed **self-review** of the code
- [x] I have written **tests** for any new functionality added with this PR
- [x] I have updated the **documentation** if this PR changes or adds functionality
- [x] I have updated the **changelog**
- [ ] I have written/updated **design docs** if this PR implements new functionality
- [x] I have run **pre-commit** checks for code style

Related work items: #1716
2023-08-10 12:07:38 +00:00
Marek Wolan
e24d4b8890 Fix typo in test 2023-08-10 09:14:45 +01:00
Chris McCarthy
ad81a81949 #1706 - Applied some code suggestions from the PR 2023-08-09 20:38:45 +01:00
Chris McCarthy
b46057841d #1706 - Refactored a bunch of if statements in base.py to improve readability 2023-08-09 20:31:42 +01:00
Marek Wolan
34ff9abd7a Apply changes from code review. 2023-08-09 15:55:28 +01:00
Czar Echavez
cf241366dc #1714: apply suggestions for preventing addition of objects with similar uuid 2023-08-09 15:15:45 +01:00
Marek Wolan
f198a8b94d Fix bad merge 2023-08-09 12:36:09 +01:00
Marek Wolan
51baabb35b Update enums to uppercase in docs 2023-08-09 12:34:56 +01:00
Marek Wolan
596bbaacde Change enum strings to uppercase 2023-08-09 12:06:06 +01:00
Czar Echavez
572f457231 #1714: fixing minor error in test + adding a check for existing uuid when adding file 2023-08-09 11:19:58 +01:00