From e8e14ae68a11722a9c016881c71ff6eeb38ad016 Mon Sep 17 00:00:00 2001 From: Marek Wolan Date: Wed, 25 Oct 2023 13:56:02 +0100 Subject: [PATCH] Comment out tests for primaite v2 --- src/primaite/main.py | 16 +- .../legacy_config_1_DDOS_BASIC.yaml | 170 ------ .../legacy_config_2_DDOS_BASIC.yaml | 362 ------------ .../legacy_config_3_DOS_VERY_BASIC.yaml | 166 ------ .../legacy_config_5_DATA_MANIPULATION.yaml | 534 ------------------ .../legacy_training_config.yaml | 92 --- .../new_training_config.yaml | 114 ---- tests/config/obs_tests/laydown.yaml | 103 ---- tests/config/obs_tests/laydown_ACL.yaml | 86 --- .../main_config_ACCESS_CONTROL_LIST.yaml | 106 ---- .../main_config_LINK_TRAFFIC_LEVELS.yaml | 121 ---- .../main_config_NODE_LINK_TABLE.yaml | 118 ---- .../obs_tests/main_config_NODE_STATUSES.yaml | 115 ---- .../obs_tests/main_config_without_obs.yaml | 108 ---- ...ne_node_states_on_off_lay_down_config.yaml | 117 ---- .../one_node_states_on_off_main_config.yaml | 166 ------ .../ppo_not_seeded_training_config.yaml | 162 ------ tests/config/ppo_seeded_training_config.yaml | 161 ------ .../training_config_main_rllib.yaml | 164 ------ .../training_config_main_sb3.yaml | 164 ------ ..._space_fixed_blue_actions_main_config.yaml | 117 ---- .../single_action_space_lay_down_config.yaml | 45 -- .../single_action_space_main_config.yaml | 116 ---- tests/config/test_random_red_main_config.yaml | 164 ------ tests/config/train_episode_step.yaml | 154 ----- tests/conftest.py | 8 +- tests/test_acl.py | 14 +- tests/test_active_node.py | 8 +- tests/test_full_legacy_config_session.py | 1 + tests/test_lay_down_config.py | 15 +- tests/test_observation_space.py | 8 +- tests/test_primaite_session.py | 4 +- tests/test_red_random_agent_behaviour.py | 5 +- tests/test_resetting_node.py | 13 +- tests/test_reward.py | 1 + .../test_seeding_and_deterministic_session.py | 4 +- tests/test_service_node.py | 8 +- tests/test_session_loading.py | 13 +- tests/test_single_action_space.py | 9 +- tests/test_train_eval_episode_steps.py | 4 +- tests/test_training_config.py | 6 +- 41 files changed, 95 insertions(+), 3767 deletions(-) delete mode 100644 tests/config/legacy_conversion/legacy_config_1_DDOS_BASIC.yaml delete mode 100644 tests/config/legacy_conversion/legacy_config_2_DDOS_BASIC.yaml delete mode 100644 tests/config/legacy_conversion/legacy_config_3_DOS_VERY_BASIC.yaml delete mode 100644 tests/config/legacy_conversion/legacy_config_5_DATA_MANIPULATION.yaml delete mode 100644 tests/config/legacy_conversion/legacy_training_config.yaml delete mode 100644 tests/config/legacy_conversion/new_training_config.yaml delete mode 100644 tests/config/obs_tests/laydown.yaml delete mode 100644 tests/config/obs_tests/laydown_ACL.yaml delete mode 100644 tests/config/obs_tests/main_config_ACCESS_CONTROL_LIST.yaml delete mode 100644 tests/config/obs_tests/main_config_LINK_TRAFFIC_LEVELS.yaml delete mode 100644 tests/config/obs_tests/main_config_NODE_LINK_TABLE.yaml delete mode 100644 tests/config/obs_tests/main_config_NODE_STATUSES.yaml delete mode 100644 tests/config/obs_tests/main_config_without_obs.yaml delete mode 100644 tests/config/one_node_states_on_off_lay_down_config.yaml delete mode 100644 tests/config/one_node_states_on_off_main_config.yaml delete mode 100644 tests/config/ppo_not_seeded_training_config.yaml delete mode 100644 tests/config/ppo_seeded_training_config.yaml delete mode 100644 tests/config/session_test/training_config_main_rllib.yaml delete mode 100644 tests/config/session_test/training_config_main_sb3.yaml delete mode 100644 tests/config/single_action_space_fixed_blue_actions_main_config.yaml delete mode 100644 tests/config/single_action_space_lay_down_config.yaml delete mode 100644 tests/config/single_action_space_main_config.yaml delete mode 100644 tests/config/test_random_red_main_config.yaml delete mode 100644 tests/config/train_episode_step.yaml diff --git a/src/primaite/main.py b/src/primaite/main.py index 45cd0d8d..0cbcff0e 100644 --- a/src/primaite/main.py +++ b/src/primaite/main.py @@ -5,7 +5,8 @@ from pathlib import Path from typing import Optional, Union from primaite import getLogger -from primaite.primaite_session import PrimaiteSession + +# from primaite.primaite_session import PrimaiteSession _LOGGER = getLogger(__name__) @@ -31,13 +32,14 @@ def run( :param legacy_lay_down_config: True if the lay_down config file is a legacy file from PrimAITE < 2.0, otherwise False. """ - session = PrimaiteSession( - training_config_path, lay_down_config_path, session_path, legacy_training_config, legacy_lay_down_config - ) + # session = PrimaiteSession( + # training_config_path, lay_down_config_path, session_path, legacy_training_config, legacy_lay_down_config + # ) - session.setup() - session.learn() - session.evaluate() + # session.setup() + # session.learn() + # session.evaluate() + return NotImplemented if __name__ == "__main__": diff --git a/tests/config/legacy_conversion/legacy_config_1_DDOS_BASIC.yaml b/tests/config/legacy_conversion/legacy_config_1_DDOS_BASIC.yaml deleted file mode 100644 index 5db0ff24..00000000 --- a/tests/config/legacy_conversion/legacy_config_1_DDOS_BASIC.yaml +++ /dev/null @@ -1,170 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -- itemType: ACTIONS - type: NODE -- itemType: STEPS - steps: 128 -- itemType: PORTS - portsList: - - port: '80' -- itemType: SERVICES - serviceList: - - name: TCP -- itemType: NODE - id: '1' - name: PC1 - baseType: SERVICE - nodeType: COMPUTER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.1.2 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '2' - name: SERVER - baseType: SERVICE - nodeType: SERVER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.1.3 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '3' - name: PC2 - baseType: SERVICE - nodeType: COMPUTER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.1.4 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '4' - name: SWITCH1 - baseType: ACTIVE - nodeType: SWITCH - priority: P2 - hardwareState: 'ON' - ipAddress: 192.168.1.5 - softwareState: GOOD - fileSystemState: GOOD -- itemType: NODE - id: '5' - name: SWITCH2 - baseType: ACTIVE - nodeType: SWITCH - priority: P2 - hardwareState: 'ON' - ipAddress: 192.168.1.6 - softwareState: GOOD - fileSystemState: GOOD -- itemType: NODE - id: '6' - name: SWITCH3 - baseType: ACTIVE - nodeType: SWITCH - priority: P2 - hardwareState: 'ON' - ipAddress: 192.168.1.7 - softwareState: GOOD - fileSystemState: GOOD -- itemType: LINK - id: '7' - name: link1 - bandwidth: 1000000000 - source: '1' - destination: '4' -- itemType: LINK - id: '8' - name: link2 - bandwidth: 1000000000 - source: '4' - destination: '2' -- itemType: LINK - id: '9' - name: link3 - bandwidth: 1000000000 - source: '2' - destination: '5' -- itemType: LINK - id: '10' - name: link4 - bandwidth: 1000000000 - source: '2' - destination: '6' -- itemType: LINK - id: '11' - name: link5 - bandwidth: 1000000000 - source: '5' - destination: '3' -- itemType: LINK - id: '12' - name: link6 - bandwidth: 1000000000 - source: '6' - destination: '3' -- itemType: GREEN_IER - id: '13' - startStep: 1 - endStep: 128 - load: 100000 - protocol: TCP - port: '80' - source: '3' - destination: '2' - missionCriticality: 5 -- itemType: RED_POL - id: '14' - startStep: 50 - endStep: 50 - targetNodeId: '1' - initiator: DIRECT - type: SERVICE - protocol: TCP - state: COMPROMISED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- itemType: RED_IER - id: '15' - startStep: 60 - endStep: 100 - load: 1000000 - protocol: TCP - port: '80' - source: '1' - destination: '2' - missionCriticality: 0 -- itemType: RED_POL - id: '16' - startStep: 80 - endStep: 80 - targetNodeId: '2' - initiator: IER - type: SERVICE - protocol: TCP - state: COMPROMISED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- itemType: ACL_RULE - id: '17' - permission: ALLOW - source: ANY - destination: ANY - protocol: ANY - port: ANY diff --git a/tests/config/legacy_conversion/legacy_config_2_DDOS_BASIC.yaml b/tests/config/legacy_conversion/legacy_config_2_DDOS_BASIC.yaml deleted file mode 100644 index 2e791bb1..00000000 --- a/tests/config/legacy_conversion/legacy_config_2_DDOS_BASIC.yaml +++ /dev/null @@ -1,362 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -- itemType: ACTIONS - type: NODE -- itemType: STEPS - steps: 128 -- itemType: PORTS - portsList: - - port: '80' -- itemType: SERVICES - serviceList: - - name: TCP -- itemType: NODE - id: '1' - name: PC1 - baseType: SERVICE - nodeType: COMPUTER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.10.11 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '2' - name: PC2 - baseType: SERVICE - nodeType: COMPUTER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.10.12 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '3' - name: PC3 - baseType: SERVICE - nodeType: COMPUTER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.10.13 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '4' - name: PC4 - baseType: SERVICE - nodeType: COMPUTER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.20.14 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '5' - name: SWITCH1 - baseType: ACTIVE - nodeType: SWITCH - priority: P2 - hardwareState: 'ON' - ipAddress: 192.168.1.2 - softwareState: GOOD - fileSystemState: GOOD -- itemType: NODE - id: '6' - name: IDS - baseType: SERVICE - nodeType: SERVER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.1.4 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '7' - name: SWITCH2 - baseType: ACTIVE - nodeType: SWITCH - priority: P2 - hardwareState: 'ON' - ipAddress: 192.168.1.3 - softwareState: GOOD - fileSystemState: GOOD -- itemType: NODE - id: '8' - name: LOP1 - baseType: SERVICE - nodeType: LOP - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.1.12 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '9' - name: SERVER1 - baseType: SERVICE - nodeType: SERVER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.10.14 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '10' - name: SERVER2 - baseType: SERVICE - nodeType: SERVER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.20.15 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: LINK - id: '11' - name: link1 - bandwidth: 1000000000 - source: '1' - destination: '5' -- itemType: LINK - id: '12' - name: link2 - bandwidth: 1000000000 - source: '2' - destination: '5' -- itemType: LINK - id: '13' - name: link3 - bandwidth: 1000000000 - source: '3' - destination: '5' -- itemType: LINK - id: '14' - name: link4 - bandwidth: 1000000000 - source: '4' - destination: '5' -- itemType: LINK - id: '15' - name: link5 - bandwidth: 1000000000 - source: '5' - destination: '6' -- itemType: LINK - id: '16' - name: link6 - bandwidth: 1000000000 - source: '5' - destination: '8' -- itemType: LINK - id: '17' - name: link7 - bandwidth: 1000000000 - source: '6' - destination: '7' -- itemType: LINK - id: '18' - name: link8 - bandwidth: 1000000000 - source: '8' - destination: '7' -- itemType: LINK - id: '19' - name: link9 - bandwidth: 1000000000 - source: '7' - destination: '9' -- itemType: LINK - id: '20' - name: link10 - bandwidth: 1000000000 - source: '7' - destination: '10' -- itemType: GREEN_IER - id: '21' - startStep: 1 - endStep: 128 - load: 100000 - protocol: TCP - port: '80' - source: '1' - destination: '9' - missionCriticality: 2 -- itemType: GREEN_IER - id: '22' - startStep: 1 - endStep: 128 - load: 100000 - protocol: TCP - port: '80' - source: '2' - destination: '9' - missionCriticality: 2 -- itemType: GREEN_IER - id: '23' - startStep: 1 - endStep: 128 - load: 100000 - protocol: TCP - port: '80' - source: '9' - destination: '3' - missionCriticality: 5 -- itemType: GREEN_IER - id: '24' - startStep: 1 - endStep: 128 - load: 100000 - protocol: TCP - port: '80' - source: '4' - destination: '10' - missionCriticality: 2 -- itemType: ACL_RULE - id: '25' - permission: ALLOW - source: 192.168.10.11 - destination: 192.168.10.14 - protocol: TCP - port: 80 -- itemType: ACL_RULE - id: '26' - permission: ALLOW - source: 192.168.10.12 - destination: 192.168.10.14 - protocol: TCP - port: 80 -- itemType: ACL_RULE - id: '27' - permission: ALLOW - source: 192.168.10.13 - destination: 192.168.10.14 - protocol: TCP - port: 80 -- itemType: ACL_RULE - id: '28' - permission: ALLOW - source: 192.168.20.14 - destination: 192.168.20.15 - protocol: TCP - port: 80 -- itemType: ACL_RULE - id: '29' - permission: ALLOW - source: 192.168.10.14 - destination: 192.168.10.13 - protocol: TCP - port: 80 -- itemType: ACL_RULE - id: '30' - permission: DENY - source: 192.168.10.11 - destination: 192.168.20.15 - protocol: TCP - port: 80 -- itemType: ACL_RULE - id: '31' - permission: DENY - source: 192.168.10.12 - destination: 192.168.20.15 - protocol: TCP - port: 80 -- itemType: ACL_RULE - id: '32' - permission: DENY - source: 192.168.10.13 - destination: 192.168.20.15 - protocol: TCP - port: 80 -- itemType: ACL_RULE - id: '33' - permission: DENY - source: 192.168.20.14 - destination: 192.168.10.14 - protocol: TCP - port: 80 -- itemType: RED_POL - id: '34' - startStep: 20 - endStep: 20 - targetNodeId: '1' - initiator: DIRECT - type: SERVICE - protocol: TCP - state: COMPROMISED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- itemType: RED_POL - id: '35' - startStep: 20 - endStep: 20 - targetNodeId: '2' - initiator: DIRECT - type: SERVICE - protocol: TCP - state: COMPROMISED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- itemType: RED_IER - id: '36' - startStep: 30 - endStep: 128 - load: 440000000 - protocol: TCP - port: '80' - source: '1' - destination: '9' - missionCriticality: 0 -- itemType: RED_IER - id: '37' - startStep: 30 - endStep: 128 - load: 440000000 - protocol: TCP - port: '80' - source: '2' - destination: '9' - missionCriticality: 0 -- itemType: RED_POL - id: '38' - startStep: 30 - endStep: 30 - targetNodeId: '9' - initiator: IER - type: SERVICE - protocol: TCP - state: OVERWHELMED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA diff --git a/tests/config/legacy_conversion/legacy_config_3_DOS_VERY_BASIC.yaml b/tests/config/legacy_conversion/legacy_config_3_DOS_VERY_BASIC.yaml deleted file mode 100644 index 232dd8c7..00000000 --- a/tests/config/legacy_conversion/legacy_config_3_DOS_VERY_BASIC.yaml +++ /dev/null @@ -1,166 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -- itemType: ACTIONS - type: NODE -- itemType: STEPS - steps: 256 -- itemType: PORTS - portsList: - - port: '80' -- itemType: SERVICES - serviceList: - - name: TCP -- itemType: NODE - id: '1' - name: PC1 - baseType: SERVICE - nodeType: COMPUTER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.1.2 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '2' - name: PC2 - baseType: SERVICE - nodeType: COMPUTER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.1.3 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '3' - name: SWITCH1 - baseType: ACTIVE - nodeType: SWITCH - priority: P2 - hardwareState: 'ON' - ipAddress: 192.168.1.1 - softwareState: GOOD - fileSystemState: GOOD -- itemType: NODE - id: '4' - name: SERVER1 - baseType: SERVICE - nodeType: SERVER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.1.4 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: LINK - id: '5' - name: link1 - bandwidth: 1000000000 - source: '1' - destination: '3' -- itemType: LINK - id: '6' - name: link2 - bandwidth: 1000000000 - source: '2' - destination: '3' -- itemType: LINK - id: '7' - name: link3 - bandwidth: 1000000000 - source: '3' - destination: '4' -- itemType: GREEN_IER - id: '8' - startStep: 1 - endStep: 256 - load: 10000 - protocol: TCP - port: '80' - source: '1' - destination: '4' - missionCriticality: 1 -- itemType: GREEN_IER - id: '9' - startStep: 1 - endStep: 256 - load: 10000 - protocol: TCP - port: '80' - source: '2' - destination: '4' - missionCriticality: 1 -- itemType: GREEN_IER - id: '10' - startStep: 1 - endStep: 256 - load: 10000 - protocol: TCP - port: '80' - source: '4' - destination: '2' - missionCriticality: 5 -- itemType: ACL_RULE - id: '11' - permission: ALLOW - source: 192.168.1.2 - destination: 192.168.1.4 - protocol: TCP - port: 80 -- itemType: ACL_RULE - id: '12' - permission: ALLOW - source: 192.168.1.3 - destination: 192.168.1.4 - protocol: TCP - port: 80 -- itemType: ACL_RULE - id: '13' - permission: ALLOW - source: 192.168.1.4 - destination: 192.168.1.3 - protocol: TCP - port: 80 -- itemType: RED_POL - id: '14' - startStep: 20 - endStep: 20 - targetNodeId: '1' - initiator: DIRECT - type: SERVICE - protocol: TCP - state: COMPROMISED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- itemType: RED_IER - id: '15' - startStep: 30 - endStep: 256 - load: 10000000 - protocol: TCP - port: '80' - source: '1' - destination: '4' - missionCriticality: 0 -- itemType: RED_POL - id: '16' - startStep: 40 - endStep: 40 - targetNodeId: '4' - initiator: IER - type: SERVICE - protocol: TCP - state: OVERWHELMED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA diff --git a/tests/config/legacy_conversion/legacy_config_5_DATA_MANIPULATION.yaml b/tests/config/legacy_conversion/legacy_config_5_DATA_MANIPULATION.yaml deleted file mode 100644 index 6aa6a4ef..00000000 --- a/tests/config/legacy_conversion/legacy_config_5_DATA_MANIPULATION.yaml +++ /dev/null @@ -1,534 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -- itemType: ACTIONS - type: NODE -- itemType: STEPS - steps: 256 -- itemType: PORTS - portsList: - - port: '80' - - port: '1433' - - port: '53' -- itemType: SERVICES - serviceList: - - name: TCP - - name: TCP_SQL - - name: UDP -- itemType: NODE - id: '1' - name: CLIENT_1 - baseType: SERVICE - nodeType: COMPUTER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.10.11 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD - - name: UDP - port: '53' - state: GOOD -- itemType: NODE - id: '2' - name: CLIENT_2 - baseType: SERVICE - nodeType: COMPUTER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.10.12 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: NODE - id: '3' - name: SWITCH_1 - baseType: ACTIVE - nodeType: SWITCH - priority: P2 - hardwareState: 'ON' - ipAddress: 192.168.10.1 - softwareState: GOOD - fileSystemState: GOOD -- itemType: NODE - id: '4' - name: SECURITY_SUITE - baseType: SERVICE - nodeType: SERVER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.1.10 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD - - name: UDP - port: '53' - state: GOOD -- itemType: NODE - id: '5' - name: MANAGEMENT_CONSOLE - baseType: SERVICE - nodeType: SERVER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.1.12 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD - - name: UDP - port: '53' - state: GOOD -- itemType: NODE - id: '6' - name: SWITCH_2 - baseType: ACTIVE - nodeType: SWITCH - priority: P2 - hardwareState: 'ON' - ipAddress: 192.168.2.1 - softwareState: GOOD - fileSystemState: GOOD -- itemType: NODE - id: '7' - name: WEB_SERVER - baseType: SERVICE - nodeType: SERVER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.2.10 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD - - name: TCP_SQL - port: '1433' - state: GOOD -- itemType: NODE - id: '8' - name: DATABASE_SERVER - baseType: SERVICE - nodeType: SERVER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.2.14 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD - - name: TCP_SQL - port: '1433' - state: GOOD - - name: UDP - port: '53' - state: GOOD -- itemType: NODE - id: '9' - name: BACKUP_SERVER - baseType: SERVICE - nodeType: SERVER - priority: P5 - hardwareState: 'ON' - ipAddress: 192.168.2.16 - softwareState: GOOD - fileSystemState: GOOD - services: - - name: TCP - port: '80' - state: GOOD -- itemType: LINK - id: '10' - name: LINK_1 - bandwidth: 1000000000 - source: '1' - destination: '3' -- itemType: LINK - id: '11' - name: LINK_2 - bandwidth: 1000000000 - source: '2' - destination: '3' -- itemType: LINK - id: '12' - name: LINK_3 - bandwidth: 1000000000 - source: '3' - destination: '4' -- itemType: LINK - id: '13' - name: LINK_4 - bandwidth: 1000000000 - source: '3' - destination: '5' -- itemType: LINK - id: '14' - name: LINK_5 - bandwidth: 1000000000 - source: '4' - destination: '6' -- itemType: LINK - id: '15' - name: LINK_6 - bandwidth: 1000000000 - source: '5' - destination: '6' -- itemType: LINK - id: '16' - name: LINK_7 - bandwidth: 1000000000 - source: '6' - destination: '7' -- itemType: LINK - id: '17' - name: LINK_8 - bandwidth: 1000000000 - source: '6' - destination: '8' -- itemType: LINK - id: '18' - name: LINK_9 - bandwidth: 1000000000 - source: '6' - destination: '9' -- itemType: GREEN_IER - id: '19' - startStep: 1 - endStep: 256 - load: 10000 - protocol: TCP - port: '80' - source: '1' - destination: '7' - missionCriticality: 5 -- itemType: GREEN_IER - id: '20' - startStep: 1 - endStep: 256 - load: 10000 - protocol: TCP - port: '80' - source: '7' - destination: '1' - missionCriticality: 5 -- itemType: GREEN_IER - id: '21' - startStep: 1 - endStep: 256 - load: 10000 - protocol: TCP - port: '80' - source: '2' - destination: '7' - missionCriticality: 5 -- itemType: GREEN_IER - id: '22' - startStep: 1 - endStep: 256 - load: 10000 - protocol: TCP - port: '80' - source: '7' - destination: '2' - missionCriticality: 5 -- itemType: GREEN_IER - id: '23' - startStep: 1 - endStep: 256 - load: 5000 - protocol: TCP_SQL - port: '1433' - source: '7' - destination: '8' - missionCriticality: 5 -- itemType: GREEN_IER - id: '24' - startStep: 1 - endStep: 256 - load: 100000 - protocol: TCP_SQL - port: '1433' - source: '8' - destination: '7' - missionCriticality: 5 -- itemType: GREEN_IER - id: '25' - startStep: 1 - endStep: 256 - load: 50000 - protocol: TCP - port: '80' - source: '1' - destination: '9' - missionCriticality: 2 -- itemType: GREEN_IER - id: '26' - startStep: 1 - endStep: 256 - load: 50000 - protocol: TCP - port: '80' - source: '2' - destination: '9' - missionCriticality: 2 -- itemType: GREEN_IER - id: '27' - startStep: 1 - endStep: 256 - load: 5000 - protocol: TCP - port: '80' - source: '5' - destination: '7' - missionCriticality: 1 -- itemType: GREEN_IER - id: '28' - startStep: 1 - endStep: 256 - load: 5000 - protocol: TCP - port: '80' - source: '7' - destination: '5' - missionCriticality: 1 -- itemType: GREEN_IER - id: '29' - startStep: 1 - endStep: 256 - load: 5000 - protocol: TCP - port: '80' - source: '5' - destination: '8' - missionCriticality: 1 -- itemType: GREEN_IER - id: '30' - startStep: 1 - endStep: 256 - load: 5000 - protocol: TCP - port: '80' - source: '8' - destination: '5' - missionCriticality: 1 -- itemType: GREEN_IER - id: '31' - startStep: 1 - endStep: 256 - load: 5000 - protocol: TCP - port: '80' - source: '5' - destination: '9' - missionCriticality: 1 -- itemType: GREEN_IER - id: '32' - startStep: 1 - endStep: 256 - load: 5000 - protocol: TCP - port: '80' - source: '9' - destination: '5' - missionCriticality: 1 -- itemType: ACL_RULE - id: '33' - permission: ALLOW - source: 192.168.10.11 - destination: 192.168.2.10 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '34' - permission: ALLOW - source: 192.168.10.11 - destination: 192.168.2.14 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '35' - permission: ALLOW - source: 192.168.10.12 - destination: 192.168.2.14 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '36' - permission: ALLOW - source: 192.168.10.12 - destination: 192.168.2.10 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '37' - permission: ALLOW - source: 192.168.2.10 - destination: 192.168.10.11 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '38' - permission: ALLOW - source: 192.168.2.10 - destination: 192.168.10.12 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '39' - permission: ALLOW - source: 192.168.2.10 - destination: 192.168.2.14 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '40' - permission: ALLOW - source: 192.168.2.14 - destination: 192.168.2.10 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '41' - permission: ALLOW - source: 192.168.10.11 - destination: 192.168.2.16 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '42' - permission: ALLOW - source: 192.168.10.12 - destination: 192.168.2.16 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '43' - permission: ALLOW - source: 192.168.1.12 - destination: 192.168.2.10 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '44' - permission: ALLOW - source: 192.168.1.12 - destination: 192.168.2.14 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '45' - permission: ALLOW - source: 192.168.1.12 - destination: 192.168.2.16 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '46' - permission: ALLOW - source: 192.168.2.10 - destination: 192.168.1.12 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '47' - permission: ALLOW - source: 192.168.2.14 - destination: 192.168.1.12 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '48' - permission: ALLOW - source: 192.168.2.16 - destination: 192.168.1.12 - protocol: ANY - port: ANY -- itemType: ACL_RULE - id: '49' - permission: DENY - source: ANY - destination: ANY - protocol: ANY - port: ANY -- itemType: RED_POL - id: '50' - startStep: 50 - endStep: 50 - targetNodeId: '1' - initiator: DIRECT - type: SERVICE - protocol: UDP - state: COMPROMISED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- itemType: RED_IER - id: '51' - startStep: 75 - endStep: 105 - load: 10000 - protocol: UDP - port: '53' - source: '1' - destination: '8' - missionCriticality: 0 -- itemType: RED_POL - id: '52' - startStep: 100 - endStep: 100 - targetNodeId: '8' - initiator: IER - type: SERVICE - protocol: UDP - state: COMPROMISED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- itemType: RED_POL - id: '53' - startStep: 105 - endStep: 105 - targetNodeId: '8' - initiator: SERVICE - type: FILE - protocol: NA - state: CORRUPT - sourceNodeId: '8' - sourceNodeService: UDP - sourceNodeServiceState: COMPROMISED -- itemType: RED_POL - id: '54' - startStep: 105 - endStep: 105 - targetNodeId: '8' - initiator: SERVICE - type: SERVICE - protocol: TCP_SQL - state: COMPROMISED - sourceNodeId: '8' - sourceNodeService: UDP - sourceNodeServiceState: COMPROMISED -- itemType: RED_POL - id: '55' - startStep: 125 - endStep: 125 - targetNodeId: '7' - initiator: SERVICE - type: SERVICE - protocol: TCP - state: OVERWHELMED - sourceNodeId: '8' - sourceNodeService: TCP_SQL - sourceNodeServiceState: COMPROMISED diff --git a/tests/config/legacy_conversion/legacy_training_config.yaml b/tests/config/legacy_conversion/legacy_training_config.yaml deleted file mode 100644 index 3477e6e0..00000000 --- a/tests/config/legacy_conversion/legacy_training_config.yaml +++ /dev/null @@ -1,92 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Main Config File - -# Generic config values -# Choose one of these (dependent on Agent being trained) -# "STABLE_BASELINES3_PPO" -# "STABLE_BASELINES3_A2C" -# "GENERIC" -agentIdentifier: STABLE_BASELINES3_A2C -# Number of episodes to run per session -numEpisodes: 10 -# Time delay between steps (for generic agents) -timeDelay: 10 -# Filename of the scenario / laydown -configFilename: config_5_DATA_MANIPULATION.yaml -# Type of session to be run (TRAINING or EVALUATION) -sessionType: TRAINING -# Determine whether to load an agent from file -loadAgent: False -# File path and file name of agent if you're loading one in -agentLoadFile: C:\[Path]\[agent_saved_filename.zip] - -# Environment config values -# The high value for the observation space -observationSpaceHighValue: 1000000000 - -# Reward values -# Generic -allOk: 0 -# Node Hardware State -offShouldBeOn: -10 -offShouldBeResetting: -5 -onShouldBeOff: -2 -onShouldBeResetting: -5 -resettingShouldBeOn: -5 -resettingShouldBeOff: -2 -resetting: -3 -# Node Software or Service State -goodShouldBePatching: 2 -goodShouldBeCompromised: 5 -goodShouldBeOverwhelmed: 5 -patchingShouldBeGood: -5 -patchingShouldBeCompromised: 2 -patchingShouldBeOverwhelmed: 2 -patching: -3 -compromisedShouldBeGood: -20 -compromisedShouldBePatching: -20 -compromisedShouldBeOverwhelmed: -20 -compromised: -20 -overwhelmedShouldBeGood: -20 -overwhelmedShouldBePatching: -20 -overwhelmedShouldBeCompromised: -20 -overwhelmed: -20 -# Node File System State -goodShouldBeRepairing: 2 -goodShouldBeRestoring: 2 -goodShouldBeCorrupt: 5 -goodShouldBeDestroyed: 10 -repairingShouldBeGood: -5 -repairingShouldBeRestoring: 2 -repairingShouldBeCorrupt: 2 -repairingShouldBeDestroyed: 0 -repairing: -3 -restoringShouldBeGood: -10 -restoringShouldBeRepairing: -2 -restoringShouldBeCorrupt: 1 -restoringShouldBeDestroyed: 2 -restoring: -6 -corruptShouldBeGood: -10 -corruptShouldBeRepairing: -10 -corruptShouldBeRestoring: -10 -corruptShouldBeDestroyed: 2 -corrupt: -10 -destroyedShouldBeGood: -20 -destroyedShouldBeRepairing: -20 -destroyedShouldBeRestoring: -20 -destroyedShouldBeCorrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -redIerRunning: -5 -greenIerBlocked: -10 - -# Patching / Reset durations -osPatchingDuration: 5 # The time taken to patch the OS -nodeResetDuration: 5 # The time taken to reset a node (hardware) -nodeBootingDuration: 3 # The Time taken to turn on the node -nodeShutdownDuration: 2 # The time taken to turn off the node -servicePatchingDuration: 5 # The time taken to patch a service -fileSystemRepairingLimit: 5 # The time take to repair the file system -fileSystemRestoringLimit: 5 # The time take to restore the file system -fileSystemScanningLimit: 5 # The time taken to scan the file system diff --git a/tests/config/legacy_conversion/new_training_config.yaml b/tests/config/legacy_conversion/new_training_config.yaml deleted file mode 100644 index 1991eb06..00000000 --- a/tests/config/legacy_conversion/new_training_config.yaml +++ /dev/null @@ -1,114 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Main Config File - -# Generic config values - -# Sets which agent algorithm framework will be used: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray[RLlib]) -# "NONE" (Custom Agent) -agent_framework: SB3 - -# Sets which Red Agent algo/class will be used: -# "PPO" (Proximal Policy Optimization) -# "A2C" (Advantage Actor Critic) -# "HARDCODED" (Custom Agent) -# "RANDOM" (Random Action) -agent_identifier: PPO - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: ANY - -# Number of episodes for training to run per session -num_train_episodes: 10 - -# Number of time_steps for training per episode -num_train_steps: 256 - -# Number of episodes for evaluation to run per session -num_eval_episodes: 1 - -# Number of time_steps for evaluation per episode -num_eval_steps: 256 - - -# Time delay between steps (for generic agents) -time_delay: 10 -# Type of session to be run (TRAINING or EVALUATION) -session_type: TRAIN -# Determine whether to load an agent from file -load_agent: False -# File path and file name of agent if you're loading one in -agent_load_file: C:\[Path]\[agent_saved_filename.zip] - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1000000000 - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node Software or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/obs_tests/laydown.yaml b/tests/config/obs_tests/laydown.yaml deleted file mode 100644 index e358d0d2..00000000 --- a/tests/config/obs_tests/laydown.yaml +++ /dev/null @@ -1,103 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -- item_type: PORTS - ports_list: - - port: '80' - - port: '53' -- item_type: SERVICES - service_list: - - name: TCP - - name: UDP - -######################################## -# Nodes -- item_type: NODE - node_id: '1' - name: PC1 - node_class: SERVICE - node_type: COMPUTER - priority: P5 - hardware_state: 'ON' - ip_address: 192.168.1.1 - software_state: COMPROMISED - file_system_state: GOOD - services: - - name: TCP - port: '80' - state: GOOD - - name: UDP - port: '53' - state: GOOD -- item_type: NODE - node_id: '2' - name: SERVER - node_class: SERVICE - node_type: SERVER - priority: P5 - hardware_state: 'ON' - ip_address: 192.168.1.2 - software_state: GOOD - file_system_state: GOOD - services: - - name: TCP - port: '80' - state: GOOD - - name: UDP - port: '53' - state: OVERWHELMED -- item_type: NODE - node_id: '3' - name: SWITCH1 - node_class: ACTIVE - node_type: SWITCH - priority: P2 - hardware_state: 'ON' - ip_address: 192.168.1.3 - software_state: GOOD - file_system_state: GOOD - -######################################## -# Links -- item_type: LINK - id: '4' - name: link1 - bandwidth: 1000 - source: '1' - destination: '3' -- item_type: LINK - id: '5' - name: link2 - bandwidth: 1000 - source: '3' - destination: '2' - -######################################### -# IERS -- item_type: GREEN_IER - id: '5' - start_step: 0 - end_step: 5 - load: 999 - protocol: TCP - port: '80' - source: '1' - destination: '2' - mission_criticality: 5 - -######################################### -# ACL Rules -- item_type: ACL_RULE - id: '6' - permission: ALLOW - source: 192.168.1.1 - destination: 192.168.1.2 - protocol: TCP - port: 80 - position: 0 -- item_type: ACL_RULE - id: '7' - permission: ALLOW - source: 192.168.1.2 - destination: 192.168.1.1 - protocol: TCP - port: 80 - position: 0 diff --git a/tests/config/obs_tests/laydown_ACL.yaml b/tests/config/obs_tests/laydown_ACL.yaml deleted file mode 100644 index cffd8b1c..00000000 --- a/tests/config/obs_tests/laydown_ACL.yaml +++ /dev/null @@ -1,86 +0,0 @@ -- item_type: PORTS - ports_list: - - port: '80' - - port: '21' -- item_type: SERVICES - service_list: - - name: TCP - - name: FTP - -######################################## -# Nodes -- item_type: NODE - node_id: '1' - name: PC1 - node_class: SERVICE - node_type: COMPUTER - priority: P5 - hardware_state: 'ON' - ip_address: 192.168.1.1 - software_state: COMPROMISED - file_system_state: GOOD - services: - - name: TCP - port: '80' - state: GOOD - - name: FTP - port: '21' - state: GOOD -- item_type: NODE - node_id: '2' - name: SERVER - node_class: SERVICE - node_type: SERVER - priority: P5 - hardware_state: 'ON' - ip_address: 192.168.1.2 - software_state: GOOD - file_system_state: GOOD - services: - - name: TCP - port: '80' - state: GOOD - - name: FTP - port: '21' - state: OVERWHELMED -- item_type: NODE - node_id: '3' - name: SWITCH1 - node_class: ACTIVE - node_type: SWITCH - priority: P2 - hardware_state: 'ON' - ip_address: 192.168.1.3 - software_state: GOOD - file_system_state: GOOD - -######################################## -# Links -- item_type: LINK - id: '4' - name: link1 - bandwidth: 1000 - source: '1' - destination: '3' -- item_type: LINK - id: '5' - name: link2 - bandwidth: 1000 - source: '3' - destination: '2' - -######################################### -# IERS -- item_type: GREEN_IER - id: '5' - start_step: 0 - end_step: 5 - load: 999 - protocol: TCP - port: '80' - source: '1' - destination: '2' - mission_criticality: 5 - -######################################### -# ACL Rules diff --git a/tests/config/obs_tests/main_config_ACCESS_CONTROL_LIST.yaml b/tests/config/obs_tests/main_config_ACCESS_CONTROL_LIST.yaml deleted file mode 100644 index 927c9f44..00000000 --- a/tests/config/obs_tests/main_config_ACCESS_CONTROL_LIST.yaml +++ /dev/null @@ -1,106 +0,0 @@ -# Main Config File - -# Generic config values -# Choose one of these (dependent on Agent being trained) -# "STABLE_BASELINES3_PPO" -# "STABLE_BASELINES3_A2C" -# "GENERIC" -agent_framework: SB3 -agent_identifier: PPO -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: ANY -# Number of episodes for training to run per session -num_train_episodes: 1 -# Number of time_steps for training per episode -num_train_steps: 5 - -# Implicit ACL firewall rule at end of lists to be default action or no rule can be selected (ALLOW or DENY) -implicit_acl_rule: DENY -# Total number of ACL rules allowed in the environment -max_number_acl_rules: 3 - -observation_space: - components: - - name: ACCESS_CONTROL_LIST - -# Time delay between steps (for generic agents) -time_delay: 1 - -# Type of session to be run (TRAINING or EVALUATION) -session_type: TRAIN -# Determine whether to load an agent from file -load_agent: False -# File path and file name of agent if you're loading one in -agent_load_file: C:\[Path]\[agent_saved_filename.zip] - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1_000_000_000 - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node Software or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/obs_tests/main_config_LINK_TRAFFIC_LEVELS.yaml b/tests/config/obs_tests/main_config_LINK_TRAFFIC_LEVELS.yaml deleted file mode 100644 index 805ab31e..00000000 --- a/tests/config/obs_tests/main_config_LINK_TRAFFIC_LEVELS.yaml +++ /dev/null @@ -1,121 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: SB3 - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: A2C - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: ANY -# Number of episodes for training to run per session -num_train_episodes: 1 - -# Number of time_steps for training per episode -num_train_steps: 5 - -observation_space: - components: - - name: LINK_TRAFFIC_LEVELS - options: - combine_service_traffic: false - quantisation_levels: 8 - -# Time delay between steps (for generic agents) -time_delay: 1 - -# Implicit ACL firewall rule at end of lists to be default action or no rule can be selected (ALLOW or DENY) -implicit_acl_rule: ALLOW -# Total number of ACL rules allowed in the environment -max_number_acl_rules: 4 - -# Type of session to be run (TRAINING or EVALUATION) -session_type: TRAIN -# Determine whether to load an agent from file -load_agent: False -# File path and file name of agent if you're loading one in -agent_load_file: C:\[Path]\[agent_saved_filename.zip] - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1_000_000_000 - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node Software or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/obs_tests/main_config_NODE_LINK_TABLE.yaml b/tests/config/obs_tests/main_config_NODE_LINK_TABLE.yaml deleted file mode 100644 index 535558aa..00000000 --- a/tests/config/obs_tests/main_config_NODE_LINK_TABLE.yaml +++ /dev/null @@ -1,118 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: CUSTOM - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: RANDOM - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: ANY -# Number of episodes for training to run per session -num_train_episodes: 1 - -# Number of time_steps for training per episode -num_train_steps: 5 - -observation_space: - components: - - name: NODE_LINK_TABLE - -# Time delay between steps (for generic agents) -time_delay: 1 -# Filename of the scenario / laydown - -# Implicit ACL firewall rule at end of lists to be default action or no rule can be selected (ALLOW or DENY) -implicit_acl_rule: ALLOW -# Total number of ACL rules allowed in the environment -max_number_acl_rules: 4 - -session_type: TRAIN -# Determine whether to load an agent from file -load_agent: False -# File path and file name of agent if you're loading one in -agent_load_file: C:\[Path]\[agent_saved_filename.zip] - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1_000_000_000 - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node Software or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/obs_tests/main_config_NODE_STATUSES.yaml b/tests/config/obs_tests/main_config_NODE_STATUSES.yaml deleted file mode 100644 index d1319c35..00000000 --- a/tests/config/obs_tests/main_config_NODE_STATUSES.yaml +++ /dev/null @@ -1,115 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: CUSTOM - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: RANDOM - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: ANY -# Number of episodes for training to run per session -num_train_episodes: 1 - -# Number of time_steps for training per episode -num_train_steps: 5 - - -observation_space: - components: - - name: NODE_STATUSES - - -# Time delay between steps (for generic agents) -time_delay: 1 - -# Type of session to be run (TRAINING or EVALUATION) -session_type: TRAIN -# Determine whether to load an agent from file -load_agent: False -# File path and file name of agent if you're loading one in -agent_load_file: C:\[Path]\[agent_saved_filename.zip] - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1_000_000_000 - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node Software or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/obs_tests/main_config_without_obs.yaml b/tests/config/obs_tests/main_config_without_obs.yaml deleted file mode 100644 index 26457c84..00000000 --- a/tests/config/obs_tests/main_config_without_obs.yaml +++ /dev/null @@ -1,108 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: CUSTOM - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: RANDOM - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: ANY -# Number of episodes for training to run per session -num_train_episodes: 1 - -# Number of time_steps for training per episode -num_train_steps: 5 -# Time delay between steps (for generic agents) -time_delay: 1 -# Type of session to be run (TRAINING or EVALUATION) -session_type: TRAIN -# Determine whether to load an agent from file -load_agent: False -# File path and file name of agent if you're loading one in -agent_load_file: C:\[Path]\[agent_saved_filename.zip] - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1_000_000_000 -# Implicit ACL firewall rule at end of lists to be default action or no rule can be selected (ALLOW or DENY) -implicit_acl_rule: DENY -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node Software or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/one_node_states_on_off_lay_down_config.yaml b/tests/config/one_node_states_on_off_lay_down_config.yaml deleted file mode 100644 index 0f572d8d..00000000 --- a/tests/config/one_node_states_on_off_lay_down_config.yaml +++ /dev/null @@ -1,117 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -- item_type: PORTS - ports_list: - - port: '21' -- item_type: SERVICES - service_list: - - name: ftp -- item_type: NODE - node_id: '1' - name: node - node_class: SERVICE - node_type: COMPUTER - priority: P1 - hardware_state: 'ON' - ip_address: 192.168.0.1 - software_state: GOOD - file_system_state: GOOD - services: - - name: ftp - port: '21' - state: GOOD -- item_type: RED_POL - id: '1' - start_step: 1 - end_step: 3 - targetNodeId: '1' - initiator: DIRECT - type: FILE - protocol: NA - state: CORRUPT - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- item_type: RED_POL - id: '2' - start_step: 3 - end_step: 15 - targetNodeId: '1' - initiator: DIRECT - type: FILE - protocol: NA - state: GOOD - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- item_type: RED_POL - id: '3' - start_step: 4 - end_step: 6 - targetNodeId: '1' - initiator: DIRECT - type: OPERATING - protocol: NA - state: 'OFF' - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- item_type: RED_POL - id: '4' - start_step: 6 - end_step: 15 - targetNodeId: '1' - initiator: DIRECT - type: OPERATING - protocol: NA - state: 'ON' - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- item_type: RED_POL - id: '5' - start_step: 7 - end_step: 9 - targetNodeId: '1' - initiator: DIRECT - type: SERVICE - protocol: ftp - state: COMPROMISED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- item_type: RED_POL - id: '6' - start_step: 9 - end_step: 15 - targetNodeId: '1' - initiator: DIRECT - type: SERVICE - protocol: ftp - state: GOOD - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- item_type: RED_POL - id: '7' - start_step: 10 - end_step: 12 - targetNodeId: '1' - initiator: DIRECT - type: OS - protocol: NA - state: COMPROMISED - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA -- item_type: RED_POL - id: '8' - start_step: 12 - end_step: 15 - targetNodeId: '1' - initiator: DIRECT - type: OS - protocol: NA - state: GOOD - sourceNodeId: NA - sourceNodeService: NA - sourceNodeServiceState: NA diff --git a/tests/config/one_node_states_on_off_main_config.yaml b/tests/config/one_node_states_on_off_main_config.yaml deleted file mode 100644 index 10af7a1f..00000000 --- a/tests/config/one_node_states_on_off_main_config.yaml +++ /dev/null @@ -1,166 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: CUSTOM - -# Sets which deep learning framework will be used (by RLlib ONLY). -# Default is TF (Tensorflow). -# Options are: -# "TF" (Tensorflow) -# TF2 (Tensorflow 2.X) -# TORCH (PyTorch) -deep_learning_framework: TF2 - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: DUMMY - -# Sets whether Red Agent POL and IER is randomised. -# Options are: -# True -# False -random_red_agent: False - -# The (integer) seed to be used in random number generation -# Default is None (null) -seed: null - -# Set whether the agent will be deterministic instead of stochastic -# Options are: -# True -# False -deterministic: False - -# Sets what view of the environment the deterministic hardcoded agent has. The default is BASIC. -# Options are: -# "BASIC" (The current observation space only) -# "FULL" (Full environment view with actions taken and reward feedback) -hard_coded_agent_view: FULL - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: NODE -# observation space -observation_space: - # flatten: true - components: - - name: NODE_LINK_TABLE - # - name: NODE_STATUSES - # - name: LINK_TRAFFIC_LEVELS - - -# Number of episodes for training to run per session -num_train_episodes: 10 - -# Number of time_steps for training per episode -num_train_steps: 256 - -# Number of episodes for evaluation to run per session -num_eval_episodes: 1 - -# Number of time_steps for evaluation per episode -num_eval_steps: 15 - -# Sets how often the agent will save a checkpoint (every n time episodes). -# Set to 0 if no checkpoints are required. Default is 10 -checkpoint_every_n_episodes: 10 - -# Time delay (milliseconds) between steps for CUSTOM agents. -time_delay: 5 - -# Type of session to be run. Options are: -# "TRAIN" (Trains an agent) -# "EVAL" (Evaluates an agent) -# "TRAIN_EVAL" (Trains then evaluates an agent) -session_type: EVAL - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1000000000 - -implicit_acl_rule: DENY -max_number_acl_rules: 10 -# The Stable Baselines3 learn/eval output verbosity level: -# Options are: -# "NONE" (No Output) -# "INFO" (Info Messages (such as devices and wrappers used)) -# "DEBUG" (All Messages) -sb3_output_verbose_level: NONE - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node Software or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/ppo_not_seeded_training_config.yaml b/tests/config/ppo_not_seeded_training_config.yaml deleted file mode 100644 index fac2fe95..00000000 --- a/tests/config/ppo_not_seeded_training_config.yaml +++ /dev/null @@ -1,162 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: SB3 - -# Sets which deep learning framework will be used (by RLlib ONLY). -# Default is TF (Tensorflow). -# Options are: -# "TF" (Tensorflow) -# TF2 (Tensorflow 2.X) -# TORCH (PyTorch) -deep_learning_framework: TF2 - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: PPO - -# Sets whether Red Agent POL and IER is randomised. -# Options are: -# True -# False -random_red_agent: False - -# The (integer) seed to be used in random number generation -# Default is None (null) -seed: None - -# Set whether the agent evaluation will be deterministic instead of stochastic -# Options are: -# True -# False -deterministic: False - -# Sets what view of the environment the deterministic hardcoded agent has. The default is BASIC. -# Options are: -# "BASIC" (The current observation space only) -# "FULL" (Full environment view with actions taken and reward feedback) -hard_coded_agent_view: FULL - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: NODE -# observation space -observation_space: - components: - - name: NODE_LINK_TABLE - # - name: NODE_STATUSES - # - name: LINK_TRAFFIC_LEVELS - # - name: ACCESS_CONTROL_LIST -# Number of episodes to run per session -num_train_episodes: 10 - -# Number of time_steps per episode -num_train_steps: 256 - -# Number of episodes to run per session -num_eval_episodes: 10 - -# Number of time_steps per episode -num_eval_steps: 256 - -# Sets how often the agent will save a checkpoint (every n time episodes). -# Set to 0 if no checkpoints are required. Default is 10 -checkpoint_every_n_episodes: 0 - -# Time delay (milliseconds) between steps for CUSTOM agents. -time_delay: 5 - -# Type of session to be run. Options are: -# "TRAIN" (Trains an agent) -# "EVAL" (Evaluates an agent) -# "TRAIN_EVAL" (Trains then evaluates an agent) -session_type: TRAIN_EVAL - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1000000000 - -# The Stable Baselines3 learn/eval output verbosity level: -# Options are: -# "NONE" (No Output) -# "INFO" (Info Messages (such as devices and wrappers used)) -# "DEBUG" (All Messages) -sb3_output_verbose_level: NONE - -# Reward values -# Generic -all_ok: 0.0000 -# Node Hardware State -off_should_be_on: -0.001 -off_should_be_resetting: -0.0005 -on_should_be_off: -0.0002 -on_should_be_resetting: -0.0005 -resetting_should_be_on: -0.0005 -resetting_should_be_off: -0.0002 -resetting: -0.0003 -# Node Software or Service State -good_should_be_patching: 0.0002 -good_should_be_compromised: 0.0005 -good_should_be_overwhelmed: 0.0005 -patching_should_be_good: -0.0005 -patching_should_be_compromised: 0.0002 -patching_should_be_overwhelmed: 0.0002 -patching: -0.0003 -compromised_should_be_good: -0.002 -compromised_should_be_patching: -0.002 -compromised_should_be_overwhelmed: -0.002 -compromised: -0.002 -overwhelmed_should_be_good: -0.002 -overwhelmed_should_be_patching: -0.002 -overwhelmed_should_be_compromised: -0.002 -overwhelmed: -0.002 -# Node File System State -good_should_be_repairing: 0.0002 -good_should_be_restoring: 0.0002 -good_should_be_corrupt: 0.0005 -good_should_be_destroyed: 0.001 -repairing_should_be_good: -0.0005 -repairing_should_be_restoring: 0.0002 -repairing_should_be_corrupt: 0.0002 -repairing_should_be_destroyed: 0.0000 -repairing: -0.0003 -restoring_should_be_good: -0.001 -restoring_should_be_repairing: -0.0002 -restoring_should_be_corrupt: 0.0001 -restoring_should_be_destroyed: 0.0002 -restoring: -0.0006 -corrupt_should_be_good: -0.001 -corrupt_should_be_repairing: -0.001 -corrupt_should_be_restoring: -0.001 -corrupt_should_be_destroyed: 0.0002 -corrupt: -0.001 -destroyed_should_be_good: -0.002 -destroyed_should_be_repairing: -0.002 -destroyed_should_be_restoring: -0.002 -destroyed_should_be_corrupt: -0.002 -destroyed: -0.002 -scanning: -0.0002 -# IER status -red_ier_running: -0.0005 -green_ier_blocked: -0.001 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/ppo_seeded_training_config.yaml b/tests/config/ppo_seeded_training_config.yaml deleted file mode 100644 index e4d4fe5b..00000000 --- a/tests/config/ppo_seeded_training_config.yaml +++ /dev/null @@ -1,161 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: SB3 - -# Sets which deep learning framework will be used (by RLlib ONLY). -# Default is TF (Tensorflow). -# Options are: -# "TF" (Tensorflow) -# TF2 (Tensorflow 2.X) -# TORCH (PyTorch) -deep_learning_framework: TF2 - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: PPO - -# Sets whether Red Agent POL and IER is randomised. -# Options are: -# True -# False -random_red_agent: False - -# The (integer) seed to be used in random number generation -# Default is None (null) -seed: 67890 - -# Set whether the agent evaluation will be deterministic instead of stochastic -# Options are: -# True -# False -deterministic: True - -# Sets what view of the environment the deterministic hardcoded agent has. The default is BASIC. -# Options are: -# "BASIC" (The current observation space only) -# "FULL" (Full environment view with actions taken and reward feedback) -hard_coded_agent_view: FULL - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: NODE -# observation space -observation_space: - components: - - name: NODE_LINK_TABLE - # - name: NODE_STATUSES - # - name: LINK_TRAFFIC_LEVELS -# Number of episodes to run per session -num_train_episodes: 10 - -# Number of time_steps per episode -num_train_steps: 256 - -# Number of episodes to run per session -num_eval_episodes: 1 - -# Number of time_steps per episode -num_eval_steps: 256 - -# Sets how often the agent will save a checkpoint (every n time episodes). -# Set to 0 if no checkpoints are required. Default is 10 -checkpoint_every_n_episodes: 0 - -# Time delay (milliseconds) between steps for CUSTOM agents. -time_delay: 5 - -# Type of session to be run. Options are: -# "TRAIN" (Trains an agent) -# "EVAL" (Evaluates an agent) -# "TRAIN_EVAL" (Trains then evaluates an agent) -session_type: TRAIN_EVAL - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1000000000 - -# The Stable Baselines3 learn/eval output verbosity level: -# Options are: -# "NONE" (No Output) -# "INFO" (Info Messages (such as devices and wrappers used)) -# "DEBUG" (All Messages) -sb3_output_verbose_level: NONE - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node Software or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/session_test/training_config_main_rllib.yaml b/tests/config/session_test/training_config_main_rllib.yaml deleted file mode 100644 index 374c6ac5..00000000 --- a/tests/config/session_test/training_config_main_rllib.yaml +++ /dev/null @@ -1,164 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: RLLIB - -# Sets which deep learning framework will be used (by RLlib ONLY). -# Default is TF (Tensorflow). -# Options are: -# "TF" (Tensorflow) -# TF2 (Tensorflow 2.X) -# TORCH (PyTorch) -deep_learning_framework: TF2 - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: PPO - -# Sets whether Red Agent POL and IER is randomised. -# Options are: -# True -# False -random_red_agent: False - -# The (integer) seed to be used in random number generation -# Default is None (null) -seed: null - -# Set whether the agent will be deterministic instead of stochastic -# Options are: -# True -# False -deterministic: False - -# Sets what view of the environment the deterministic hardcoded agent has. The default is BASIC. -# Options are: -# "BASIC" (The current observation space only) -# "FULL" (Full environment view with actions taken and reward feedback) -hard_coded_agent_view: FULL - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: NODE -# observation space -observation_space: - # flatten: true - components: - - name: NODE_LINK_TABLE - # - name: NODE_STATUSES - # - name: LINK_TRAFFIC_LEVELS - - -# Number of episodes for training to run per session -num_train_episodes: 10 - -# Number of time_steps for training per episode -num_train_steps: 256 - -# Number of episodes for evaluation to run per session -num_eval_episodes: 3 - -# Number of time_steps for evaluation per episode -num_eval_steps: 256 - -# Sets how often the agent will save a checkpoint (every n time episodes). -# Set to 0 if no checkpoints are required. Default is 10 -checkpoint_every_n_episodes: 10 - -# Time delay (milliseconds) between steps for CUSTOM agents. -time_delay: 5 - -# Type of session to be run. Options are: -# "TRAIN" (Trains an agent) -# "EVAL" (Evaluates an agent) -# "TRAIN_EVAL" (Trains then evaluates an agent) -session_type: TRAIN_EVAL - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1000000000 - -# The Stable Baselines3 learn/eval output verbosity level: -# Options are: -# "NONE" (No Output) -# "INFO" (Info Messages (such as devices and wrappers used)) -# "DEBUG" (All Messages) -sb3_output_verbose_level: NONE - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -0.001 -off_should_be_resetting: -0.0005 -on_should_be_off: -0.0002 -on_should_be_resetting: -0.0005 -resetting_should_be_on: -0.0005 -resetting_should_be_off: -0.0002 -resetting: -0.0003 -# Node Software or Service State -good_should_be_patching: 0.0002 -good_should_be_compromised: 0.0005 -good_should_be_overwhelmed: 0.0005 -patching_should_be_good: -0.0005 -patching_should_be_compromised: 0.0002 -patching_should_be_overwhelmed: 0.0002 -patching: -0.0003 -compromised_should_be_good: -0.002 -compromised_should_be_patching: -0.002 -compromised_should_be_overwhelmed: -0.002 -compromised: -0.002 -overwhelmed_should_be_good: -0.002 -overwhelmed_should_be_patching: -0.002 -overwhelmed_should_be_compromised: -0.002 -overwhelmed: -0.002 -# Node File System State -good_should_be_repairing: 0.0002 -good_should_be_restoring: 0.0002 -good_should_be_corrupt: 0.0005 -good_should_be_destroyed: 0.001 -repairing_should_be_good: -0.0005 -repairing_should_be_restoring: 0.0002 -repairing_should_be_corrupt: 0.0002 -repairing_should_be_destroyed: 0.0000 -repairing: -0.0003 -restoring_should_be_good: -0.001 -restoring_should_be_repairing: -0.0002 -restoring_should_be_corrupt: 0.0001 -restoring_should_be_destroyed: 0.0002 -restoring: -0.0006 -corrupt_should_be_good: -0.001 -corrupt_should_be_repairing: -0.001 -corrupt_should_be_restoring: -0.001 -corrupt_should_be_destroyed: 0.0002 -corrupt: -0.001 -destroyed_should_be_good: -0.002 -destroyed_should_be_repairing: -0.002 -destroyed_should_be_restoring: -0.002 -destroyed_should_be_corrupt: -0.002 -destroyed: -0.002 -scanning: -0.0002 -# IER status -red_ier_running: -0.0005 -green_ier_blocked: -0.001 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/session_test/training_config_main_sb3.yaml b/tests/config/session_test/training_config_main_sb3.yaml deleted file mode 100644 index 733105ea..00000000 --- a/tests/config/session_test/training_config_main_sb3.yaml +++ /dev/null @@ -1,164 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: SB3 - -# Sets which deep learning framework will be used (by RLlib ONLY). -# Default is TF (Tensorflow). -# Options are: -# "TF" (Tensorflow) -# TF2 (Tensorflow 2.X) -# TORCH (PyTorch) -deep_learning_framework: TF2 - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: PPO - -# Sets whether Red Agent POL and IER is randomised. -# Options are: -# True -# False -random_red_agent: False - -# The (integer) seed to be used in random number generation -# Default is None (null) -seed: null - -# Set whether the agent will be deterministic instead of stochastic -# Options are: -# True -# False -deterministic: False - -# Sets what view of the environment the deterministic hardcoded agent has. The default is BASIC. -# Options are: -# "BASIC" (The current observation space only) -# "FULL" (Full environment view with actions taken and reward feedback) -hard_coded_agent_view: FULL - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: NODE -# observation space -observation_space: - # flatten: true - components: - - name: NODE_LINK_TABLE - # - name: NODE_STATUSES - # - name: LINK_TRAFFIC_LEVELS - - -# Number of episodes for training to run per session -num_train_episodes: 10 - -# Number of time_steps for training per episode -num_train_steps: 256 - -# Number of episodes for evaluation to run per session -num_eval_episodes: 3 - -# Number of time_steps for evaluation per episode -num_eval_steps: 256 - -# Sets how often the agent will save a checkpoint (every n time episodes). -# Set to 0 if no checkpoints are required. Default is 10 -checkpoint_every_n_episodes: 10 - -# Time delay (milliseconds) between steps for CUSTOM agents. -time_delay: 5 - -# Type of session to be run. Options are: -# "TRAIN" (Trains an agent) -# "EVAL" (Evaluates an agent) -# "TRAIN_EVAL" (Trains then evaluates an agent) -session_type: TRAIN_EVAL - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1000000000 - -# The Stable Baselines3 learn/eval output verbosity level: -# Options are: -# "NONE" (No Output) -# "INFO" (Info Messages (such as devices and wrappers used)) -# "DEBUG" (All Messages) -sb3_output_verbose_level: NONE - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -0.001 -off_should_be_resetting: -0.0005 -on_should_be_off: -0.0002 -on_should_be_resetting: -0.0005 -resetting_should_be_on: -0.0005 -resetting_should_be_off: -0.0002 -resetting: -0.0003 -# Node Software or Service State -good_should_be_patching: 0.0002 -good_should_be_compromised: 0.0005 -good_should_be_overwhelmed: 0.0005 -patching_should_be_good: -0.0005 -patching_should_be_compromised: 0.0002 -patching_should_be_overwhelmed: 0.0002 -patching: -0.0003 -compromised_should_be_good: -0.002 -compromised_should_be_patching: -0.002 -compromised_should_be_overwhelmed: -0.002 -compromised: -0.002 -overwhelmed_should_be_good: -0.002 -overwhelmed_should_be_patching: -0.002 -overwhelmed_should_be_compromised: -0.002 -overwhelmed: -0.002 -# Node File System State -good_should_be_repairing: 0.0002 -good_should_be_restoring: 0.0002 -good_should_be_corrupt: 0.0005 -good_should_be_destroyed: 0.001 -repairing_should_be_good: -0.0005 -repairing_should_be_restoring: 0.0002 -repairing_should_be_corrupt: 0.0002 -repairing_should_be_destroyed: 0.0000 -repairing: -0.0003 -restoring_should_be_good: -0.001 -restoring_should_be_repairing: -0.0002 -restoring_should_be_corrupt: 0.0001 -restoring_should_be_destroyed: 0.0002 -restoring: -0.0006 -corrupt_should_be_good: -0.001 -corrupt_should_be_repairing: -0.001 -corrupt_should_be_restoring: -0.001 -corrupt_should_be_destroyed: 0.0002 -corrupt: -0.001 -destroyed_should_be_good: -0.002 -destroyed_should_be_repairing: -0.002 -destroyed_should_be_restoring: -0.002 -destroyed_should_be_corrupt: -0.002 -destroyed: -0.002 -scanning: -0.0002 -# IER status -red_ier_running: -0.0005 -green_ier_blocked: -0.001 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/single_action_space_fixed_blue_actions_main_config.yaml b/tests/config/single_action_space_fixed_blue_actions_main_config.yaml deleted file mode 100644 index 6210cf3e..00000000 --- a/tests/config/single_action_space_fixed_blue_actions_main_config.yaml +++ /dev/null @@ -1,117 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: CUSTOM - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: RANDOM - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: ANY -# Number of episodes for training to run per session -num_train_episodes: 1 - -# Number of time_steps for training per episode -num_train_steps: 15 - -# Time delay between steps (for generic agents) -time_delay: 1 -# Type of session to be run (TRAINING or EVALUATION) -session_type: EVAL -# Determine whether to load an agent from file -load_agent: False -# File path and file name of agent if you're loading one in -agent_load_file: C:\[Path]\[agent_saved_filename.zip] - -# Implicit ACL firewall rule at end of lists to be default action or no rule can be selected (ALLOW or DENY) -implicit_acl_rule: DENY -# Total number of ACL rules allowed in the environment -max_number_acl_rules: 10 - -observation_space: - components: - - name: ACCESS_CONTROL_LIST - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1000000000 - -# Reward values -# Generic -all_ok: 0 -# Node Operating State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node O/S or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/single_action_space_lay_down_config.yaml b/tests/config/single_action_space_lay_down_config.yaml deleted file mode 100644 index 9103e2b7..00000000 --- a/tests/config/single_action_space_lay_down_config.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -- item_type: PORTS - ports_list: - - port: '80' -- item_type: SERVICES - service_list: - - name: TCP -- item_type: NODE - node_id: '1' - name: node - node_class: SERVICE - node_type: COMPUTER - priority: P1 - hardware_state: 'ON' - ip_address: 192.168.0.14 - software_state: GOOD - file_system_state: GOOD - services: - - name: TCP - port: '80' - state: COMPROMISED -- item_type: NODE - node_id: '2' - name: server_1 - node_class: SERVICE - node_type: SERVER - priority: P1 - hardware_state: 'ON' - ip_address: 192.168.0.1 - software_state: GOOD - file_system_state: GOOD - services: - - name: TCP - port: '80' - state: COMPROMISED -- item_type: RED_IER - id: '3' - start_step: 2 - end_step: 15 - load: 1000 - protocol: TCP - port: CORRUPT - source: '1' - destination: '2' - mission_criticality: 0 diff --git a/tests/config/single_action_space_main_config.yaml b/tests/config/single_action_space_main_config.yaml deleted file mode 100644 index 67eaf49d..00000000 --- a/tests/config/single_action_space_main_config.yaml +++ /dev/null @@ -1,116 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: CUSTOM - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: RANDOM - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: ANY -# Number of episodes for training to run per session -num_train_episodes: 10 - -# Number of time_steps for training per episode -num_train_steps: 256 - -# Number of episodes for evaluation to run per session -num_eval_episodes: 10 - -# Number of time_steps for evaluation per episode -num_eval_steps: 256 -# Time delay between steps (for generic agents) -time_delay: 1 -# Type of session to be run (TRAINING or EVALUATION) -session_type: EVAL -# Determine whether to load an agent from file -load_agent: False -# File path and file name of agent if you're loading one in -agent_load_file: C:\[Path]\[agent_saved_filename.zip] - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1000000000 - -# Choice whether to have an ALLOW or DENY implicit rule or not (TRUE or FALSE) -implicit_acl_rule: DENY -max_number_acl_rules: 10 -# Reward values -# Generic -all_ok: 0 -# Node Operating State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node O/S or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/test_random_red_main_config.yaml b/tests/config/test_random_red_main_config.yaml deleted file mode 100644 index 310c9dc6..00000000 --- a/tests/config/test_random_red_main_config.yaml +++ /dev/null @@ -1,164 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: SB3 - -# Sets which deep learning framework will be used (by RLlib ONLY). -# Default is TF (Tensorflow). -# Options are: -# "TF" (Tensorflow) -# TF2 (Tensorflow 2.X) -# TORCH (PyTorch) -deep_learning_framework: TF2 - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: PPO - -# Sets whether Red Agent POL and IER is randomised. -# Options are: -# True -# False -random_red_agent: True - -# The (integer) seed to be used in random number generation -# Default is None (null) -seed: null - -# Set whether the agent will be deterministic instead of stochastic -# Options are: -# True -# False -deterministic: False - -# Sets what view of the environment the deterministic hardcoded agent has. The default is BASIC. -# Options are: -# "BASIC" (The current observation space only) -# "FULL" (Full environment view with actions taken and reward feedback) -hard_coded_agent_view: FULL - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: NODE -# observation space -observation_space: - # flatten: true - components: - - name: NODE_LINK_TABLE - # - name: NODE_STATUSES - # - name: LINK_TRAFFIC_LEVELS - - -# Number of episodes for training to run per session -num_train_episodes: 10 - -# Number of time_steps for training per episode -num_train_steps: 256 - -# Number of episodes for evaluation to run per session -num_eval_episodes: 1 - -# Number of time_steps for evaluation per episode -num_eval_steps: 256 - -# Sets how often the agent will save a checkpoint (every n time episodes). -# Set to 0 if no checkpoints are required. Default is 10 -checkpoint_every_n_episodes: 10 - -# Time delay (milliseconds) between steps for CUSTOM agents. -time_delay: 5 - -# Type of session to be run. Options are: -# "TRAIN" (Trains an agent) -# "EVAL" (Evaluates an agent) -# "TRAIN_EVAL" (Trains then evaluates an agent) -session_type: TRAIN_EVAL - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1000000000 - -# The Stable Baselines3 learn/eval output verbosity level: -# Options are: -# "NONE" (No Output) -# "INFO" (Info Messages (such as devices and wrappers used)) -# "DEBUG" (All Messages) -sb3_output_verbose_level: NONE - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -0.001 -off_should_be_resetting: -0.0005 -on_should_be_off: -0.0002 -on_should_be_resetting: -0.0005 -resetting_should_be_on: -0.0005 -resetting_should_be_off: -0.0002 -resetting: -0.0003 -# Node Software or Service State -good_should_be_patching: 0.0002 -good_should_be_compromised: 0.0005 -good_should_be_overwhelmed: 0.0005 -patching_should_be_good: -0.0005 -patching_should_be_compromised: 0.0002 -patching_should_be_overwhelmed: 0.0002 -patching: -0.0003 -compromised_should_be_good: -0.002 -compromised_should_be_patching: -0.002 -compromised_should_be_overwhelmed: -0.002 -compromised: -0.002 -overwhelmed_should_be_good: -0.002 -overwhelmed_should_be_patching: -0.002 -overwhelmed_should_be_compromised: -0.002 -overwhelmed: -0.002 -# Node File System State -good_should_be_repairing: 0.0002 -good_should_be_restoring: 0.0002 -good_should_be_corrupt: 0.0005 -good_should_be_destroyed: 0.001 -repairing_should_be_good: -0.0005 -repairing_should_be_restoring: 0.0002 -repairing_should_be_corrupt: 0.0002 -repairing_should_be_destroyed: 0.0000 -repairing: -0.0003 -restoring_should_be_good: -0.001 -restoring_should_be_repairing: -0.0002 -restoring_should_be_corrupt: 0.0001 -restoring_should_be_destroyed: 0.0002 -restoring: -0.0006 -corrupt_should_be_good: -0.001 -corrupt_should_be_repairing: -0.001 -corrupt_should_be_restoring: -0.001 -corrupt_should_be_destroyed: 0.0002 -corrupt: -0.001 -destroyed_should_be_good: -0.002 -destroyed_should_be_repairing: -0.002 -destroyed_should_be_restoring: -0.002 -destroyed_should_be_corrupt: -0.002 -destroyed: -0.002 -scanning: -0.0002 -# IER status -red_ier_running: -0.0005 -green_ier_blocked: -0.001 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/config/train_episode_step.yaml b/tests/config/train_episode_step.yaml deleted file mode 100644 index a86e0f62..00000000 --- a/tests/config/train_episode_step.yaml +++ /dev/null @@ -1,154 +0,0 @@ -# © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK -# Training Config File - -# Sets which agent algorithm framework will be used. -# Options are: -# "SB3" (Stable Baselines3) -# "RLLIB" (Ray RLlib) -# "CUSTOM" (Custom Agent) -agent_framework: SB3 - -# Sets which deep learning framework will be used (by RLlib ONLY). -# Default is TF (Tensorflow). -# Options are: -# "TF" (Tensorflow) -# TF2 (Tensorflow 2.X) -# TORCH (PyTorch) -deep_learning_framework: TF2 - -# Sets which Agent class will be used. -# Options are: -# "A2C" (Advantage Actor Critic coupled with either SB3 or RLLIB agent_framework) -# "PPO" (Proximal Policy Optimization coupled with either SB3 or RLLIB agent_framework) -# "HARDCODED" (The HardCoded agents coupled with an ACL or NODE action_type) -# "DO_NOTHING" (The DoNothing agents coupled with an ACL or NODE action_type) -# "RANDOM" (primaite.agents.simple.RandomAgent) -# "DUMMY" (primaite.agents.simple.DummyAgent) -agent_identifier: PPO - -# Sets whether Red Agent POL and IER is randomised. -# Options are: -# True -# False -random_red_agent: False - -# Sets what view of the environment the deterministic hardcoded agent has. The default is BASIC. -# Options are: -# "BASIC" (The current observation space only) -# "FULL" (Full environment view with actions taken and reward feedback) -hard_coded_agent_view: FULL - -# Sets How the Action Space is defined: -# "NODE" -# "ACL" -# "ANY" node and acl actions -action_type: NODE -# observation space -observation_space: - # flatten: true - components: - - name: NODE_LINK_TABLE - # - name: NODE_STATUSES - # - name: LINK_TRAFFIC_LEVELS - - -# Number of episodes for training to run per session -num_train_episodes: 3 - -# Number of time_steps for training per episode -num_train_steps: 25 - -# Number of episodes for evaluation to run per session -num_eval_episodes: 1 - -# Number of time_steps for evaluation per episode -num_eval_steps: 17 - -# Sets how often the agent will save a checkpoint (every n time episodes). -# Set to 0 if no checkpoints are required. Default is 10 -checkpoint_every_n_episodes: 0 - -# Time delay (milliseconds) between steps for CUSTOM agents. -time_delay: 5 - -# Type of session to be run. Options are: -# "TRAIN" (Trains an agent) -# "EVAL" (Evaluates an agent) -# "TRAIN_EVAL" (Trains then evaluates an agent) -session_type: TRAIN_EVAL - -# Environment config values -# The high value for the observation space -observation_space_high_value: 1000000000 - -# The Stable Baselines3 learn/eval output verbosity level: -# Options are: -# "NONE" (No Output) -# "INFO" (Info Messages (such as devices and wrappers used)) -# "DEBUG" (All Messages) -sb3_output_verbose_level: NONE - -# Reward values -# Generic -all_ok: 0 -# Node Hardware State -off_should_be_on: -10 -off_should_be_resetting: -5 -on_should_be_off: -2 -on_should_be_resetting: -5 -resetting_should_be_on: -5 -resetting_should_be_off: -2 -resetting: -3 -# Node Software or Service State -good_should_be_patching: 2 -good_should_be_compromised: 5 -good_should_be_overwhelmed: 5 -patching_should_be_good: -5 -patching_should_be_compromised: 2 -patching_should_be_overwhelmed: 2 -patching: -3 -compromised_should_be_good: -20 -compromised_should_be_patching: -20 -compromised_should_be_overwhelmed: -20 -compromised: -20 -overwhelmed_should_be_good: -20 -overwhelmed_should_be_patching: -20 -overwhelmed_should_be_compromised: -20 -overwhelmed: -20 -# Node File System State -good_should_be_repairing: 2 -good_should_be_restoring: 2 -good_should_be_corrupt: 5 -good_should_be_destroyed: 10 -repairing_should_be_good: -5 -repairing_should_be_restoring: 2 -repairing_should_be_corrupt: 2 -repairing_should_be_destroyed: 0 -repairing: -3 -restoring_should_be_good: -10 -restoring_should_be_repairing: -2 -restoring_should_be_corrupt: 1 -restoring_should_be_destroyed: 2 -restoring: -6 -corrupt_should_be_good: -10 -corrupt_should_be_repairing: -10 -corrupt_should_be_restoring: -10 -corrupt_should_be_destroyed: 2 -corrupt: -10 -destroyed_should_be_good: -20 -destroyed_should_be_repairing: -20 -destroyed_should_be_restoring: -20 -destroyed_should_be_corrupt: -20 -destroyed: -20 -scanning: -2 -# IER status -red_ier_running: -5 -green_ier_blocked: -10 - -# Patching / Reset durations -os_patching_duration: 5 # The time taken to patch the OS -node_reset_duration: 5 # The time taken to reset a node (hardware) -service_patching_duration: 5 # The time taken to patch a service -file_system_repairing_limit: 5 # The time take to repair the file system -file_system_restoring_limit: 5 # The time take to restore the file system -file_system_scanning_limit: 5 # The time taken to scan the file system diff --git a/tests/conftest.py b/tests/conftest.py index d8c9cc50..425acc09 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -10,8 +10,9 @@ from unittest.mock import patch import pytest from primaite import getLogger -from primaite.environment.primaite_env import Primaite -from primaite.primaite_session import PrimaiteSession + +# from primaite.environment.primaite_env import Primaite +# from primaite.primaite_session import PrimaiteSession from primaite.simulator.network.container import Network from primaite.simulator.network.networks import arcd_uc2_network from primaite.simulator.network.transmission.transport_layer import Port @@ -53,6 +54,7 @@ def file_system() -> FileSystem: return Node(hostname="fs_node").file_system +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 # PrimAITE v2 stuff class TempPrimaiteSession(PrimaiteSession): """ @@ -82,6 +84,7 @@ class TempPrimaiteSession(PrimaiteSession): _LOGGER.debug(f"Deleted temp session directory: {self.session_path}") +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.fixture def temp_primaite_session(request): """ @@ -136,6 +139,7 @@ def temp_primaite_session(request): return TempPrimaiteSession(training_config_path, lay_down_config_path) +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.fixture def temp_session_path() -> Path: """ diff --git a/tests/test_acl.py b/tests/test_acl.py index d8357cf6..a0dfb997 100644 --- a/tests/test_acl.py +++ b/tests/test_acl.py @@ -1,11 +1,12 @@ # © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK """Used to tes the ACL functions.""" -from primaite.acl.access_control_list import AccessControlList -from primaite.acl.acl_rule import ACLRule -from primaite.common.enums import RulePermissionType +# from primaite.acl.access_control_list import AccessControlList +# from primaite.acl.acl_rule import ACLRule +# from primaite.common.enums import RulePermissionType +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_acl_address_match_1(): """Test that matching IP addresses produce True.""" acl = AccessControlList(RulePermissionType.DENY, 10) @@ -15,6 +16,7 @@ def test_acl_address_match_1(): assert acl.check_address_match(rule, "192.168.1.1", "192.168.1.2") == True +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_acl_address_match_2(): """Test that mismatching IP addresses produce False.""" acl = AccessControlList(RulePermissionType.DENY, 10) @@ -24,6 +26,7 @@ def test_acl_address_match_2(): assert acl.check_address_match(rule, "192.168.1.1", "192.168.1.3") == False +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_acl_address_match_3(): """Test the ANY condition for source IP addresses produce True.""" acl = AccessControlList(RulePermissionType.DENY, 10) @@ -33,6 +36,7 @@ def test_acl_address_match_3(): assert acl.check_address_match(rule, "192.168.1.1", "192.168.1.2") == True +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_acl_address_match_4(): """Test the ANY condition for dest IP addresses produce True.""" acl = AccessControlList(RulePermissionType.DENY, 10) @@ -42,6 +46,7 @@ def test_acl_address_match_4(): assert acl.check_address_match(rule, "192.168.1.1", "192.168.1.2") == True +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_check_acl_block_affirmative(): """Test the block function (affirmative).""" # Create the Access Control List @@ -66,6 +71,7 @@ def test_check_acl_block_affirmative(): assert acl.is_blocked("192.168.1.1", "192.168.1.2", "TCP", "80") == False +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_check_acl_block_negative(): """Test the block function (negative).""" # Create the Access Control List @@ -91,6 +97,7 @@ def test_check_acl_block_negative(): assert acl.is_blocked("192.168.1.1", "192.168.1.2", "TCP", "80") == True +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_rule_hash(): """Test the rule hash.""" # Create the Access Control List @@ -104,6 +111,7 @@ def test_rule_hash(): assert hash_value_local == hash_value_remote +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_delete_rule(): """Adds 3 rules and deletes 1 rule and checks its deletion.""" # Create the Access Control List diff --git a/tests/test_active_node.py b/tests/test_active_node.py index 44d38313..cf532bb8 100644 --- a/tests/test_active_node.py +++ b/tests/test_active_node.py @@ -2,10 +2,11 @@ """Used to test Active Node functions.""" import pytest -from primaite.common.enums import FileSystemState, HardwareState, SoftwareState -from primaite.nodes.active_node import ActiveNode +# from primaite.common.enums import FileSystemState, HardwareState, SoftwareState +# from primaite.nodes.active_node import ActiveNode +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "operating_state, expected_state", [ @@ -36,6 +37,7 @@ def test_os_state_change(operating_state, expected_state): assert active_node.software_state == expected_state +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "operating_state, expected_state", [ @@ -66,6 +68,7 @@ def test_os_state_change_if_not_compromised(operating_state, expected_state): assert active_node.software_state == expected_state +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "operating_state, expected_state", [ @@ -92,6 +95,7 @@ def test_file_system_change(operating_state, expected_state): assert active_node.file_system_state_actual == expected_state +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "operating_state, expected_state", [ diff --git a/tests/test_full_legacy_config_session.py b/tests/test_full_legacy_config_session.py index 066ff72c..ac727a22 100644 --- a/tests/test_full_legacy_config_session.py +++ b/tests/test_full_legacy_config_session.py @@ -6,6 +6,7 @@ from primaite.main import run from tests import TEST_CONFIG_ROOT +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "legacy_file", [ diff --git a/tests/test_lay_down_config.py b/tests/test_lay_down_config.py index 99e66708..83c6063c 100644 --- a/tests/test_lay_down_config.py +++ b/tests/test_lay_down_config.py @@ -2,16 +2,17 @@ import pytest import yaml -from primaite.config.lay_down_config import ( - convert_legacy_lay_down_config, - data_manipulation_config_path, - ddos_basic_one_config_path, - ddos_basic_two_config_path, - dos_very_basic_config_path, -) +# from primaite.config.lay_down_config import ( +# convert_legacy_lay_down_config, +# data_manipulation_config_path, +# ddos_basic_one_config_path, +# ddos_basic_two_config_path, +# dos_very_basic_config_path, +# ) from tests import TEST_CONFIG_ROOT +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "legacy_file, new_path", [ diff --git a/tests/test_observation_space.py b/tests/test_observation_space.py index ff3528e1..b138dd5e 100644 --- a/tests/test_observation_space.py +++ b/tests/test_observation_space.py @@ -4,10 +4,11 @@ import numpy as np import pytest -from primaite.environment.observations import NodeLinkTable, NodeStatuses, ObservationsHandler +# from primaite.environment.observations import NodeLinkTable, NodeStatuses, ObservationsHandler from tests import TEST_CONFIG_ROOT +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [ @@ -29,6 +30,7 @@ def test_default_obs_space(temp_primaite_session): assert isinstance(components[0], NodeLinkTable) +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [ @@ -51,6 +53,7 @@ def test_registering_components(temp_primaite_session): assert component not in handler.registered_obs_components +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [ @@ -140,6 +143,7 @@ class TestNodeLinkTable: ) +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [ @@ -194,6 +198,7 @@ class TestNodeStatuses: assert np.array_equal(obs, [1, 3, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 0, 0]) +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [ @@ -240,6 +245,7 @@ class TestLinkTrafficLevels: assert np.array_equal(obs, [6, 0, 6, 0]) +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [ diff --git a/tests/test_primaite_session.py b/tests/test_primaite_session.py index 6e23b3ac..bf9332a7 100644 --- a/tests/test_primaite_session.py +++ b/tests/test_primaite_session.py @@ -4,12 +4,14 @@ import os import pytest from primaite import getLogger -from primaite.config.lay_down_config import dos_very_basic_config_path + +# from primaite.config.lay_down_config import dos_very_basic_config_path from tests import TEST_CONFIG_ROOT _LOGGER = getLogger(__name__) +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [ diff --git a/tests/test_red_random_agent_behaviour.py b/tests/test_red_random_agent_behaviour.py index e99f4adb..3f999f9b 100644 --- a/tests/test_red_random_agent_behaviour.py +++ b/tests/test_red_random_agent_behaviour.py @@ -1,11 +1,12 @@ # © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK import pytest -from primaite.config.lay_down_config import data_manipulation_config_path -from primaite.nodes.node_state_instruction_red import NodeStateInstructionRed +# from primaite.config.lay_down_config import data_manipulation_config_path +# from primaite.nodes.node_state_instruction_red import NodeStateInstructionRed from tests import TEST_CONFIG_ROOT +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [ diff --git a/tests/test_resetting_node.py b/tests/test_resetting_node.py index d4e27c17..53779c4f 100644 --- a/tests/test_resetting_node.py +++ b/tests/test_resetting_node.py @@ -2,13 +2,14 @@ """Used to test Active Node functions.""" import pytest -from primaite.common.enums import FileSystemState, HardwareState, NodeType, Priority, SoftwareState -from primaite.common.service import Service -from primaite.config.training_config import TrainingConfig -from primaite.nodes.active_node import ActiveNode -from primaite.nodes.service_node import ServiceNode +# from primaite.common.enums import FileSystemState, HardwareState, NodeType, Priority, SoftwareState +# from primaite.common.service import Service +# from primaite.config.training_config import TrainingConfig +# from primaite.nodes.active_node import ActiveNode +# from primaite.nodes.service_node import ServiceNode +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "starting_operating_state, expected_operating_state", [(HardwareState.RESETTING, HardwareState.ON)], @@ -35,6 +36,7 @@ def test_node_resets_correctly(starting_operating_state, expected_operating_stat assert active_node.hardware_state == expected_operating_state +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "operating_state, expected_operating_state", [(HardwareState.BOOTING, HardwareState.ON)], @@ -62,6 +64,7 @@ def test_node_boots_correctly(operating_state, expected_operating_state): assert service_node.hardware_state == expected_operating_state +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "operating_state, expected_operating_state", [(HardwareState.SHUTTING_DOWN, HardwareState.OFF)], diff --git a/tests/test_reward.py b/tests/test_reward.py index 2ac66af1..7a980d32 100644 --- a/tests/test_reward.py +++ b/tests/test_reward.py @@ -7,6 +7,7 @@ from tests import TEST_CONFIG_ROOT _LOGGER = getLogger(__name__) +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [ diff --git a/tests/test_seeding_and_deterministic_session.py b/tests/test_seeding_and_deterministic_session.py index aff5496a..eed6f4d6 100644 --- a/tests/test_seeding_and_deterministic_session.py +++ b/tests/test_seeding_and_deterministic_session.py @@ -1,10 +1,11 @@ # © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK import pytest as pytest -from primaite.config.lay_down_config import dos_very_basic_config_path +# from primaite.config.lay_down_config import dos_very_basic_config_path from tests import TEST_CONFIG_ROOT +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [[TEST_CONFIG_ROOT / "ppo_seeded_training_config.yaml", dos_very_basic_config_path()]], @@ -49,6 +50,7 @@ def test_seeded_learning(temp_primaite_session): assert actual_mean_reward_per_episode == expected_mean_reward_per_episode +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "temp_primaite_session", [[TEST_CONFIG_ROOT / "ppo_seeded_training_config.yaml", dos_very_basic_config_path()]], diff --git a/tests/test_service_node.py b/tests/test_service_node.py index 906bcf55..6b1bd1ee 100644 --- a/tests/test_service_node.py +++ b/tests/test_service_node.py @@ -2,11 +2,12 @@ """Used to test Service Node functions.""" import pytest -from primaite.common.enums import HardwareState, SoftwareState -from primaite.common.service import Service -from primaite.nodes.service_node import ServiceNode +# from primaite.common.enums import HardwareState, SoftwareState +# from primaite.common.service import Service +# from primaite.nodes.service_node import ServiceNode +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "operating_state, expected_state", [ @@ -39,6 +40,7 @@ def test_service_state_change(operating_state, expected_state): assert service_node.get_service_state("TCP") == expected_state +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 @pytest.mark.parametrize( "operating_state, expected_state", [ diff --git a/tests/test_session_loading.py b/tests/test_session_loading.py index f9990f76..fdec4ede 100644 --- a/tests/test_session_loading.py +++ b/tests/test_session_loading.py @@ -6,14 +6,18 @@ from pathlib import Path from typing import Union from uuid import uuid4 +import pytest from typer.testing import CliRunner from primaite import getLogger -from primaite.agents.sb3 import SB3Agent + +# from primaite.agents.sb3 import SB3Agent from primaite.cli import app -from primaite.common.enums import AgentFramework, AgentIdentifier + +# from primaite.common.enums import AgentFramework, AgentIdentifier from primaite.main import run -from primaite.primaite_session import PrimaiteSession + +# from primaite.primaite_session import PrimaiteSession from primaite.utils.session_output_reader import av_rewards_dict from tests import TEST_ASSETS_ROOT @@ -62,6 +66,7 @@ def copy_session_asset(asset_path: Union[str, Path]) -> str: return copy_path +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_load_sb3_session(): """Test that loading an SB3 agent works.""" test_path = copy_session_asset(TEST_ASSETS_ROOT / "example_sb3_agent_session") @@ -104,6 +109,7 @@ def test_load_sb3_session(): shutil.rmtree(test_path) +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_load_primaite_session(): """Test that loading a Primaite session works.""" test_path = copy_session_asset(TEST_ASSETS_ROOT / "example_sb3_agent_session") @@ -150,6 +156,7 @@ def test_load_primaite_session(): shutil.rmtree(test_path) +@pytest.skip("Deprecated") # TODO: implement a similar test for primaite v3 def test_run_loading(): """Test loading session via main.run.""" test_path = copy_session_asset(TEST_ASSETS_ROOT / "example_sb3_agent_session") diff --git a/tests/test_single_action_space.py b/tests/test_single_action_space.py index 5d300232..949898cf 100644 --- a/tests/test_single_action_space.py +++ b/tests/test_single_action_space.py @@ -3,12 +3,13 @@ import time import pytest -from primaite.acl.acl_rule import ACLRule -from primaite.common.enums import HardwareState -from primaite.environment.primaite_env import Primaite +# from primaite.acl.acl_rule import ACLRule +# from primaite.common.enums import HardwareState +# from primaite.environment.primaite_env import Primaite from tests import TEST_CONFIG_ROOT +@pytest.skip("Deprecated") def run_generic_set_actions(env: Primaite): """Run against a generic agent with specified blue agent actions.""" # Reset the environment at the start of the episode @@ -47,6 +48,7 @@ def run_generic_set_actions(env: Primaite): # env.close() +@pytest.skip("Deprecated") @pytest.mark.parametrize( "temp_primaite_session", [ @@ -88,6 +90,7 @@ def test_single_action_space_is_valid(temp_primaite_session): assert both_action_spaces +@pytest.skip("Deprecated") @pytest.mark.parametrize( "temp_primaite_session", [ diff --git a/tests/test_train_eval_episode_steps.py b/tests/test_train_eval_episode_steps.py index 1b53fe9d..0be968ae 100644 --- a/tests/test_train_eval_episode_steps.py +++ b/tests/test_train_eval_episode_steps.py @@ -2,12 +2,14 @@ import pytest from primaite import getLogger -from primaite.config.lay_down_config import dos_very_basic_config_path + +# from primaite.config.lay_down_config import dos_very_basic_config_path from tests import TEST_CONFIG_ROOT _LOGGER = getLogger(__name__) +@pytest.skip("Deprecated") @pytest.mark.parametrize( "temp_primaite_session", [[TEST_CONFIG_ROOT / "train_episode_step.yaml", dos_very_basic_config_path()]], diff --git a/tests/test_training_config.py b/tests/test_training_config.py index 58f9c797..e4e3fa32 100644 --- a/tests/test_training_config.py +++ b/tests/test_training_config.py @@ -1,10 +1,12 @@ # © Crown-owned copyright 2023, Defence Science and Technology Laboratory UK +import pytest import yaml -from primaite.config import training_config +# from primaite.config import training_config from tests import TEST_CONFIG_ROOT +@pytest.skip("Deprecated") def test_legacy_lay_down_config_yaml_conversion(): """Tests the conversion of legacy lay down config files.""" legacy_path = TEST_CONFIG_ROOT / "legacy_conversion" / "legacy_training_config.yaml" @@ -22,6 +24,7 @@ def test_legacy_lay_down_config_yaml_conversion(): assert converted_dict[key] == value +@pytest.skip("Deprecated") def test_create_config_values_main_from_file(): """Tests creating an instance of TrainingConfig from file.""" new_path = TEST_CONFIG_ROOT / "legacy_conversion" / "new_training_config.yaml" @@ -29,6 +32,7 @@ def test_create_config_values_main_from_file(): training_config.load(new_path) +@pytest.skip("Deprecated") def test_create_config_values_main_from_legacy_file(): """Tests creating an instance of TrainingConfig from legacy file.""" new_path = TEST_CONFIG_ROOT / "legacy_conversion" / "legacy_training_config.yaml"