def run_custom_config_command(self, context, custom_command): """Send custom command in configuration mode :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_config_command( custom_command=parse_custom_commands(custom_command)) return response
def run_custom_config_command(self, context, custom_command): """Send custom command in configuration mode :param custom_command: Config 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_config_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