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 976EBA046B for ; Mon, 24 Jun 2019 09:11:37 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 8ED471BF47; Mon, 24 Jun 2019 09:11:37 +0200 (CEST) Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) by dpdk.org (Postfix) with ESMTP id C366E1BF47 for ; Mon, 24 Jun 2019 09:11:36 +0200 (CEST) Received: by mail-pf1-f196.google.com with SMTP id r1so6951869pfq.12 for ; Mon, 24 Jun 2019 00:11:36 -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=q6P/ftP1TkmG1OJ7aPOymHe0KgbR/u0/nVsS9mi3Cbc=; b=uT/Rs1hhhEsYO6K20rUy33MX6PN0HcX1HnPfG4LaKrxT8KGq1+p+p6tzG4+nxIHgNn MD+X9L02SGmmwAE2y3+TOAk17/BioJEN+JP9ekSWvNBKGHqiH1BnJ9UpYr63sCP4gtvA Rl6lzjexQfbZmZrmd7YDSbm+NLgmnfUVxj7kaIMPHMBab4IdZqLaIKZPoxJwfyHyeDD5 viQcY+8uxKf1XFLookYcHlrBUX9hpR1GwBGKBEDsWj/EB885tpgYuWNrM0qXo5Uz694z XagoIEWCJ94Hs9w9QGY52xiLq2bsixAWTjkxCfb0KyThzMNGtzfLQhQb9/hdbmVz/8z3 HgnQ== 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=q6P/ftP1TkmG1OJ7aPOymHe0KgbR/u0/nVsS9mi3Cbc=; b=jPpxEhLJW5lbqY+gnxSs2e/1G1ANJQL16lcGRKnRF/M2zIkOHYqxhvzENJw99DYaMN wcLjWE1bYeIFiOTLX/m5WDgWj/od10nx58NM1f6haIgrIsFAFXMnblOR9a/r8WZ7peSI vs8W+Xi1O9CyEKiUcUeJDx5gfj13OE+3uTg/tmnuVxnqlrOcXZkf82xuX29G5wBZ8+Zn EocknC0KINhbITxzH9HoCX7yhQ6D/Xku2BDyCVYVrhPJSp210WCkODntXLLhtWaEmT/y OiG8cWYb5rWKVa3174+d3CkdL8G0IWOCFeus7ys7IzmGu2hfP3RwCCeKek3asb8+BBHk ZymA== X-Gm-Message-State: APjAAAUuWocU1E/VUUOlOeOY3wGuif/6Uf1Jxydc4FNmT43fWVlz9OnF G6DoIZ8FUzrYgpV3w4tuvHHqEE05 X-Google-Smtp-Source: APXvYqxXRYaB5LwXpPoZ3ftTAE2DJV9vDobGFtTrZsAgYkvDM7jaNWDzlHRnKFYmj1fPU09uh1bcyg== X-Received: by 2002:a17:90a:9281:: with SMTP id n1mr22309541pjo.25.1561360295942; Mon, 24 Jun 2019 00:11:35 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id y17sm6357948pfe.148.2019.06.24.00.11.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 00:11:35 -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:19 +0900 Message-Id: <20190624071124.23451-6-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 05/10] controller: move mirror help msg to SppMirror 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 patch is to move comment of `do_mirror` to `SppMirror.help` to reduce the number of lines. Signed-off-by: Yasufumi Ogawa --- src/controller/commands/mirror.py | 36 +++++++++++++++++++++++++++++++ src/controller/shell.py | 36 +++++-------------------------- 2 files changed, 41 insertions(+), 31 deletions(-) diff --git a/src/controller/commands/mirror.py b/src/controller/commands/mirror.py index d38812d..d7ea4cd 100644 --- a/src/controller/commands/mirror.py +++ b/src/controller/commands/mirror.py @@ -356,3 +356,39 @@ class SppMirror(object): if kw.startswith(sub_tokens[4]): res.append(kw) return res + + @classmethod + def help(cls): + msg = """Send a command to spp_mirror. + + spp_mirror is a secondary process for duplicating incoming + packets to be used as similar to TaaS in OpenStack. This + command has four sub commands. + * status + * component + * port + + Each of sub commands other than 'status' takes several parameters + for detailed operations. Notice that 'start' for launching a worker + is replaced with 'stop' for terminating. 'add' is also replaced with + 'del' for deleting. + + Examples: + + # (1) show status of worker threads and resources + spp > mirror 1; status + + # (2) launch or terminate a worker thread with arbitrary name + # NAME: arbitrary name used as identifier + # CORE_ID: one of unused cores referred from status + spp > mirror 1; component start NAME CORE_ID mirror + spp > mirror 1; component stop NAME CORE_ID mirror + + # (3) add or delete a port to worker of NAME + # RES_UID: resource UID such as 'ring:0' or 'vhost:1' + # DIR: 'rx' or 'tx' + spp > mirror 1; port add RES_UID DIR NAME + spp > mirror 1; port del RES_UID DIR NAME + """ + + print(msg) diff --git a/src/controller/shell.py b/src/controller/shell.py index b11dac0..2682376 100644 --- a/src/controller/shell.py +++ b/src/controller/shell.py @@ -418,37 +418,7 @@ class Shell(cmd.Cmd, object): self.get_sec_ids('vf'), text, line, begidx, endidx) def do_mirror(self, cmd): - """Send a command to spp_mirror. - - spp_mirror is a secondary process for duplicating incoming - packets to be used as similar to TaaS in OpenStack. This - command has four sub commands. - * status - * component - * port - - Each of sub commands other than 'status' takes several parameters - for detailed operations. Notice that 'start' for launching a worker - is replaced with 'stop' for terminating. 'add' is also replaced with - 'del' for deleting. - - Examples: - - # (1) show status of worker threads and resources - spp > mirror 1; status - - # (2) launch or terminate a worker thread with arbitrary name - # NAME: arbitrary name used as identifier - # CORE_ID: one of unused cores referred from status - spp > mirror 1; component start NAME CORE_ID mirror - spp > mirror 1; component stop NAME CORE_ID mirror - - # (3) add or delete a port to worker of NAME - # RES_UID: resource UID such as 'ring:0' or 'vhost:1' - # DIR: 'rx' or 'tx' - spp > mirror 1; port add RES_UID DIR NAME - spp > mirror 1; port del RES_UID DIR NAME - """ + """Send a command to spp_mirror.""" # remove unwanted spaces to avoid invalid command error tmparg = self.clean_cmd(cmd) @@ -461,6 +431,10 @@ class Shell(cmd.Cmd, object): else: print('Invalid command: %s' % tmparg) + def help_mirror(self): + """Print help message of mirror command.""" + mirror.SppMirror.help() + def complete_mirror(self, text, line, begidx, endidx): """Completion for mirror command.""" -- 2.17.1