From dff976b3366d7ee2b0171e5475d75269ee66fa81 Mon Sep 17 00:00:00 2001 From: Nick Todd Date: Thu, 16 Jan 2025 16:32:55 +0000 Subject: [PATCH] #2888: Fix merge test failures. --- src/primaite/game/game.py | 2 +- .../system/services/database/database_service.py | 2 ++ .../simulator/system/services/dns/dns_server.py | 1 + tests/assets/configs/bad_primaite_session.yaml | 6 +++--- tests/assets/configs/multi_agent_session.yaml | 6 +++--- .../red_applications/test_c2_suite_integration.py | 11 +++++------ 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/primaite/game/game.py b/src/primaite/game/game.py index 5523c33c..a02f2b26 100644 --- a/src/primaite/game/game.py +++ b/src/primaite/game/game.py @@ -376,7 +376,7 @@ class PrimaiteGame: if service_class is not None: _LOGGER.debug(f"installing {service_type} on node {new_node.hostname}") - new_node.software_manager.install(service_class, **service_cfg.get("options", {})) + new_node.software_manager.install(service_class) new_service = new_node.software_manager.software[service_class.__name__] # fixing duration for the service diff --git a/src/primaite/simulator/system/services/database/database_service.py b/src/primaite/simulator/system/services/database/database_service.py index f16b4125..4ba4c4d4 100644 --- a/src/primaite/simulator/system/services/database/database_service.py +++ b/src/primaite/simulator/system/services/database/database_service.py @@ -30,6 +30,7 @@ class DatabaseService(Service, identifier="DatabaseService"): """ConfigSchema for DatabaseService.""" type: str = "DatabaseService" + backup_server_ip: Optional[IPv4Address] = None config: "DatabaseService.ConfigSchema" = Field(default_factory=lambda: DatabaseService.ConfigSchema()) @@ -51,6 +52,7 @@ class DatabaseService(Service, identifier="DatabaseService"): kwargs["protocol"] = PROTOCOL_LOOKUP["TCP"] super().__init__(**kwargs) self._create_db_file() + self.backup_server_ip = self.config.backup_server_ip def install(self): """ diff --git a/src/primaite/simulator/system/services/dns/dns_server.py b/src/primaite/simulator/system/services/dns/dns_server.py index 46008ddf..3a1c0e18 100644 --- a/src/primaite/simulator/system/services/dns/dns_server.py +++ b/src/primaite/simulator/system/services/dns/dns_server.py @@ -21,6 +21,7 @@ class DNSServer(Service, identifier="DNSServer"): """ConfigSchema for DNSServer.""" type: str = "DNSServer" + domain_mapping: dict = {} config: "DNSServer.ConfigSchema" = Field(default_factory=lambda: DNSServer.ConfigSchema()) diff --git a/tests/assets/configs/bad_primaite_session.yaml b/tests/assets/configs/bad_primaite_session.yaml index c83cadc8..6f6a5cfd 100644 --- a/tests/assets/configs/bad_primaite_session.yaml +++ b/tests/assets/configs/bad_primaite_session.yaml @@ -588,9 +588,9 @@ simulation: default_gateway: 192.168.1.1 services: - type: DNSServer - options: - domain_mapping: - arcd.com: 192.168.1.12 # web server + # options: + # domain_mapping: + # arcd.com: 192.168.1.12 # web server - type: server hostname: web_server diff --git a/tests/assets/configs/multi_agent_session.yaml b/tests/assets/configs/multi_agent_session.yaml index a2d64605..29836971 100644 --- a/tests/assets/configs/multi_agent_session.yaml +++ b/tests/assets/configs/multi_agent_session.yaml @@ -1380,9 +1380,9 @@ simulation: default_gateway: 192.168.1.1 services: - type: DNSServer - options: - domain_mapping: - arcd.com: 192.168.1.12 # web server + # options: + # domain_mapping: + # arcd.com: 192.168.1.12 # web server - hostname: web_server type: server diff --git a/tests/integration_tests/system/red_applications/test_c2_suite_integration.py b/tests/integration_tests/system/red_applications/test_c2_suite_integration.py index 6eab7361..40226be6 100644 --- a/tests/integration_tests/system/red_applications/test_c2_suite_integration.py +++ b/tests/integration_tests/system/red_applications/test_c2_suite_integration.py @@ -496,12 +496,11 @@ def test_c2_suite_yaml(): computer_b: Computer = yaml_network.get_node_by_hostname("node_b") c2_beacon: C2Beacon = computer_b.software_manager.software.get("C2Beacon") c2_beacon.configure( - c2_server_ip_address=c2_beacon.config.c2_server_ip_address, - keep_alive_frequency=c2_beacon.config.keep_alive_frequency, - masquerade_port=c2_beacon.config.masquerade_port, - masquerade_protocol=c2_beacon.config.masquerade_protocol, - ) - + c2_server_ip_address=c2_beacon.config.c2_server_ip_address, + keep_alive_frequency=c2_beacon.config.keep_alive_frequency, + masquerade_port=c2_beacon.config.masquerade_port, + masquerade_protocol=c2_beacon.config.masquerade_protocol, + ) assert c2_server.operating_state == ApplicationOperatingState.RUNNING