Improve observation space test
This commit is contained in:
@@ -6,26 +6,63 @@
|
|||||||
steps: 5
|
steps: 5
|
||||||
- itemType: PORTS
|
- itemType: PORTS
|
||||||
portsList:
|
portsList:
|
||||||
- port: '21'
|
- port: '80'
|
||||||
- itemType: SERVICES
|
- itemType: SERVICES
|
||||||
serviceList:
|
serviceList:
|
||||||
- name: ftp
|
- name: TCP
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Nodes
|
||||||
- itemType: NODE
|
- itemType: NODE
|
||||||
node_id: '1'
|
node_id: '1'
|
||||||
name: node
|
name: PC1
|
||||||
node_class: SERVICE
|
node_class: SERVICE
|
||||||
node_type: COMPUTER
|
node_type: COMPUTER
|
||||||
priority: P1
|
priority: P5
|
||||||
hardware_state: 'ON'
|
hardware_state: 'ON'
|
||||||
ip_address: 192.168.0.1
|
ip_address: 192.168.1.1
|
||||||
software_state: GOOD
|
software_state: GOOD
|
||||||
file_system_state: GOOD
|
file_system_state: GOOD
|
||||||
services:
|
services:
|
||||||
- name: ftp
|
- name: TCP
|
||||||
port: '21'
|
port: '80'
|
||||||
state: GOOD
|
state: GOOD
|
||||||
- itemType: POSITION
|
- itemType: NODE
|
||||||
positions:
|
node_id: '2'
|
||||||
- node: '1'
|
name: SERVER
|
||||||
x_pos: 309
|
node_class: SERVICE
|
||||||
y_pos: 78
|
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
|
||||||
|
- itemType: 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
|
||||||
|
- itemType: LINK
|
||||||
|
id: '4'
|
||||||
|
name: link1
|
||||||
|
bandwidth: 1000
|
||||||
|
source: '1'
|
||||||
|
destination: '3'
|
||||||
|
- itemType: LINK
|
||||||
|
id: '5'
|
||||||
|
name: link2
|
||||||
|
bandwidth: 1000
|
||||||
|
source: '3'
|
||||||
|
destination: '2'
|
||||||
|
|||||||
@@ -6,26 +6,63 @@
|
|||||||
steps: 5
|
steps: 5
|
||||||
- itemType: PORTS
|
- itemType: PORTS
|
||||||
portsList:
|
portsList:
|
||||||
- port: '21'
|
- port: '80'
|
||||||
- itemType: SERVICES
|
- itemType: SERVICES
|
||||||
serviceList:
|
serviceList:
|
||||||
- name: ftp
|
- name: TCP
|
||||||
|
|
||||||
|
########################################
|
||||||
|
# Nodes
|
||||||
- itemType: NODE
|
- itemType: NODE
|
||||||
node_id: '1'
|
node_id: '1'
|
||||||
name: node
|
name: PC1
|
||||||
node_class: SERVICE
|
node_class: SERVICE
|
||||||
node_type: COMPUTER
|
node_type: COMPUTER
|
||||||
priority: P1
|
priority: P5
|
||||||
hardware_state: 'ON'
|
hardware_state: 'ON'
|
||||||
ip_address: 192.168.0.1
|
ip_address: 192.168.1.1
|
||||||
software_state: GOOD
|
software_state: GOOD
|
||||||
file_system_state: GOOD
|
file_system_state: GOOD
|
||||||
services:
|
services:
|
||||||
- name: ftp
|
- name: TCP
|
||||||
port: '21'
|
port: '80'
|
||||||
state: GOOD
|
state: GOOD
|
||||||
- itemType: POSITION
|
- itemType: NODE
|
||||||
positions:
|
node_id: '2'
|
||||||
- node: '1'
|
name: SERVER
|
||||||
x_pos: 309
|
node_class: SERVICE
|
||||||
y_pos: 78
|
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
|
||||||
|
- itemType: 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
|
||||||
|
- itemType: LINK
|
||||||
|
id: '4'
|
||||||
|
name: link1
|
||||||
|
bandwidth: 1000
|
||||||
|
source: '1'
|
||||||
|
destination: '3'
|
||||||
|
- itemType: LINK
|
||||||
|
id: '5'
|
||||||
|
name: link2
|
||||||
|
bandwidth: 1000
|
||||||
|
source: '3'
|
||||||
|
destination: '2'
|
||||||
|
|||||||
@@ -12,6 +12,12 @@ def test_creating_env_with_box_obs():
|
|||||||
)
|
)
|
||||||
env.update_environent_obs()
|
env.update_environent_obs()
|
||||||
|
|
||||||
|
# we have three nodes and two links, with one service
|
||||||
|
# therefore the box observation space will have:
|
||||||
|
# * 5 columns (four fixed and one for the service)
|
||||||
|
# * 5 rows (3 nodes + 2 links)
|
||||||
|
assert env.env_obs.shape == (5, 5)
|
||||||
|
|
||||||
|
|
||||||
def test_creating_env_with_multidiscrete_obs():
|
def test_creating_env_with_multidiscrete_obs():
|
||||||
"""Try creating env with MultiDiscrete observation space."""
|
"""Try creating env with MultiDiscrete observation space."""
|
||||||
@@ -21,3 +27,8 @@ def test_creating_env_with_multidiscrete_obs():
|
|||||||
/ "multidiscrete_obs_space_laydown_config.yaml",
|
/ "multidiscrete_obs_space_laydown_config.yaml",
|
||||||
)
|
)
|
||||||
env.update_environent_obs()
|
env.update_environent_obs()
|
||||||
|
|
||||||
|
# we have three nodes and two links, with one service
|
||||||
|
# the nodes have hardware, OS, FS, and service, the links just have bandwidth,
|
||||||
|
# therefore we need 3*4 + 2 observations
|
||||||
|
assert env.env_obs.shape == (3 * 4 + 2,)
|
||||||
|
|||||||
Reference in New Issue
Block a user