#2257: setting up application and service docs

This commit is contained in:
Czar Echavez
2024-02-21 18:19:16 +00:00
parent deb7a3aa9d
commit 98fb28cbbc
19 changed files with 185 additions and 51 deletions

View File

@@ -20,16 +20,6 @@ e.g.
links: links:
... ...
**nodes:**
* ``type``: one of ``router``, ``switch``, ``computer``, or ``server``, this affects what other sub-options should be defined.
* ``hostname`` - a non-unique name used for logging and outputs.
* ``num_ports`` (optional, routers and switches only): number of network interfaces present on the device.
* ``ports`` (optional, routers and switches only): configuration for each network interface, including IP address and subnet mask.
* ``acl`` (Router only): Define the ACL rules at each index of the ACL on the router. the possible options are: ``action`` (PERMIT or DENY), ``src_port``, ``dst_port``, ``protocol``, ``src_ip``, ``dst_ip``. Any options left blank default to none which usually means that it will apply across all options. For example leaving ``src_ip`` blank will apply the rule to all IP addresses.
* ``services`` (computers and servers only): a list of services to install on the node. They must define a ``ref``, ``type``, and ``options`` that depend on which ``type`` was selected.
* ``applications`` (computer and servers only): Similar to services. A list of application to install on the node.
* ``network_interfaces`` (computers and servers only): If the node has multiple networking devices, the second, third, fourth, etc... must be defined here with an ``ip_address`` and ``subnet_mask``.
``nodes`` ``nodes``
--------- ---------

View File

@@ -3,39 +3,29 @@
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``ip_address`` ``ip_address``
^^^^^^^^^^^^^^ --------------
The IP address of the |NODE| in the network. The IP address of the |NODE| in the network.
``subnet_mask`` ``subnet_mask``
^^^^^^^^^^^^^^^ ---------------
Optional. Default value is ``255.255.255.0``. Optional. Default value is ``255.255.255.0``.
The subnet mask for the |NODE| to use. The subnet mask for the |NODE| to use.
``default_gateway`` ``default_gateway``
^^^^^^^^^^^^^^^^^^^ -------------------
The IP address that the |NODE| will use as the default gateway. Typically, this is the IP address of the closest router that the |NODE| is connected to. The IP address that the |NODE| will use as the default gateway. Typically, this is the IP address of the closest router that the |NODE| is connected to.
``dns_server`` ``dns_server``
^^^^^^^^^^^^^^ --------------
Optional. Default value is ``None`` Optional. Default value is ``None``
The IP address of the node which holds an instance of the DNS server. Some applications may use a domain name e.g. the WebBrowser (TODO: WebBrowser page) The IP address of the node which holds an instance of the DNS server. Some applications may use a domain name e.g. the WebBrowser (TODO: WebBrowser page)
``applications`` .. include:: ../software/applications.rst
^^^^^^^^^^^^^^^^
A list of applications which are not considered system software that need to be installed on the |NODE|. .. include:: ../software/services.rst
See :ref:`Applications <applications_config>`
``services``
^^^^^^^^^^^^
A list of services which are not considered system software that need to be installed on the |NODE|.
See :ref:`Services <services_config>`

View File

@@ -2,9 +2,30 @@
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
.. _applications_config:
``applications`` ``applications``
================ ----------------
apps List of available applications that can be installed on a |NODE|:
.. toctree::
:maxdepth: 1
../software/applications/data_manipulation_bot.rst
../software/applications/database_client.rst
../software/applications/dos_bot.rst
../software/applications/web_browser.rst
More info :py:mod:`primaite.game.game.APPLICATION_TYPES_MAPPING`
.. include:: ../software/common/system_software.rst
.. toctree::
:maxdepth: 1
../software/applications/web_browser.rst
More info :py:mod:`primaite.simulator.network.hardware.nodes.host.host_node.SYSTEM_SOFTWARE`
.. |SOFTWARE_TYPE| replace:: application
.. |SOFTWARE_TYPES| replace:: applications

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``DataManipulationBot``
-----------------------
test

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``DatabaseClient``
------------------
test

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``DoSBot``
----------
test

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``WebBrowser``
--------------
test

View File

@@ -0,0 +1,12 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``system software``
"""""""""""""""""""
Some |SOFTWARE_TYPES| are pre installed on nodes - this is similar to how some |SOFTWARE_TYPES| are included with the Operating System.
The |SOFTWARE_TYPE| may not be configured as needed, in which case, follow the steps above to configure them.
The list of |SOFTWARE_TYPES| that are considered system software are:

View File

@@ -2,9 +2,36 @@
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
.. _services_config:
``services`` ``services``
============ ------------
services List of available services that can be installed on a |NODE|:
.. toctree::
:maxdepth: 1
../software/services/database_service.rst
../software/services/dns_client.rst
../software/services/dns_server.rst
../software/services/ftp_client.rst
../software/services/ftp_server.rst
../software/services/ntp_client.rst
../software/services/ntp_server.rst
../software/services/web_server.rst
More info :py:mod:`primaite.game.game.SERVICE_TYPES_MAPPING`
.. include:: ../software/common/system_software.rst
.. toctree::
:maxdepth: 1
../software/services/dns_client.rst
../software/services/ftp_client.rst
../software/services/ntp_client.rst
More info :py:mod:`primaite.simulator.network.hardware.nodes.host.host_node.SYSTEM_SOFTWARE`
.. |SOFTWARE_TYPE| replace:: service
.. |SOFTWARE_TYPES| replace:: services

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``DatabaseService``
-------------------
test

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``DNSClient``
-------------
test

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``DNSServer``
-------------
test

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``FTPClient``
-------------
test

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``FTPServer``
-------------
test

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``NTPClient``
-------------
test

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``NTPServer``
-------------
test

View File

@@ -0,0 +1,8 @@
.. only:: comment
© Crown-owned copyright 2023, Defence Science and Technology Laboratory UK
``WebServer``
-------------
test

View File

@@ -41,6 +41,7 @@ APPLICATION_TYPES_MAPPING = {
"DataManipulationBot": DataManipulationBot, "DataManipulationBot": DataManipulationBot,
"DoSBot": DoSBot, "DoSBot": DoSBot,
} }
"""List of available applications that can be installed on nodes in the PrimAITE Simulation."""
SERVICE_TYPES_MAPPING = { SERVICE_TYPES_MAPPING = {
"DNSClient": DNSClient, "DNSClient": DNSClient,
@@ -52,6 +53,7 @@ SERVICE_TYPES_MAPPING = {
"NTPClient": NTPClient, "NTPClient": NTPClient,
"NTPServer": NTPServer, "NTPServer": NTPServer,
} }
"""List of available services that can be installed on nodes in the PrimAITE Simulation."""
class PrimaiteGameOptions(BaseModel): class PrimaiteGameOptions(BaseModel):

View File

@@ -261,6 +261,17 @@ class NIC(IPWiredNetworkInterface):
return f"Port {self.port_num}: {self.mac_address}/{self.ip_address}" return f"Port {self.port_num}: {self.mac_address}/{self.ip_address}"
SYSTEM_SOFTWARE = {
"HostARP": HostARP,
"ICMP": ICMP,
"DNSClient": DNSClient,
"FTPClient": FTPClient,
"NTPClient": NTPClient,
"WebBrowser": WebBrowser,
}
"""List of system software that is automatically installed on nodes."""
class HostNode(Node): class HostNode(Node):
""" """
Represents a host node in the network. Represents a host node in the network.
@@ -321,23 +332,8 @@ class HostNode(Node):
This method equips the host with essential network services and applications, preparing it for various This method equips the host with essential network services and applications, preparing it for various
network-related tasks and operations. network-related tasks and operations.
""" """
# ARP Service for _, software_class in SYSTEM_SOFTWARE.items():
self.software_manager.install(HostARP) self.software_manager.install(software_class)
# ICMP Service
self.software_manager.install(ICMP)
# DNS Client
self.software_manager.install(DNSClient)
# FTP Client
self.software_manager.install(FTPClient)
# NTP Client
self.software_manager.install(NTPClient)
# Web Browser
self.software_manager.install(WebBrowser)
super()._install_system_software() super()._install_system_software()