From 7b85af4a56d91ba8bb2efeb9937b831b729c7419 Mon Sep 17 00:00:00 2001 From: Patrik Spiess Date: Wed, 23 Oct 2024 08:53:42 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=93=9D=20Add=20layers=20of=20fotoobo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WHATSNEW.md | 2 + .../architecture/5_building_block_view.rst | 56 +- .../diagrams/fotoobo_layers.drawio.svg | 496 ++++++++++++++++++ .../diagrams/package_structure.drawio.svg | 38 +- 4 files changed, 572 insertions(+), 20 deletions(-) create mode 100644 docs/source/developer/architecture/diagrams/fotoobo_layers.drawio.svg diff --git a/WHATSNEW.md b/WHATSNEW.md index 6b5dca8..d26d880 100644 --- a/WHATSNEW.md +++ b/WHATSNEW.md @@ -1,5 +1,7 @@ ### Added +- Add the layers of fotoobo into the architecture documentation + ### Changed ### Removed diff --git a/docs/source/developer/architecture/5_building_block_view.rst b/docs/source/developer/architecture/5_building_block_view.rst index 526b6f7..a43a94f 100644 --- a/docs/source/developer/architecture/5_building_block_view.rst +++ b/docs/source/developer/architecture/5_building_block_view.rst @@ -7,10 +7,64 @@ 5. Building Block View ====================== +The layers of fotoobo +--------------------- + +There are three designated layers in **fotoobo**. These are the interface layer, the business logic +layer and the infrastructure layer. + +.. image:: diagrams/fotoobo_layers.drawio.svg + :width: 100% + :alt: The layers of fotoobo visualized + +In this diagram you see the designated paths to use when accessing a Fortinet device. Although these +are the recommended ways to use it, you may also access the layers in other ways. Just keep in mind +there always should be a rational and understandable approach. + + +The Interface Layer +^^^^^^^^^^^^^^^^^^^ + +This is the main entry point for interaction with **fotoobo** when you installed it as an +application on your system. It acts as a frontend for users and automated tools. At the Moment only +the CLI part is implemented. In future version an API may be available if there is a need for it. + +Call **fotoobo** with its command(s) directly from the command line or from any automation engine +like cron jobs, Rundeck or others. + +The Business Logic Layer +^^^^^^^^^^^^^^^^^^^^^^^^ + +At this level you have access to specific use cases. These are called **tools** in **fotoobo**. Any +CLI command or API endpoint should point to such a **tool** which then interacts with the +infrastructure layer. + +Whenever you use **fotoobo** as a module in your own code (instead of using it as an installed +application) you may directly access this layer. + +The Infrastructure Layer +^^^^^^^^^^^^^^^^^^^^^^^^ + +In this lowest level of **fotoobo** we directly interact with the infrastructure, meaning we handle +the authentication and API calls to the devices like FortiGate, FortiManger and others. The +interface layer should not directly access this infrastructure layer. Instead there should always +be a **tool** at the business logic layer which connects these two. No other layer than the +infrastructure layer should directly access any fortinet device. + +As a module in you own code you may also directly use the infrastructure layer. + + Package structure ----------------- -The package structure describes the internal structure of **fotoobo**. +The package structure describes the internal structure of **fotoobo**. The following diagram +visualizes the top level modules in the code. There are direct associations for these modules to +the layers of **fotoobo**: + +* cli: Interface Layer +* tools: Business Logic Layer +* fortinet: Infrastructure Layer + .. image:: diagrams/package_structure.drawio.svg :width: 100% diff --git a/docs/source/developer/architecture/diagrams/fotoobo_layers.drawio.svg b/docs/source/developer/architecture/diagrams/fotoobo_layers.drawio.svg new file mode 100644 index 0000000..80ed111 --- /dev/null +++ b/docs/source/developer/architecture/diagrams/fotoobo_layers.drawio.svg @@ -0,0 +1,496 @@ + + + + + + + + + + + + + + +
+
+
+ + Infrastructure + +
+
+ + Layer + +
+
+
+
+
+ + Infrastructure... + +
+
+ + + + +
+
+
+ + Interface + +
+
+ + Layer + +
+
+
+
+
+ + Interface... + +
+
+ + + + +
+
+
+ + Business Logic +
+
+ + Layer + +
+
+
+
+
+
+ + Business Logic... + +
+
+ + + + + + + +
+
+
+
+ + CLI + +
+
+
+
+
+ + CLI + +
+
+ + + + +
+
+
+
+ + API + +
+
+
+
+
+ + API + +
+
+ + + + +
+
+
+ Returns: output to console or file +
+
+
+
+ + Returns: output to console or... + +
+
+ + + + +
+
+
+ GET /fgt/version +
+ DELETE /fmg/global/address +
+
+
+
+ + GET /fgt/version... + +
+
+ + + + +
+
+
+ fgt get version +
+ fgt monitor hamaster +
+
+
+
+ + fgt get version... + +
+
+ + + + +
+
+
+ Returns: json +
+
+
+
+ + Returns: json + +
+
+ + + + +
+
+
+
+ + High Level Methods + +
+
+
+
+
+ + High Level Methods + +
+
+ + + + +
+
+
+
+ + Low Level Methods + +
+
+
+
+
+ + Low Level Methods + +
+
+ + + + +
+
+
+
+ + Native Methods + +
+
+
+
+
+ + Native Methods + +
+
+ + + + +
+
+
+ fgt/get/version() +
+ fgt/monitor/hamaster() +
+
+
+
+ + fgt/get/version()... + +
+
+ + + + +
+
+
+ fortigate/get_version() +
+ fortimanager/get_adoms() +
+
+
+
+ + fortigate/get_version()... + +
+
+ + + + +
+
+
+ fortigate/api() +
+ fortimanager/api_get() +
+
+
+
+ + fortigate/api()... + +
+
+ + + + +
+
+
+ Returns: fotoobo Result +
+
+
+
+ + Returns: fotoobo Result + +
+
+ + + + +
+
+
+ Returns: Datastructure +
+
+
+
+ + Returns: Datastructure + +
+
+ + + + +
+
+
+ Returns: requests.Response +
+
+
+
+ + Returns: requests.Response + +
+
+ + + + + + + + + +
+
+
+ + User + +
+
+
+
+ + User + +
+
+ + + + +
+
+
+
+ + Machine + +
+
+
+
+
+ + Machine + +
+
+ + + + + + + + +
+
+
+
+ + External + +
+
+ + Scripts + +
+
+
+
+
+ + External... + +
+
+ + + + + + + + +
+
+
+ FortiGate +
+
+
+
+ + FortiGate + +
+
+ + + + +
+
+
+ FortiGate +
+
+
+
+ + FortiGate + +
+
+
+ + + + + Text is not SVG - cannot display + + + +
\ No newline at end of file diff --git a/docs/source/developer/architecture/diagrams/package_structure.drawio.svg b/docs/source/developer/architecture/diagrams/package_structure.drawio.svg index f23a534..8a916d9 100644 --- a/docs/source/developer/architecture/diagrams/package_structure.drawio.svg +++ b/docs/source/developer/architecture/diagrams/package_structure.drawio.svg @@ -1,4 +1,4 @@ - + @@ -43,13 +43,13 @@
- Fortinet + fortinet
- Fortinet + fortinet @@ -145,13 +145,13 @@
- Fortinet + fortinet
- Fortinet + fortinet @@ -162,13 +162,13 @@
- FortiAnalyzer + fortianalyzer
- FortiAnalyzer + fortianalyzer @@ -179,13 +179,13 @@
- FortiGate + fortigate
- FortiGate + fortigate @@ -196,13 +196,13 @@
- FortiManager + fortimanager
- FortiManager + fortimanager @@ -281,13 +281,13 @@
- FortiClientEMS + forticlientems
- FortiClientEMS + forticlientems @@ -361,7 +361,7 @@ -
+
tools @@ -369,7 +369,7 @@
- + tools @@ -417,7 +417,7 @@ -
+
inventory @@ -425,7 +425,7 @@
- + inventory @@ -471,7 +471,7 @@ -
+
exceptions @@ -479,7 +479,7 @@
- + exceptions From 24bf77fface433c1b43ca4865c19f78d0288453e Mon Sep 17 00:00:00 2001 From: Patrik Spiess Date: Fri, 25 Oct 2024 08:40:14 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A9=B9=20Minor=20fixes=20and=20improv?= =?UTF-8?q?ements?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../architecture/5_building_block_view.rst | 9 +- .../diagrams/fotoobo_layers.drawio.svg | 108 ++++++++++++------ 2 files changed, 81 insertions(+), 36 deletions(-) diff --git a/docs/source/developer/architecture/5_building_block_view.rst b/docs/source/developer/architecture/5_building_block_view.rst index a43a94f..1fd15cf 100644 --- a/docs/source/developer/architecture/5_building_block_view.rst +++ b/docs/source/developer/architecture/5_building_block_view.rst @@ -26,8 +26,9 @@ The Interface Layer ^^^^^^^^^^^^^^^^^^^ This is the main entry point for interaction with **fotoobo** when you installed it as an -application on your system. It acts as a frontend for users and automated tools. At the Moment only -the CLI part is implemented. In future version an API may be available if there is a need for it. +application on your system. It acts as a frontend for users and automation tools. At the Moment only +the CLI part is implemented. In future version a REST API may be available if there is a need for +it. Call **fotoobo** with its command(s) directly from the command line or from any automation engine like cron jobs, Rundeck or others. @@ -48,10 +49,10 @@ The Infrastructure Layer In this lowest level of **fotoobo** we directly interact with the infrastructure, meaning we handle the authentication and API calls to the devices like FortiGate, FortiManger and others. The interface layer should not directly access this infrastructure layer. Instead there should always -be a **tool** at the business logic layer which connects these two. No other layer than the +be a **tool** in the business logic layer which connects these two. No other layer than the infrastructure layer should directly access any fortinet device. -As a module in you own code you may also directly use the infrastructure layer. +As a module in your own code you may also directly use the infrastructure layer. Package structure diff --git a/docs/source/developer/architecture/diagrams/fotoobo_layers.drawio.svg b/docs/source/developer/architecture/diagrams/fotoobo_layers.drawio.svg index 80ed111..b20fa78 100644 --- a/docs/source/developer/architecture/diagrams/fotoobo_layers.drawio.svg +++ b/docs/source/developer/architecture/diagrams/fotoobo_layers.drawio.svg @@ -1,13 +1,23 @@ - + - + - + + + + + + + + + + + @@ -116,7 +126,7 @@
- API + REST API
@@ -124,7 +134,7 @@
- API + REST API @@ -132,7 +142,7 @@ -
+
Returns: output to console or file @@ -140,8 +150,8 @@
- - Returns: output to console or... + + Returns: output to console or f... @@ -187,7 +197,7 @@ -
+
Returns: json @@ -195,7 +205,7 @@
- + Returns: json @@ -324,7 +334,7 @@ -
+
Returns: fotoobo Result @@ -332,7 +342,7 @@
- + Returns: fotoobo Result @@ -341,7 +351,7 @@ -
+
Returns: Datastructure @@ -349,7 +359,7 @@
- + Returns: Datastructure @@ -358,7 +368,7 @@ -
+
Returns: requests.Response @@ -366,7 +376,7 @@
- + Returns: requests.Response @@ -446,41 +456,75 @@ - - - - - + + -
-
-
+
+
+
FortiGate
- + FortiGate - + + + + -
-
-
- FortiGate +
+
+
+ FortiManager
- - FortiGate + + FortiManager + + + + + + + +
+
+
+ FortiAnalyzer +
+
+
+
+ + FortiAnalyzer + +
+
+ + + + +
+
+
+ FortiClientEMS +
+
+
+
+ + FortiClientEMS