def remote_call(self, procedure_name, para): """Execute the remote call. Args: procedure_name: Name of the remote procedure. para: A short script contains one or more device ip, identity information and actual commands which could be executed on device. Return: None. But the feedback of the execution would be stored in the message queue of current master object. """ str_script, agent_ip = ScriptHandler.translate_script(para) return self.invoker.remote_call(procedure_name, str_script, agent_ip)
def exec_cmd(self, abs_cmd, identity, protocol): """ Execute abstract directly on remote device. Args: abs_cmd: The abstract command that would be executed on remote device identity: The data structure contains device ip, id and password which could be used to log in the target device. protocol: The protocol class which defines the interaction methods from agent to device. Return: None. But the feedback of the execution would be stored in the message queue of current master object. """ # convert abs_cmd, identity to script str_script = ScriptHandler.generate_script(abs_cmd, identity, protocol) return self.proxy.remote_call('exec_script', str_script)