#2449 fix observation integration
This commit is contained in:
@@ -205,7 +205,7 @@ class FolderObservation(AbstractObservation, identifier="FOLDER"):
|
|||||||
:return: Constructed folder observation instance.
|
:return: Constructed folder observation instance.
|
||||||
:rtype: FolderObservation
|
:rtype: FolderObservation
|
||||||
"""
|
"""
|
||||||
where = parent_where + ["folders", config.folder_name]
|
where = parent_where + ["file_system", "folders", config.folder_name]
|
||||||
|
|
||||||
# pass down shared/common config items
|
# pass down shared/common config items
|
||||||
for file_config in config.files:
|
for file_config in config.files:
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ class FirewallObservation(AbstractObservation, identifier="FIREWALL"):
|
|||||||
:rtype: FirewallObservation
|
:rtype: FirewallObservation
|
||||||
"""
|
"""
|
||||||
return cls(
|
return cls(
|
||||||
where=parent_where + ["nodes", config.hostname],
|
where=parent_where + [config.hostname],
|
||||||
ip_list=config.ip_list,
|
ip_list=config.ip_list,
|
||||||
wildcard_list=config.wildcard_list,
|
wildcard_list=config.wildcard_list,
|
||||||
port_list=config.port_list,
|
port_list=config.port_list,
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ class HostObservation(AbstractObservation, identifier="HOST"):
|
|||||||
if parent_where == []:
|
if parent_where == []:
|
||||||
where = ["network", "nodes", config.hostname]
|
where = ["network", "nodes", config.hostname]
|
||||||
else:
|
else:
|
||||||
where = parent_where + ["nodes", config.hostname]
|
where = parent_where + [config.hostname]
|
||||||
|
|
||||||
# Pass down shared/common config items
|
# Pass down shared/common config items
|
||||||
for folder_config in config.folders:
|
for folder_config in config.folders:
|
||||||
|
|||||||
@@ -164,7 +164,7 @@ class NodesObservation(AbstractObservation, identifier="NODES"):
|
|||||||
:return: Constructed nodes observation instance.
|
:return: Constructed nodes observation instance.
|
||||||
:rtype: NodesObservation
|
:rtype: NodesObservation
|
||||||
"""
|
"""
|
||||||
if parent_where is None:
|
if not parent_where:
|
||||||
where = ["network", "nodes"]
|
where = ["network", "nodes"]
|
||||||
else:
|
else:
|
||||||
where = parent_where + ["nodes"]
|
where = parent_where + ["nodes"]
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ class RouterObservation(AbstractObservation, identifier="ROUTER"):
|
|||||||
:return: Constructed router observation instance.
|
:return: Constructed router observation instance.
|
||||||
:rtype: RouterObservation
|
:rtype: RouterObservation
|
||||||
"""
|
"""
|
||||||
where = parent_where + ["nodes", config.hostname]
|
where = parent_where + [config.hostname]
|
||||||
|
|
||||||
if config.acl is None:
|
if config.acl is None:
|
||||||
config.acl = ACLObservation.ConfigSchema()
|
config.acl = ACLObservation.ConfigSchema()
|
||||||
|
|||||||
@@ -592,7 +592,7 @@
|
|||||||
"metadata": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"source": [
|
||||||
"obs['ACL']"
|
"obs['NODES']['ROUTER0']"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -616,12 +616,12 @@
|
|||||||
" tries += 1\n",
|
" tries += 1\n",
|
||||||
" obs, reward, terminated, truncated, info = env.step(0)\n",
|
" obs, reward, terminated, truncated, info = env.step(0)\n",
|
||||||
"\n",
|
"\n",
|
||||||
" if obs['NODES'][6]['NICS'][1]['NMNE']['outbound'] == 1:\n",
|
" if obs['NODES']['HOST5']['NICS'][1]['NMNE']['outbound'] == 1:\n",
|
||||||
" # client 1 has NMNEs, let's block it\n",
|
" # client 1 has NMNEs, let's block it\n",
|
||||||
" obs, reward, terminated, truncated, info = env.step(50) # block client 1\n",
|
" obs, reward, terminated, truncated, info = env.step(50) # block client 1\n",
|
||||||
" print(\"blocking client 1\")\n",
|
" print(\"blocking client 1\")\n",
|
||||||
" break\n",
|
" break\n",
|
||||||
" elif obs['NODES'][7]['NICS'][1]['NMNE']['outbound'] == 1:\n",
|
" elif obs['NODES']['HOST6']['NICS'][1]['NMNE']['outbound'] == 1:\n",
|
||||||
" # client 2 has NMNEs, so let's block it\n",
|
" # client 2 has NMNEs, so let's block it\n",
|
||||||
" obs, reward, terminated, truncated, info = env.step(51) # block client 2\n",
|
" obs, reward, terminated, truncated, info = env.step(51) # block client 2\n",
|
||||||
" print(\"blocking client 2\")\n",
|
" print(\"blocking client 2\")\n",
|
||||||
|
|||||||
Reference in New Issue
Block a user