port refactor - eod commit, airspace still broken
This commit is contained in:
@@ -33,7 +33,7 @@ def test_acl_observations(simulation):
|
||||
server.software_manager.install(NTPServer)
|
||||
|
||||
# add router acl rule
|
||||
router.acl.add_rule(action=ACLAction.PERMIT, dst_port=Port.NTP, src_port=Port.NTP, position=1)
|
||||
router.acl.add_rule(action=ACLAction.PERMIT, dst_port=Port["NTP"], src_port=Port["NTP"], position=1)
|
||||
|
||||
acl_obs = ACLObservation(
|
||||
where=["network", "nodes", router.hostname, "acl", "acl"],
|
||||
|
||||
@@ -62,13 +62,13 @@ def test_firewall_observation():
|
||||
# add a rule to the internal inbound and check that the observation is correct
|
||||
firewall.internal_inbound_acl.add_rule(
|
||||
action=ACLAction.DENY,
|
||||
protocol=IPProtocol.TCP,
|
||||
protocol=IPProtocol["TCP"],
|
||||
src_ip_address="10.0.0.1",
|
||||
src_wildcard_mask="0.0.0.1",
|
||||
dst_ip_address="10.0.0.2",
|
||||
dst_wildcard_mask="0.0.0.1",
|
||||
src_port=Port.HTTP,
|
||||
dst_port=Port.HTTP,
|
||||
src_port=Port["HTTP"],
|
||||
dst_port=Port["HTTP"],
|
||||
position=5,
|
||||
)
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ def test_config_nic_categories(simulation):
|
||||
|
||||
|
||||
def test_nic_monitored_traffic(simulation):
|
||||
monitored_traffic = {"icmp": ["NONE"], "tcp": ["DNS"]}
|
||||
monitored_traffic = {"icmp": ["NONE"], "tcp": [53,]}
|
||||
|
||||
pc: Computer = simulation.network.get_node_by_hostname("client_1")
|
||||
pc2: Computer = simulation.network.get_node_by_hostname("client_2")
|
||||
|
||||
@@ -39,13 +39,13 @@ def test_router_observation():
|
||||
# Add an ACL rule to the router
|
||||
router.acl.add_rule(
|
||||
action=ACLAction.DENY,
|
||||
protocol=IPProtocol.TCP,
|
||||
protocol=IPProtocol["TCP"],
|
||||
src_ip_address="10.0.0.1",
|
||||
src_wildcard_mask="0.0.0.1",
|
||||
dst_ip_address="10.0.0.2",
|
||||
dst_wildcard_mask="0.0.0.1",
|
||||
src_port=Port.HTTP,
|
||||
dst_port=Port.HTTP,
|
||||
src_port=Port["HTTP"],
|
||||
dst_port=Port["HTTP"],
|
||||
position=5,
|
||||
)
|
||||
# Observe the state using the RouterObservation instance
|
||||
|
||||
@@ -15,7 +15,7 @@ def env_with_ssh() -> PrimaiteGymEnv:
|
||||
env = PrimaiteGymEnv(DATA_MANIPULATION_CONFIG)
|
||||
env.agent.flatten_obs = False
|
||||
router: Router = env.game.simulation.network.get_node_by_hostname("router_1")
|
||||
router.acl.add_rule(ACLAction.PERMIT, src_port=Port.SSH, dst_port=Port.SSH, position=3)
|
||||
router.acl.add_rule(ACLAction.PERMIT, src_port=Port["SSH"], dst_port=Port["SSH"], position=3)
|
||||
return env
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user