From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D9F65A046B for ; Mon, 24 Jun 2019 09:11:43 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D26C01BEFB; Mon, 24 Jun 2019 09:11:43 +0200 (CEST) Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) by dpdk.org (Postfix) with ESMTP id 771391BF29 for ; Mon, 24 Jun 2019 09:11:42 +0200 (CEST) Received: by mail-pl1-f171.google.com with SMTP id c14so6356057plo.0 for ; Mon, 24 Jun 2019 00:11:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=NIG/cRCy9enOss2M4vQQYEluXQ8bINQiDe5LetEMGXs=; b=OMbQ5L2si63fkYxvK5fWCEjmbs0wWcU1naUVyBMy1KVH9jH8cDGba1r2fM4oRuLuyz eQV7Wnl+wuuZ8UKm26pqMxj6UomUl0DF/rRzyVcPUOyJlmhtrsRKvY5EkUvzT8o9clGL hQ6RkY5x80jl3DnnnoseabfY9ee9AfhiTez9atLn9dcd54IeksGiQBXjaJ+g89asxT5W Q2w3VfvQQGB96wtnKVEnnkx2MI2VTFsqrUJqrE90Ep0keJaUrbTfoG/JoycMQwvqt3GY mrmOD4DDEE228fgsHCO7iG177RLuvHplEEeGAfgdW9ZEvFyduWRiI00V/vkNFpUCxDWj gLRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=NIG/cRCy9enOss2M4vQQYEluXQ8bINQiDe5LetEMGXs=; b=AYAuch0pVXwYe8fBKl5HxkLhwucFmqiWF8otOdEZwzqNQ9zPP93XOV7foWcB91cVvL jH4M2/Bk6usXHZdR+Fm3eIn2LR6acGg9jtiiC9I3+Z8YN7OSwOymwpvW8erdsfhHWmvB BdFv9LiyM01mgmZcvmehB7GEY+7Ipdn9B65t4iP5RM0zLVX8jKGKGLVboN8pAmTLwpiF 7uAlDfvDnZAxGAiLL9wmKVs10CNHltQVqODP2v162FvG2WhyEB0ybskxWxcMVhpCdTql 6pYivS2QSgmqWE6scYOWQnha2AniX4PrEnMavzljGuVM0AtAQg0omAashg8WquiDZLWl +4Nw== X-Gm-Message-State: APjAAAV3ahbOrQamf9AjtzptqAz0iE752Rs/E+bQwL+J7BUPgZrkXswD 68nkSwfRxuKY9X8fPF9IrGMCL0dc X-Google-Smtp-Source: APXvYqxQkr9nXZO37py7uXc4FU1m4wHP7eaBHAGqPMshsy7iQZJ9xNsAW/cL9eIB+aFZGGpBQnl4xA== X-Received: by 2002:a17:902:3fa5:: with SMTP id a34mr141190961pld.317.1561360301645; Mon, 24 Jun 2019 00:11:41 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id y17sm6357948pfe.148.2019.06.24.00.11.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 00:11:41 -0700 (PDT) From: yasufum.o@gmail.com To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com Date: Mon, 24 Jun 2019 16:11:23 +0900 Message-Id: <20190624071124.23451-10-yasufum.o@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190624071124.23451-1-yasufum.o@gmail.com> References: <20190624071124.23451-1-yasufum.o@gmail.com> Subject: [spp] [PATCH 09/10] controller: move status cmd help msg to help_msg X-BeenThere: spp@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Soft Patch Panel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spp-bounces@dpdk.org Sender: "spp" From: Yasufumi Ogawa This update is to move help message of status command to `help_msg` module which is for defining a set of command name and message. Signed-off-by: Yasufumi Ogawa --- src/controller/commands/help_msg.py | 10 ++++++++++ src/controller/shell.py | 15 ++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 src/controller/commands/help_msg.py diff --git a/src/controller/commands/help_msg.py b/src/controller/commands/help_msg.py new file mode 100644 index 0000000..9e15123 --- /dev/null +++ b/src/controller/commands/help_msg.py @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2019 Nippon Telegraph and Telephone Corporation + +commands = { + 'status': + """Display status info of SPP processes. + + spp > status + """ + } diff --git a/src/controller/shell.py b/src/controller/shell.py index 54376c9..065fb07 100644 --- a/src/controller/shell.py +++ b/src/controller/shell.py @@ -10,6 +10,7 @@ from .commands import topo from .commands import vf from .commands import mirror from .commands import pcap +from .commands import help_msg import os import re import readline @@ -29,7 +30,7 @@ class Shell(cmd.Cmd, object): config_file = "{}/config/default.yml".format( os.path.dirname(__file__)) cli_config = yaml.load(open(config_file), - Loader=yaml.FullLoader) + Loader=yaml.FullLoader) except IOError as e: print('Error: no config file found!') print(e) @@ -205,7 +206,7 @@ class Shell(cmd.Cmd, object): pt2 = id2.split(delim)[0] if (pt1 in spp_common.PORT_TYPES) \ and (pt2 in spp_common.PORT_TYPES): - return True + return True return False def clean_cmd(self, cmdstr): @@ -270,13 +271,13 @@ class Shell(cmd.Cmd, object): return res def do_status(self, _): - """Display status info of SPP processes - - spp > status - """ - + """Display status info of SPP processes.""" self.print_status() + def help_status(self): + """Print help message of status command.""" + print(help_msg.commads['status']) + def do_pri(self, command): """Send a command to primary process.""" -- 2.17.1