#1943: web server + client + tests + a few improvements to syslogging

This commit is contained in:
Czar.Echavez
2023-10-03 14:59:48 +01:00
parent 161d441ad6
commit 4b5a73bd32
24 changed files with 536 additions and 112 deletions

View File

@@ -1,4 +1,8 @@
from primaite.simulator.network.hardware.base import NIC, Node
from primaite.simulator.system.applications.web_browser import WebBrowser
from primaite.simulator.system.services.dns.dns_client import DNSClient
from primaite.simulator.system.services.ftp.ftp_client import FTPClient
from primaite.simulator.system.services.ftp.ftp_server import FTPServer
class Computer(Node):
@@ -36,3 +40,18 @@ class Computer(Node):
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.connect_nic(NIC(ip_address=kwargs["ip_address"], subnet_mask=kwargs["subnet_mask"]))
self._install_system_software()
def _install_system_software(self):
"""Install System Software - software that is usually provided with the OS."""
# DNS Client
self.software_manager.install(DNSClient)
# FTP
self.software_manager.install(FTPClient)
self.software_manager.install(FTPServer)
# Web Browser
self.software_manager.install(WebBrowser)
super()._install_system_software()

View File

@@ -596,6 +596,8 @@ class Router(Node):
self.arp.nics = self.nics
self.icmp.arp = self.arp
self._install_system_software()
def _get_port_of_nic(self, target_nic: NIC) -> Optional[int]:
"""
Retrieve the port number for a given NIC.

View File

@@ -34,6 +34,8 @@ class Switch(Node):
port.parent = self
port.port_num = port_num
self._install_system_software()
def show(self, markdown: bool = False):
"""
Prints a table of the SwitchPorts on the Switch.