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