def run_custom_command(self, context, custom_command): """Executes a custom command on the device. :param ResourceCommandContext context: The context object for the command with resource and reservation info :param str custom_command: The command to run :return: the command result text :rtype: str """ logger = get_logger_with_thread_id(context) logger.info("Run custom command started") with ErrorHandlingContext(logger): resource_config = create_firewall_resource_from_context( self.SHELL_NAME, self.SUPPORTED_OS, context ) cs_api = get_api(context) cli_handler = F5CliHandler(self._cli, resource_config, logger, cs_api) send_command_operations = RunCommandRunner( logger=logger, cli_handler=cli_handler ) response = send_command_operations.run_custom_command( custom_command=parse_custom_commands(custom_command) ) logger.info("Run custom command ended with response: {}".format(response)) return response
def run_custom_command(self, context, cancellation_context, custom_command): """Executes a custom command on the device :param ResourceCommandContext context: The context object for the command with resource and reservation info :param CancellationContext cancellation_context: Object to signal a request for cancellation. Must be enabled in drivermetadata.xml as well :param str custom_command: The command to run. Note that commands that require a response are not supported. :return: the command result text :rtype: str """ logger = get_logger_with_thread_id(context) logger.info('Run Custom command started') with ErrorHandlingContext(logger): api = get_api(context) resource_config = create_load_balancing_resource_from_context(shell_name=self.SHELL_NAME, supported_os=self.SUPPORTED_OS, context=context) cli_handler = CgsCliHandler(cli=self._cli, resource_config=resource_config, logger=logger, api=api) send_command_operations = RunCommandRunner(logger=logger, cli_handler=cli_handler) response = send_command_operations.run_custom_command(custom_command=parse_custom_commands(custom_command)) logger.info('Run Custom command ended with response: {}'.format(response)) return response
def run_custom_command(self, context, custom_command): """Send custom command :param ResourceCommandContext context: ResourceCommandContext object with all Resource Attributes inside :return: result :rtype: str """ logger = get_logger_with_thread_id(context) with ErrorHandlingContext(logger): api = get_api(context) resource_config = VyOSResource.from_context(context=context, shell_type=SHELL_TYPE, shell_name=SHELL_NAME) cli_handler = VyOSCliHandler(cli=self._cli, resource_config=resource_config, api=cs_api, logger=logger) send_command_operations = CommandRunner(logger=logger, cli_handler=cli_handler) response = send_command_operations.run_custom_command( custom_command=parse_custom_commands(custom_command)) return response
def run_custom_command(self, context, custom_command): """Executes a custom command on the device :param ResourceCommandContext context: The context object for the command with resource and reservation info :param str custom_command: The command to run :return: the command result text :rtype: str """ logger = get_logger_with_thread_id(context) api = get_api(context) resource_config = create_resource_from_context(self.SHELL_NAME, self.SUPPORTED_OS, context) cli_handler = CliHandler(self._cli, resource_config, logger, api) command_operations = RunCommandRunner(logger, cli_handler) return command_operations.run_custom_command(parse_custom_commands(custom_command))
def run_custom_command(self, context, custom_command): """Send custom command :param ResourceCommandContext context: ResourceCommandContext object with all Resource Attributes inside :return: result :rtype: str """ logger = get_logger_with_thread_id(context) api = get_api(context) pass resource_config = create_networking_resource_from_context(shell_name=self.SHELL_NAME, supported_os=self.SUPPORTED_OS, context=context) cli_handler = JuniperCliHandler(self._cli, resource_config, logger, api) send_command_operations = RunCommandRunner(logger, cli_handler) response = send_command_operations.run_custom_command(custom_command=custom_command) return response
def run_custom_command(self, context, custom_command): """Send custom command :param custom_command: Command to run :param ResourceCommandContext context: ResourceCommandContext object with all Resource Attributes inside :return: result :rtype: str """ logger = get_logger_with_thread_id(context) api = get_api(context) resource_config = create_networking_resource_from_context( self.SHELL_NAME, self.SUPPORTED_OS, context) cli_handler = CliHandler(self._cli, resource_config, logger, api) command_operations = CommandRunner(logger, cli_handler) return command_operations.run_custom_command( parse_custom_commands(custom_command))
def run_custom_command(self, context, custom_command): """Send custom command :param ResourceCommandContext context: ResourceCommandContext object with all Resource Attributes inside :return: result :rtype: str """ logger = get_logger_with_thread_id(context) api = get_api(context) resource_config = create_networking_resource_from_context(shell_name=self.SHELL_NAME, supported_os=self.SUPPORTED_OS, context=context) cli_handler = CliHandler(self._cli, resource_config, logger, api) send_command_operations = CommandRunner(logger=logger, cli_handler=cli_handler) response = send_command_operations.run_custom_command(custom_command=parse_custom_commands(custom_command)) return response