#2402 refactor port actions to take same input params (hostname) as new acl actions for routers and firewalls
This commit is contained in:
@@ -260,8 +260,8 @@ agents:
|
|||||||
- type: NODE_RESET
|
- type: NODE_RESET
|
||||||
- type: ROUTER_ACL_ADDRULE
|
- type: ROUTER_ACL_ADDRULE
|
||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
|
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
@@ -589,82 +589,82 @@ agents:
|
|||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
position: 9
|
position: 9
|
||||||
62: # old action num: 38
|
62: # old action num: 38
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
63: # old action num: 39
|
63: # old action num: 39
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
64: # old action num: 40
|
64: # old action num: 40
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
65: # old action num: 41
|
65: # old action num: 41
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
66: # old action num: 42
|
66: # old action num: 42
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
67: # old action num: 43
|
67: # old action num: 43
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
68: # old action num: 44
|
68: # old action num: 44
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
69: # old action num: 45
|
69: # old action num: 45
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
70: # old action num: 46
|
70: # old action num: 46
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
71: # old action num: 47
|
71: # old action num: 47
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
72: # old action num: 48
|
72: # old action num: 48
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
73: # old action num: 49
|
73: # old action num: 49
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
74: # old action num: 50
|
74: # old action num: 50
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
75: # old action num: 51
|
75: # old action num: 51
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
76: # old action num: 52
|
76: # old action num: 52
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
77: # old action num: 53
|
77: # old action num: 53
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
|
|||||||
@@ -262,8 +262,8 @@ agents:
|
|||||||
- type: NODE_RESET
|
- type: NODE_RESET
|
||||||
- type: ROUTER_ACL_ADDRULE
|
- type: ROUTER_ACL_ADDRULE
|
||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
|
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
@@ -591,82 +591,82 @@ agents:
|
|||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
position: 9
|
position: 9
|
||||||
62: # old action num: 38
|
62: # old action num: 38
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
63: # old action num: 39
|
63: # old action num: 39
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
64: # old action num: 40
|
64: # old action num: 40
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
65: # old action num: 41
|
65: # old action num: 41
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
66: # old action num: 42
|
66: # old action num: 42
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
67: # old action num: 43
|
67: # old action num: 43
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
68: # old action num: 44
|
68: # old action num: 44
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
69: # old action num: 45
|
69: # old action num: 45
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
70: # old action num: 46
|
70: # old action num: 46
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
71: # old action num: 47
|
71: # old action num: 47
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
72: # old action num: 48
|
72: # old action num: 48
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
73: # old action num: 49
|
73: # old action num: 49
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
74: # old action num: 50
|
74: # old action num: 50
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
75: # old action num: 51
|
75: # old action num: 51
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
76: # old action num: 52
|
76: # old action num: 52
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
77: # old action num: 53
|
77: # old action num: 53
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
@@ -829,8 +829,8 @@ agents:
|
|||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
options:
|
options:
|
||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
|
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
@@ -1158,82 +1158,82 @@ agents:
|
|||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
position: 9
|
position: 9
|
||||||
62: # old action num: 38
|
62: # old action num: 38
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
63: # old action num: 39
|
63: # old action num: 39
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
64: # old action num: 40
|
64: # old action num: 40
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
65: # old action num: 41
|
65: # old action num: 41
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
66: # old action num: 42
|
66: # old action num: 42
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
67: # old action num: 43
|
67: # old action num: 43
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
68: # old action num: 44
|
68: # old action num: 44
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
69: # old action num: 45
|
69: # old action num: 45
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
70: # old action num: 46
|
70: # old action num: 46
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
71: # old action num: 47
|
71: # old action num: 47
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
72: # old action num: 48
|
72: # old action num: 48
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
73: # old action num: 49
|
73: # old action num: 49
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
74: # old action num: 50
|
74: # old action num: 50
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
75: # old action num: 51
|
75: # old action num: 51
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
76: # old action num: 52
|
76: # old action num: 52
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
77: # old action num: 53
|
77: # old action num: 53
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
|
|||||||
@@ -729,7 +729,7 @@ class FirewallACLRemoveRuleAction(AbstractAction):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class NetworkNICAbstractAction(AbstractAction):
|
class HostNICAbstractAction(AbstractAction):
|
||||||
"""
|
"""
|
||||||
Abstract base class for NIC actions.
|
Abstract base class for NIC actions.
|
||||||
|
|
||||||
@@ -738,7 +738,7 @@ class NetworkNICAbstractAction(AbstractAction):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, manager: "ActionManager", num_nodes: int, max_nics_per_node: int, **kwargs) -> None:
|
def __init__(self, manager: "ActionManager", num_nodes: int, max_nics_per_node: int, **kwargs) -> None:
|
||||||
"""Init method for NetworkNICAbstractAction.
|
"""Init method for HostNICAbstractAction.
|
||||||
|
|
||||||
:param manager: Reference to the ActionManager which created this action.
|
:param manager: Reference to the ActionManager which created this action.
|
||||||
:type manager: ActionManager
|
:type manager: ActionManager
|
||||||
@@ -760,7 +760,7 @@ class NetworkNICAbstractAction(AbstractAction):
|
|||||||
return ["network", "node", node_name, "network_interface", nic_num, self.verb]
|
return ["network", "node", node_name, "network_interface", nic_num, self.verb]
|
||||||
|
|
||||||
|
|
||||||
class NetworkNICEnableAction(NetworkNICAbstractAction):
|
class HostNICEnableAction(HostNICAbstractAction):
|
||||||
"""Action which enables a NIC."""
|
"""Action which enables a NIC."""
|
||||||
|
|
||||||
def __init__(self, manager: "ActionManager", num_nodes: int, max_nics_per_node: int, **kwargs) -> None:
|
def __init__(self, manager: "ActionManager", num_nodes: int, max_nics_per_node: int, **kwargs) -> None:
|
||||||
@@ -768,7 +768,7 @@ class NetworkNICEnableAction(NetworkNICAbstractAction):
|
|||||||
self.verb: str = "enable"
|
self.verb: str = "enable"
|
||||||
|
|
||||||
|
|
||||||
class NetworkNICDisableAction(NetworkNICAbstractAction):
|
class HostNICDisableAction(HostNICAbstractAction):
|
||||||
"""Action which disables a NIC."""
|
"""Action which disables a NIC."""
|
||||||
|
|
||||||
def __init__(self, manager: "ActionManager", num_nodes: int, max_nics_per_node: int, **kwargs) -> None:
|
def __init__(self, manager: "ActionManager", num_nodes: int, max_nics_per_node: int, **kwargs) -> None:
|
||||||
@@ -776,51 +776,42 @@ class NetworkNICDisableAction(NetworkNICAbstractAction):
|
|||||||
self.verb: str = "disable"
|
self.verb: str = "disable"
|
||||||
|
|
||||||
|
|
||||||
class NetworkPortAbstractAction(AbstractAction):
|
class NetworkPortEnableAction(AbstractAction):
|
||||||
"""
|
"""Action which enables are port on a router or a firewall."""
|
||||||
Abstract base class for Port actions.
|
|
||||||
|
|
||||||
Any action which applies to a Router/Firewall and uses node_id and port_id as its only two parameters
|
def __init__(self, manager: "ActionManager", max_nics_per_node: int, **kwargs) -> None:
|
||||||
can inherit from this base class.
|
"""Init method for NetworkPortEnableAction.
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, manager: "ActionManager", num_nodes: int, max_nics_per_node: int, **kwargs) -> None:
|
|
||||||
"""Init method for NetworkNICAbstractAction.
|
|
||||||
|
|
||||||
:param manager: Reference to the ActionManager which created this action.
|
|
||||||
:type manager: ActionManager
|
|
||||||
:param num_nodes: Number of nodes in the simulation.
|
|
||||||
:type num_nodes: int
|
|
||||||
:param max_nics_per_node: Maximum number of NICs per node.
|
:param max_nics_per_node: Maximum number of NICs per node.
|
||||||
:type max_nics_per_node: int
|
:type max_nics_per_node: int
|
||||||
"""
|
"""
|
||||||
super().__init__(manager=manager)
|
super().__init__(manager=manager)
|
||||||
self.shape: Dict[str, int] = {"node_id": num_nodes, "port_id": max_nics_per_node}
|
self.shape: Dict[str, int] = {"port_id": max_nics_per_node}
|
||||||
self.verb: str # define but don't initialise: defends against children classes not defining this
|
|
||||||
|
|
||||||
def form_request(self, node_id: int, port_id: int) -> List[str]:
|
def form_request(self, target_nodename: str, port_id: int) -> List[str]:
|
||||||
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
|
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
|
||||||
node_name = self.manager.get_node_name_by_idx(node_idx=node_id)
|
if target_nodename is None or port_id is None:
|
||||||
port_num = self.manager.get_nic_num_by_idx(node_idx=node_id, nic_idx=port_id)
|
|
||||||
if node_name is None or port_num is None:
|
|
||||||
return ["do_nothing"]
|
return ["do_nothing"]
|
||||||
return ["network", "node", node_name, "network_interface", port_num, self.verb]
|
return ["network", "node", target_nodename, "network_interface", port_id, "enable"]
|
||||||
|
|
||||||
|
|
||||||
class NetworkPortEnableAction(NetworkPortAbstractAction):
|
class NetworkPortDisableAction(AbstractAction):
|
||||||
"""Action which enables a PORT."""
|
"""Action which disables are port on a router or a firewall."""
|
||||||
|
|
||||||
def __init__(self, manager: "ActionManager", num_nodes: int, max_nics_per_node: int, **kwargs) -> None:
|
def __init__(self, manager: "ActionManager", max_nics_per_node: int, **kwargs) -> None:
|
||||||
super().__init__(manager=manager, num_nodes=num_nodes, max_nics_per_node=max_nics_per_node, **kwargs)
|
"""Init method for NetworkPortDisableAction.
|
||||||
self.verb: str = "enable"
|
|
||||||
|
|
||||||
|
:param max_nics_per_node: Maximum number of NICs per node.
|
||||||
|
:type max_nics_per_node: int
|
||||||
|
"""
|
||||||
|
super().__init__(manager=manager)
|
||||||
|
self.shape: Dict[str, int] = {"port_id": max_nics_per_node}
|
||||||
|
|
||||||
class NetworkPortDisableAction(NetworkPortAbstractAction):
|
def form_request(self, target_nodename: str, port_id: int) -> List[str]:
|
||||||
"""Action which disables a PORT."""
|
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
|
||||||
|
if target_nodename is None or port_id is None:
|
||||||
def __init__(self, manager: "ActionManager", num_nodes: int, max_nics_per_node: int, **kwargs) -> None:
|
return ["do_nothing"]
|
||||||
super().__init__(manager=manager, num_nodes=num_nodes, max_nics_per_node=max_nics_per_node, **kwargs)
|
return ["network", "node", target_nodename, "network_interface", port_id, "disable"]
|
||||||
self.verb: str = "disable"
|
|
||||||
|
|
||||||
|
|
||||||
class ActionManager:
|
class ActionManager:
|
||||||
@@ -861,8 +852,8 @@ class ActionManager:
|
|||||||
"ROUTER_ACL_REMOVERULE": RouterACLRemoveRuleAction,
|
"ROUTER_ACL_REMOVERULE": RouterACLRemoveRuleAction,
|
||||||
"FIREWALL_ACL_ADDRULE": FirewallACLAddRuleAction,
|
"FIREWALL_ACL_ADDRULE": FirewallACLAddRuleAction,
|
||||||
"FIREWALL_ACL_REMOVERULE": FirewallACLRemoveRuleAction,
|
"FIREWALL_ACL_REMOVERULE": FirewallACLRemoveRuleAction,
|
||||||
"NETWORK_NIC_ENABLE": NetworkNICEnableAction,
|
"HOST_NIC_ENABLE": HostNICEnableAction,
|
||||||
"NETWORK_NIC_DISABLE": NetworkNICDisableAction,
|
"HOST_NIC_DISABLE": HostNICDisableAction,
|
||||||
"NETWORK_PORT_ENABLE": NetworkPortEnableAction,
|
"NETWORK_PORT_ENABLE": NetworkPortEnableAction,
|
||||||
"NETWORK_PORT_DISABLE": NetworkPortDisableAction,
|
"NETWORK_PORT_DISABLE": NetworkPortDisableAction,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,8 +171,8 @@ agents:
|
|||||||
- type: NODE_RESET
|
- type: NODE_RESET
|
||||||
- type: ROUTER_ACL_ADDRULE
|
- type: ROUTER_ACL_ADDRULE
|
||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
|
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
@@ -403,82 +403,82 @@ agents:
|
|||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
position: 9
|
position: 9
|
||||||
38:
|
38:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
39:
|
39:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
40:
|
40:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
41:
|
41:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
42:
|
42:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
43:
|
43:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
44:
|
44:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
45:
|
45:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
46:
|
46:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
47:
|
47:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
48:
|
48:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
49:
|
49:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
50:
|
50:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
51:
|
51:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
52:
|
52:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
53:
|
53:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
|
|||||||
@@ -175,8 +175,8 @@ agents:
|
|||||||
- type: NODE_RESET
|
- type: NODE_RESET
|
||||||
- type: ROUTER_ACL_ADDRULE
|
- type: ROUTER_ACL_ADDRULE
|
||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
|
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
@@ -407,82 +407,82 @@ agents:
|
|||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
position: 9
|
position: 9
|
||||||
38:
|
38:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
39:
|
39:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
40:
|
40:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
41:
|
41:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
42:
|
42:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
43:
|
43:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
44:
|
44:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
45:
|
45:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
46:
|
46:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
47:
|
47:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
48:
|
48:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
49:
|
49:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
50:
|
50:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
51:
|
51:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
52:
|
52:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
53:
|
53:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
|
|||||||
@@ -88,6 +88,8 @@ agents:
|
|||||||
- type: DONOTHING
|
- type: DONOTHING
|
||||||
- type: FIREWALL_ACL_ADDRULE
|
- type: FIREWALL_ACL_ADDRULE
|
||||||
- type: FIREWALL_ACL_REMOVERULE
|
- type: FIREWALL_ACL_REMOVERULE
|
||||||
|
- type: NETWORK_PORT_DISABLE
|
||||||
|
- type: NETWORK_PORT_ENABLE
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
action: DONOTHING
|
action: DONOTHING
|
||||||
@@ -212,6 +214,16 @@ agents:
|
|||||||
firewall_port_name: external
|
firewall_port_name: external
|
||||||
firewall_port_direction: outbound
|
firewall_port_direction: outbound
|
||||||
position: 1
|
position: 1
|
||||||
|
13:
|
||||||
|
action: NETWORK_PORT_DISABLE
|
||||||
|
options:
|
||||||
|
target_nodename: firewall
|
||||||
|
port_id: 3
|
||||||
|
14:
|
||||||
|
action: NETWORK_PORT_ENABLE
|
||||||
|
options:
|
||||||
|
target_nodename: firewall
|
||||||
|
port_id: 3
|
||||||
options:
|
options:
|
||||||
nodes:
|
nodes:
|
||||||
- node_name: client_1
|
- node_name: client_1
|
||||||
|
|||||||
@@ -182,8 +182,8 @@ agents:
|
|||||||
- type: NODE_RESET
|
- type: NODE_RESET
|
||||||
- type: ROUTER_ACL_ADDRULE
|
- type: ROUTER_ACL_ADDRULE
|
||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
|
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
@@ -414,82 +414,82 @@ agents:
|
|||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
position: 9
|
position: 9
|
||||||
38:
|
38:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
39:
|
39:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
40:
|
40:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
41:
|
41:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
42:
|
42:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
43:
|
43:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
44:
|
44:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
45:
|
45:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
46:
|
46:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
47:
|
47:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
48:
|
48:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
49:
|
49:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
50:
|
50:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
51:
|
51:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
52:
|
52:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
53:
|
53:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
@@ -638,8 +638,8 @@ agents:
|
|||||||
- type: NODE_RESET
|
- type: NODE_RESET
|
||||||
- type: ROUTER_ACL_ADDRULE
|
- type: ROUTER_ACL_ADDRULE
|
||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
|
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
@@ -870,82 +870,82 @@ agents:
|
|||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
position: 9
|
position: 9
|
||||||
38:
|
38:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
39:
|
39:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
40:
|
40:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
41:
|
41:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
42:
|
42:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
43:
|
43:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
44:
|
44:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
45:
|
45:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
46:
|
46:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
47:
|
47:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
48:
|
48:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
49:
|
49:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
50:
|
50:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
51:
|
51:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
52:
|
52:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
53:
|
53:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
|
|||||||
@@ -260,8 +260,8 @@ agents:
|
|||||||
- type: NODE_RESET
|
- type: NODE_RESET
|
||||||
- type: ROUTER_ACL_ADDRULE
|
- type: ROUTER_ACL_ADDRULE
|
||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
|
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
@@ -589,82 +589,82 @@ agents:
|
|||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
position: 9
|
position: 9
|
||||||
62: # old action num: 38
|
62: # old action num: 38
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
63: # old action num: 39
|
63: # old action num: 39
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
64: # old action num: 40
|
64: # old action num: 40
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
65: # old action num: 41
|
65: # old action num: 41
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
66: # old action num: 42
|
66: # old action num: 42
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
67: # old action num: 43
|
67: # old action num: 43
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
68: # old action num: 44
|
68: # old action num: 44
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
69: # old action num: 45
|
69: # old action num: 45
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
70: # old action num: 46
|
70: # old action num: 46
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
71: # old action num: 47
|
71: # old action num: 47
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
72: # old action num: 48
|
72: # old action num: 48
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
73: # old action num: 49
|
73: # old action num: 49
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
74: # old action num: 50
|
74: # old action num: 50
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
75: # old action num: 51
|
75: # old action num: 51
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
76: # old action num: 52
|
76: # old action num: 52
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
77: # old action num: 53
|
77: # old action num: 53
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
|
|||||||
@@ -260,8 +260,8 @@ agents:
|
|||||||
- type: NODE_RESET
|
- type: NODE_RESET
|
||||||
- type: ROUTER_ACL_ADDRULE
|
- type: ROUTER_ACL_ADDRULE
|
||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
- type: NODE_APPLICATION_INSTALL
|
- type: NODE_APPLICATION_INSTALL
|
||||||
- type: NODE_APPLICATION_REMOVE
|
- type: NODE_APPLICATION_REMOVE
|
||||||
- type: NODE_APPLICATION_EXECUTE
|
- type: NODE_APPLICATION_EXECUTE
|
||||||
@@ -592,82 +592,82 @@ agents:
|
|||||||
target_router_hostname: router_1
|
target_router_hostname: router_1
|
||||||
position: 9
|
position: 9
|
||||||
62: # old action num: 38
|
62: # old action num: 38
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
63: # old action num: 39
|
63: # old action num: 39
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
64: # old action num: 40
|
64: # old action num: 40
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
65: # old action num: 41
|
65: # old action num: 41
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
66: # old action num: 42
|
66: # old action num: 42
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
67: # old action num: 43
|
67: # old action num: 43
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
68: # old action num: 44
|
68: # old action num: 44
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
69: # old action num: 45
|
69: # old action num: 45
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
70: # old action num: 46
|
70: # old action num: 46
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
71: # old action num: 47
|
71: # old action num: 47
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
72: # old action num: 48
|
72: # old action num: 48
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
73: # old action num: 49
|
73: # old action num: 49
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
74: # old action num: 50
|
74: # old action num: 50
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
75: # old action num: 51
|
75: # old action num: 51
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
76: # old action num: 52
|
76: # old action num: 52
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
77: # old action num: 53
|
77: # old action num: 53
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
|
|||||||
@@ -185,8 +185,8 @@ agents:
|
|||||||
- type: NODE_RESET
|
- type: NODE_RESET
|
||||||
- type: ROUTER_ACL_ADDRULE
|
- type: ROUTER_ACL_ADDRULE
|
||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
|
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
@@ -417,82 +417,82 @@ agents:
|
|||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
position: 9
|
position: 9
|
||||||
38:
|
38:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
39:
|
39:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
40:
|
40:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
41:
|
41:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
42:
|
42:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
43:
|
43:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
44:
|
44:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
45:
|
45:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
46:
|
46:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
47:
|
47:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
48:
|
48:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
49:
|
49:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
50:
|
50:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
51:
|
51:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
52:
|
52:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
53:
|
53:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
|
|||||||
@@ -183,8 +183,8 @@ agents:
|
|||||||
- type: NODE_RESET
|
- type: NODE_RESET
|
||||||
- type: ROUTER_ACL_ADDRULE
|
- type: ROUTER_ACL_ADDRULE
|
||||||
- type: ROUTER_ACL_REMOVERULE
|
- type: ROUTER_ACL_REMOVERULE
|
||||||
- type: NETWORK_NIC_ENABLE
|
- type: HOST_NIC_ENABLE
|
||||||
- type: NETWORK_NIC_DISABLE
|
- type: HOST_NIC_DISABLE
|
||||||
|
|
||||||
action_map:
|
action_map:
|
||||||
0:
|
0:
|
||||||
@@ -415,82 +415,82 @@ agents:
|
|||||||
target_router_nodename: router_1
|
target_router_nodename: router_1
|
||||||
position: 9
|
position: 9
|
||||||
38:
|
38:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
39:
|
39:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 0
|
node_id: 0
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
40:
|
40:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
41:
|
41:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 1
|
node_id: 1
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
42:
|
42:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
43:
|
43:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 2
|
node_id: 2
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
44:
|
44:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
45:
|
45:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 3
|
node_id: 3
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
46:
|
46:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
47:
|
47:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
48:
|
48:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
49:
|
49:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 4
|
node_id: 4
|
||||||
nic_id: 1
|
nic_id: 1
|
||||||
50:
|
50:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
51:
|
51:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 5
|
node_id: 5
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
52:
|
52:
|
||||||
action: "NETWORK_NIC_DISABLE"
|
action: "HOST_NIC_DISABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
53:
|
53:
|
||||||
action: "NETWORK_NIC_ENABLE"
|
action: "HOST_NIC_ENABLE"
|
||||||
options:
|
options:
|
||||||
node_id: 6
|
node_id: 6
|
||||||
nic_id: 0
|
nic_id: 0
|
||||||
|
|||||||
@@ -498,8 +498,8 @@ def game_and_agent():
|
|||||||
{"type": "NODE_RESET"},
|
{"type": "NODE_RESET"},
|
||||||
{"type": "ROUTER_ACL_ADDRULE"},
|
{"type": "ROUTER_ACL_ADDRULE"},
|
||||||
{"type": "ROUTER_ACL_REMOVERULE"},
|
{"type": "ROUTER_ACL_REMOVERULE"},
|
||||||
{"type": "NETWORK_NIC_ENABLE"},
|
{"type": "HOST_NIC_ENABLE"},
|
||||||
{"type": "NETWORK_NIC_DISABLE"},
|
{"type": "HOST_NIC_DISABLE"},
|
||||||
{"type": "NETWORK_PORT_ENABLE"},
|
{"type": "NETWORK_PORT_ENABLE"},
|
||||||
{"type": "NETWORK_PORT_DISABLE"},
|
{"type": "NETWORK_PORT_DISABLE"},
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -198,8 +198,8 @@ def test_router_acl_removerule_integration(game_and_agent: Tuple[PrimaiteGame, P
|
|||||||
assert client_1.ping("10.0.2.3")
|
assert client_1.ping("10.0.2.3")
|
||||||
|
|
||||||
|
|
||||||
def test_network_nic_disable_integration(game_and_agent: Tuple[PrimaiteGame, ProxyAgent]):
|
def test_host_nic_disable_integration(game_and_agent: Tuple[PrimaiteGame, ProxyAgent]):
|
||||||
"""Test that the NetworkNICDisableAction can form a request and that it is accepted by the simulation."""
|
"""Test that the HostNICDisableAction can form a request and that it is accepted by the simulation."""
|
||||||
game, agent = game_and_agent
|
game, agent = game_and_agent
|
||||||
|
|
||||||
# 1: Check that client_1 can access the network
|
# 1: Check that client_1 can access the network
|
||||||
@@ -214,7 +214,7 @@ def test_network_nic_disable_integration(game_and_agent: Tuple[PrimaiteGame, Pro
|
|||||||
|
|
||||||
# 2: Disable the NIC on client_1
|
# 2: Disable the NIC on client_1
|
||||||
action = (
|
action = (
|
||||||
"NETWORK_NIC_DISABLE",
|
"HOST_NIC_DISABLE",
|
||||||
{
|
{
|
||||||
"node_id": 0, # client_1
|
"node_id": 0, # client_1
|
||||||
"nic_id": 0, # the only nic (eth-1)
|
"nic_id": 0, # the only nic (eth-1)
|
||||||
@@ -233,8 +233,8 @@ def test_network_nic_disable_integration(game_and_agent: Tuple[PrimaiteGame, Pro
|
|||||||
assert server_1.ping("10.0.2.3")
|
assert server_1.ping("10.0.2.3")
|
||||||
|
|
||||||
|
|
||||||
def test_network_nic_enable_integration(game_and_agent: Tuple[PrimaiteGame, ProxyAgent]):
|
def test_host_nic_enable_integration(game_and_agent: Tuple[PrimaiteGame, ProxyAgent]):
|
||||||
"""Test that the NetworkNICEnableAction can form a request and that it is accepted by the simulation."""
|
"""Test that the HostNICEnableAction can form a request and that it is accepted by the simulation."""
|
||||||
|
|
||||||
game, agent = game_and_agent
|
game, agent = game_and_agent
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ def test_network_nic_enable_integration(game_and_agent: Tuple[PrimaiteGame, Prox
|
|||||||
|
|
||||||
# 2: Use action to enable nic
|
# 2: Use action to enable nic
|
||||||
action = (
|
action = (
|
||||||
"NETWORK_NIC_ENABLE",
|
"HOST_NIC_ENABLE",
|
||||||
{
|
{
|
||||||
"node_id": 0, # client_1
|
"node_id": 0, # client_1
|
||||||
"nic_id": 0, # the only nic (eth-1)
|
"nic_id": 0, # the only nic (eth-1)
|
||||||
@@ -343,8 +343,8 @@ def test_network_router_port_disable_integration(game_and_agent: Tuple[PrimaiteG
|
|||||||
action = (
|
action = (
|
||||||
"NETWORK_PORT_DISABLE",
|
"NETWORK_PORT_DISABLE",
|
||||||
{
|
{
|
||||||
"node_id": 3, # router
|
"target_nodename": "router", # router
|
||||||
"port_id": 0, # port 1
|
"port_id": 1, # port 1
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
agent.store_action(action)
|
agent.store_action(action)
|
||||||
@@ -375,8 +375,8 @@ def test_network_router_port_enable_integration(game_and_agent: Tuple[PrimaiteGa
|
|||||||
action = (
|
action = (
|
||||||
"NETWORK_PORT_ENABLE",
|
"NETWORK_PORT_ENABLE",
|
||||||
{
|
{
|
||||||
"node_id": 3, # router
|
"target_nodename": "router", # router
|
||||||
"port_id": 0, # port 1
|
"port_id": 1, # port 1
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
agent.store_action(action)
|
agent.store_action(action)
|
||||||
@@ -585,3 +585,22 @@ def test_firewall_acl_add_remove_rule_integration():
|
|||||||
|
|
||||||
env.step(12) # Remove ACL rule from External Outbound
|
env.step(12) # Remove ACL rule from External Outbound
|
||||||
assert firewall.external_outbound_acl.num_rules == 1
|
assert firewall.external_outbound_acl.num_rules == 1
|
||||||
|
|
||||||
|
|
||||||
|
def test_firewall_port_disable_enable_integration():
|
||||||
|
"""
|
||||||
|
Test that NetworkPortEnableAction and NetworkPortDisableAction can form a request and that it is accepted by the simulation.
|
||||||
|
"""
|
||||||
|
with open(FIREWALL_ACTIONS_NETWORK, "r") as f:
|
||||||
|
cfg = yaml.safe_load(f)
|
||||||
|
|
||||||
|
env = PrimaiteGymEnv(game_config=cfg)
|
||||||
|
firewall = env.game.simulation.network.get_node_by_hostname("firewall")
|
||||||
|
|
||||||
|
assert firewall.dmz_port.enabled == True
|
||||||
|
|
||||||
|
env.step(13) # Disable Firewall DMZ Port
|
||||||
|
assert firewall.dmz_port.enabled == False
|
||||||
|
|
||||||
|
env.step(14) # Enable Firewall DMZ Port
|
||||||
|
assert firewall.dmz_port.enabled == True
|
||||||
|
|||||||
Reference in New Issue
Block a user