From a4b787860442cfa17e611edd8baac726eaab306d Mon Sep 17 00:00:00 2001 From: Czar Echavez Date: Thu, 8 Feb 2024 10:36:07 +0000 Subject: [PATCH] #2258: added NTPClient to system software + testing all installable software on client1 in config --- .../network/hardware/nodes/computer.py | 4 ++++ .../configs/basic_switched_network.yaml | 22 ++++++++++++++++--- tests/integration_tests/game_configuration.py | 7 +++--- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/primaite/simulator/network/hardware/nodes/computer.py b/src/primaite/simulator/network/hardware/nodes/computer.py index 0480aca9..9b076647 100644 --- a/src/primaite/simulator/network/hardware/nodes/computer.py +++ b/src/primaite/simulator/network/hardware/nodes/computer.py @@ -2,6 +2,7 @@ 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.ntp.ntp_client import NTPClient class Computer(Node): @@ -49,6 +50,9 @@ class Computer(Node): # FTP self.software_manager.install(FTPClient) + # NTP + self.software_manager.install(NTPClient) + # Web Browser self.software_manager.install(WebBrowser) diff --git a/tests/assets/configs/basic_switched_network.yaml b/tests/assets/configs/basic_switched_network.yaml index f20fedce..774c4aa2 100644 --- a/tests/assets/configs/basic_switched_network.yaml +++ b/tests/assets/configs/basic_switched_network.yaml @@ -89,9 +89,25 @@ simulation: payload: "DELETE" server_ip: 192.168.1.14 services: - - ref: client_1_dns_client - type: DNSClient - + - ref: client_1_dns_server + type: DNSServer + options: + domain_mapping: + arcd.com: 192.168.1.12 # web server + - ref: client_1_database_client + type: DatabaseClient + options: + db_server_ip: 192.168.10.21 + - ref: client_1_database_service + type: DatabaseService + options: + backup_server_ip: 192.168.10.21 + - ref: client_1_web_service + type: WebServer + - ref: client_1_ftp_server + type: FTPServer + - ref: client_1_ntp_server + type: NTPServer - ref: client_2 type: computer hostname: client_2 diff --git a/tests/integration_tests/game_configuration.py b/tests/integration_tests/game_configuration.py index 00c94d9e..ff977082 100644 --- a/tests/integration_tests/game_configuration.py +++ b/tests/integration_tests/game_configuration.py @@ -12,6 +12,7 @@ from primaite.simulator.network.hardware.nodes.computer import Computer 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.ntp.ntp_client import NTPClient from tests import TEST_ASSETS_ROOT BASIC_CONFIG = TEST_ASSETS_ROOT / "configs/basic_switched_network.yaml" @@ -58,7 +59,7 @@ def test_node_software_install(): client_1: Computer = game.simulation.network.get_node_by_hostname("client_1") client_2: Computer = game.simulation.network.get_node_by_hostname("client_2") - system_software = {DNSClient, FTPClient, WebBrowser} + system_software = {DNSClient, FTPClient, NTPClient, WebBrowser} # check that system software is installed on client 1 for software in system_software: @@ -73,5 +74,5 @@ def test_node_software_install(): assert client_1.software_manager.software.get(applications) is not None # check that services have been installed on client 1 - # for service in SERVICE_TYPES_MAPPING: - # assert client_1.software_manager.software.get(service) is not None + for service in SERVICE_TYPES_MAPPING: + assert client_1.software_manager.software.get(service) is not None