#2869 - Updates to address test failures. Updated YAML configs to remove redundant start_settings
This commit is contained in:
@@ -31,10 +31,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
|
||||
- ref: data_manipulation_attacker
|
||||
team: RED
|
||||
@@ -63,10 +62,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
|
||||
- ref: defender
|
||||
team: BLUE
|
||||
|
||||
@@ -56,10 +56,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings:
|
||||
start_settings:
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
action_probabilities:
|
||||
0: 0.4
|
||||
1: 0.6
|
||||
|
||||
@@ -59,10 +59,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings:
|
||||
start_settings:
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
action_probabilities:
|
||||
0: 0.6
|
||||
1: 0.4
|
||||
|
||||
@@ -151,10 +151,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
|
||||
- ref: defender
|
||||
team: BLUE
|
||||
|
||||
@@ -81,10 +81,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings:
|
||||
start_settings:
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
action_probabilities:
|
||||
0: 0.4
|
||||
1: 0.6
|
||||
|
||||
@@ -35,10 +35,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
|
||||
- ref: data_manipulation_attacker
|
||||
team: RED
|
||||
@@ -75,10 +74,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
|
||||
- ref: defender
|
||||
team: BLUE
|
||||
|
||||
@@ -151,10 +151,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
|
||||
- ref: defender
|
||||
team: BLUE
|
||||
|
||||
@@ -266,10 +266,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings:
|
||||
start_settings:
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -56,10 +56,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings:
|
||||
start_settings:
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
action_probabilities:
|
||||
0: 0.4
|
||||
1: 0.6
|
||||
|
||||
@@ -150,10 +150,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
|
||||
- ref: defender_1
|
||||
team: BLUE
|
||||
|
||||
@@ -20,7 +20,6 @@ reds: &reds
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings:
|
||||
start_settings:
|
||||
start_step: 10
|
||||
frequency: 10
|
||||
variance: 0
|
||||
start_step: 10
|
||||
frequency: 10
|
||||
variance: 0
|
||||
|
||||
@@ -20,7 +20,6 @@ reds: &reds
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings:
|
||||
start_settings:
|
||||
start_step: 3
|
||||
frequency: 2
|
||||
variance: 1
|
||||
start_step: 3
|
||||
frequency: 2
|
||||
variance: 1
|
||||
|
||||
@@ -146,10 +146,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
|
||||
- ref: defender
|
||||
team: BLUE
|
||||
|
||||
@@ -56,10 +56,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings:
|
||||
start_settings:
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
start_step: 5
|
||||
frequency: 4
|
||||
variance: 3
|
||||
action_probabilities:
|
||||
0: 0.4
|
||||
1: 0.6
|
||||
|
||||
@@ -150,10 +150,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
|
||||
- ref: defender
|
||||
team: BLUE
|
||||
|
||||
@@ -43,10 +43,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
action_probabilities:
|
||||
0: 1.0
|
||||
|
||||
@@ -86,10 +85,9 @@ agents:
|
||||
- type: DUMMY
|
||||
|
||||
agent_settings: # options specific to this particular agent type, basically args of __init__(self)
|
||||
start_settings:
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
start_step: 25
|
||||
frequency: 20
|
||||
variance: 5
|
||||
|
||||
- ref: defender
|
||||
team: BLUE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# © Crown-owned copyright 2025, Defence Science and Technology Laboratory UK
|
||||
from typing import Any, Dict, Tuple
|
||||
from typing import Any, Dict, Optional, Tuple
|
||||
|
||||
import pytest
|
||||
import yaml
|
||||
|
||||
@@ -3,6 +3,7 @@ from primaite.game.agent.actions import ActionManager
|
||||
from primaite.game.agent.observations.observation_manager import NestedObservation, ObservationManager
|
||||
from primaite.game.agent.rewards import RewardFunction
|
||||
from primaite.game.agent.scripted_agents.probabilistic_agent import ProbabilisticAgent
|
||||
from primaite.game.game import PrimaiteGame
|
||||
|
||||
|
||||
def test_probabilistic_agent():
|
||||
@@ -25,36 +26,41 @@ def test_probabilistic_agent():
|
||||
MIN_NODE_FILE_DELETE = 5750
|
||||
MAX_NODE_FILE_DELETE = 6250
|
||||
|
||||
action_space = ActionManager(
|
||||
actions=[
|
||||
action_space_cfg = {
|
||||
"action_list": [
|
||||
{"type": "DONOTHING"},
|
||||
{"type": "NODE_APPLICATION_EXECUTE"},
|
||||
{"type": "NODE_FILE_DELETE"},
|
||||
],
|
||||
nodes=[
|
||||
"nodes": [
|
||||
{
|
||||
"node_name": "client_1",
|
||||
"applications": [{"application_name": "WebBrowser"}],
|
||||
"folders": [{"folder_name": "downloads", "files": [{"file_name": "cat.png"}]}],
|
||||
},
|
||||
],
|
||||
max_folders_per_node=2,
|
||||
max_files_per_folder=2,
|
||||
max_services_per_node=2,
|
||||
max_applications_per_node=2,
|
||||
max_nics_per_node=2,
|
||||
max_acl_rules=10,
|
||||
protocols=["TCP", "UDP", "ICMP"],
|
||||
ports=["HTTP", "DNS", "ARP"],
|
||||
act_map={
|
||||
"max_folders_per_node": 2,
|
||||
"max_files_per_folder": 2,
|
||||
"max_services_per_node": 2,
|
||||
"max_applications_per_node": 2,
|
||||
"max_nics_per_node": 2,
|
||||
"max_acl_rules": 10,
|
||||
"protocols": ["TCP", "UDP", "ICMP"],
|
||||
"ports": ["HTTP", "DNS", "ARP"],
|
||||
"act_map": {
|
||||
0: {"action": "DONOTHING", "options": {}},
|
||||
1: {"action": "NODE_APPLICATION_EXECUTE", "options": {"node_id": 0, "application_id": 0}},
|
||||
2: {"action": "NODE_FILE_DELETE", "options": {"node_id": 0, "folder_id": 0, "file_id": 0}},
|
||||
},
|
||||
)
|
||||
"options": {},
|
||||
}
|
||||
observation_space = ObservationManager(NestedObservation(components={}))
|
||||
reward_function = RewardFunction()
|
||||
|
||||
observation_space_cfg = None
|
||||
|
||||
reward_function_cfg = {}
|
||||
|
||||
# pa = ProbabilisticAgent(
|
||||
# agent_name="test_agent",
|
||||
# action_space=action_space,
|
||||
@@ -67,9 +73,10 @@ def test_probabilistic_agent():
|
||||
|
||||
pa_config = {
|
||||
"agent_name": "test_agent",
|
||||
"action_manager": action_space,
|
||||
"observation_manager": observation_space,
|
||||
"reward_function": reward_function,
|
||||
"game": PrimaiteGame(),
|
||||
"action_manager": action_space_cfg,
|
||||
"observation_manager": observation_space_cfg,
|
||||
"reward_function": reward_function_cfg,
|
||||
"agent_settings": {
|
||||
"action_probabilities": {0: P_DO_NOTHING, 1: P_NODE_APPLICATION_EXECUTE, 2: P_NODE_FILE_DELETE},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user