#2769: added changes which should align with 2735 once merged

This commit is contained in:
Czar Echavez
2024-07-30 11:33:52 +01:00
parent f91800003c
commit 7b523d9450
4 changed files with 35 additions and 26 deletions

View File

@@ -1077,9 +1077,9 @@ class NodeAccountsChangePasswordAction(AbstractAction):
def __init__(self, manager: "ActionManager", **kwargs) -> None:
super().__init__(manager=manager)
def form_request(self, node_id: str) -> RequestFormat:
def form_request(self, node_id: str, username: str, current_password: str, new_password: str) -> RequestFormat:
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
return ["network", "node", node_id, "change_password"]
return ["network", "node", node_id, "accounts", "change_password", username, current_password, new_password]
class NodeSessionsRemoteLoginAction(AbstractAction):
@@ -1088,9 +1088,9 @@ class NodeSessionsRemoteLoginAction(AbstractAction):
def __init__(self, manager: "ActionManager", **kwargs) -> None:
super().__init__(manager=manager)
def form_request(self, node_id: str) -> RequestFormat:
def form_request(self, node_id: str, username: str, password: str) -> RequestFormat:
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
return ["network", "node", node_id, "remote_logon"]
return ["network", "node", node_id, "sessions", "remote_login", username, password]
class NodeSessionsRemoteLogoutAction(AbstractAction):
@@ -1099,9 +1099,9 @@ class NodeSessionsRemoteLogoutAction(AbstractAction):
def __init__(self, manager: "ActionManager", **kwargs) -> None:
super().__init__(manager=manager)
def form_request(self, node_id: str) -> RequestFormat:
def form_request(self, node_id: str, remote_session_id: str) -> RequestFormat:
"""Return the action formatted as a request which can be ingested by the PrimAITE simulation."""
return ["network", "node", node_id, "remote_logoff"]
return ["network", "node", node_id, "sessions", "remote_logout", remote_session_id]
class ActionManager:

View File

@@ -1071,18 +1071,6 @@ class Node(SimComponent):
rm.add_request(
"logoff", RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on)
) # TODO implement logoff request
rm.add_request(
"change_password",
RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on),
) # TODO implement change_password request
rm.add_request(
"remote_logon",
RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on),
) # TODO implement remote_logon request
rm.add_request(
"remote_logoff",
RequestType(func=lambda request, context: RequestResponse.from_bool(False), validator=_node_is_on),
) # TODO implement remote_logoff request
self._os_request_manager = RequestManager()
self._os_request_manager.add_request(