Soft Patch Panel
 help / color / mirror / Atom feed
From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 01/10] controller: move vf help msg to SppVf.help
Date: Mon, 24 Jun 2019 16:11:15 +0900	[thread overview]
Message-ID: <20190624071124.23451-2-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190624071124.23451-1-yasufum.o@gmail.com>

From: Yasufumi Ogawa <yasufum.o@gmail.com>

SPP CLI is implemented with python's cmd library and help message is
defined as a comment of `do_*` method. However, total number of lines
tends to be a large number if the number of command is increased.

To avoid such a situation, this update is to move comment of `do_vf`
to `SppVf.help` to reduce the number of lines.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/controller/commands/vf.py | 54 +++++++++++++++++++++++++++++++++++
 src/controller/shell.py       | 46 ++++-------------------------
 2 files changed, 59 insertions(+), 41 deletions(-)

diff --git a/src/controller/commands/vf.py b/src/controller/commands/vf.py
index b673f0f..c6192e0 100644
--- a/src/controller/commands/vf.py
+++ b/src/controller/commands/vf.py
@@ -501,3 +501,57 @@ class SppVf(object):
                             if 'RES_UID'.startswith(sub_tokens[5]):
                                 res.append('RES_UID')
             return res
+
+    @classmethod
+    def help(cls):
+        msg = """Send a command to spp_vf.
+
+        SPP VF is a secondary process for pseudo SR-IOV features. This
+        command has four sub commands.
+          * status
+          * component
+          * port
+          * classifier_table
+
+        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 > vf 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
+        #   ROLE: role of workers, 'forward', 'merge' or 'classifier_mac'
+        spp > vf 1; component start NAME CORE_ID ROLE
+        spp > vf 1; component stop NAME CORE_ID ROLE
+
+        # (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 > vf 1; port add RES_UID DIR NAME
+        spp > vf 1; port del RES_UID DIR NAME
+
+        # (4) add or delete a port with vlan ID to worker of NAME
+        #   VID: vlan ID
+        #   PCP: priority code point defined in IEEE 802.1p
+        spp > vf 1; port add RES_UID DIR NAME add_vlantag VID PCP
+        spp > vf 1; port del RES_UID DIR NAME add_vlantag VID PCP
+
+        # (5) add a port of deleting vlan tag
+        spp > vf 1; port add RES_UID DIR NAME del_vlantag
+
+        # (6) add or delete an entry of MAC address and resource to classify
+        spp > vf 1; classifier_table add mac MAC_ADDR RES_UID
+        spp > vf 1; classifier_table del mac MAC_ADDR RES_UID
+
+        # (7) add or delete an entry of MAC address and resource with vlan ID
+        spp > vf 1; classifier_table add vlan VID MAC_ADDR RES_UID
+        spp > vf 1; classifier_table del vlan VID MAC_ADDR RES_UID
+        """
+
+        print(msg)
diff --git a/src/controller/shell.py b/src/controller/shell.py
index 057f70a..75dabaa 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -406,52 +406,12 @@ class Shell(cmd.Cmd, object):
     def do_vf(self, cmd):
         """Send a command to spp_vf.
 
-        SPP VF is a secondary process for pseudo SR-IOV features. This
+        spp_vf is a secondary process for pseudo SR-IOV features. This
         command has four sub commands.
           * status
           * component
           * port
           * classifier_table
-
-        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 > vf 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
-        #   ROLE: role of workers, 'forward', 'merge' or 'classifier_mac'
-        spp > vf 1; component start NAME CORE_ID ROLE
-        spp > vf 1; component stop NAME CORE_ID ROLE
-
-        # (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 > vf 1; port add RES_UID DIR NAME
-        spp > vf 1; port del RES_UID DIR NAME
-
-        # (4) add or delete a port with vlan ID to worker of NAME
-        #   VID: vlan ID
-        #   PCP: priority code point defined in IEEE 802.1p
-        spp > vf 1; port add RES_UID DIR NAME add_vlantag VID PCP
-        spp > vf 1; port del RES_UID DIR NAME add_vlantag VID PCP
-
-        # (5) add a port of deleting vlan tag
-        spp > vf 1; port add RES_UID DIR NAME del_vlantag
-
-        # (6) add or delete an entry of MAC address and resource to classify
-        spp > vf 1; classifier_table add mac MAC_ADDR RES_UID
-        spp > vf 1; classifier_table del mac MAC_ADDR RES_UID
-
-        # (7) add or delete an entry of MAC address and resource with vlan ID
-        spp > vf 1; classifier_table add vlan VID MAC_ADDR RES_UID
-        spp > vf 1; classifier_table del vlan VID MAC_ADDR RES_UID
         """
 
         # remove unwanted spaces to avoid invalid command error
@@ -466,6 +426,10 @@ class Shell(cmd.Cmd, object):
         else:
             print('Invalid command: %s' % tmparg)
 
+    def help_vf(self):
+        """Print help message of spp_vf."""
+        vf.SppVf.help()
+
     def complete_vf(self, text, line, begidx, endidx):
         """Completion for vf command."""
 
-- 
2.17.1


  reply	other threads:[~2019-06-24  7:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-24  7:11 [spp] [PATCH 00/10] Move help messages of CLI in shell.py yasufum.o
2019-06-24  7:11 ` yasufum.o [this message]
2019-06-24  7:11 ` [spp] [PATCH 02/10] controller: move server help msg to SppCtlServer yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 03/10] controller: move pri help msg to SppPrimary yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 04/10] controller: move nfv help msg to SppNfv yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 05/10] controller: move mirror help msg to SppMirror yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 06/10] controller: move pcap help msg to SppPcap yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 07/10] controller: move bye help msg to SppBye yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 08/10] controller: move topo " yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 09/10] controller: move status cmd help msg to help_msg yasufum.o
2019-06-24  7:11 ` [spp] [PATCH 10/10] controller: move rest of " yasufum.o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190624071124.23451-2-yasufum.o@gmail.com \
    --to=yasufum.o@gmail.com \
    --cc=ferruh.yigit@intel.com \
    --cc=spp@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).