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

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

This patch is to move comment of `do_server` to `SppCtlServer.help` to
reduce the number of lines.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 src/controller/commands/server.py | 33 +++++++++++++++++++++++++++++++
 src/controller/shell.py           | 33 +++++--------------------------
 2 files changed, 38 insertions(+), 28 deletions(-)

diff --git a/src/controller/commands/server.py b/src/controller/commands/server.py
index c2bda9d..2b5913a 100644
--- a/src/controller/commands/server.py
+++ b/src/controller/commands/server.py
@@ -258,3 +258,36 @@ class SppCtlServer(object):
                 removed.ip_addr, removed.port))
 
         return True
+
+    @classmethod
+    def help(cls):
+        msg = """Switch SPP REST API server.
+
+        Show a list of servers. '*' means that it is under the control.
+
+            spp > server  # or 'server list'
+              1: 192.168.1.101:7777 *
+              2: 192.168.1.102:7777
+
+        Switch to the second node with index or address.
+
+            spp > server 2
+            Switch spp-ctl to "2: 192.168.1.102:7777".
+
+            # It is the same
+            spp > server 192.168.1.101  # no need port if default
+            Switch spp-ctl to "1: 192.168.1.101:7777".
+
+        Register or unregister a node by using 'add' or 'del' command.
+        For unregistering, node is also specified with index.
+
+            # Register third node
+            spp > server add 192.168.122.177
+            Registered spp-ctl "192.168.122.177:7777".
+
+            # Unregister second one
+            spp > server del 2  # or 192.168.1.102
+            Unregistered spp-ctl "192.168.1.102:7777".
+        """
+
+        print(msg)
diff --git a/src/controller/shell.py b/src/controller/shell.py
index 75dabaa..b86ba5c 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -253,38 +253,15 @@ class Shell(cmd.Cmd, object):
             self.recorded_file = None
 
     def do_server(self, commands):
-        """Switch SPP REST API server.
-
-        Show a list of servers. '*' means that it is under the control.
-
-            spp > server  # or 'server list'
-              1: 192.168.1.101:7777 *
-              2: 192.168.1.102:7777
-
-        Switch to the second node with index or address.
-
-            spp > server 2
-            Switch spp-ctl to "2: 192.168.1.102:7777".
-
-            # It is the same
-            spp > server 192.168.1.101  # no need port if default
-            Switch spp-ctl to "1: 192.168.1.101:7777".
-
-        Register or unregister a node by using 'add' or 'del' command.
-        For unregistering, node is also specified with index.
-
-            # Register third node
-            spp > server add 192.168.122.177
-            Registered spp-ctl "192.168.122.177:7777".
-
-            # Unregister second one
-            spp > server del 2  # or 192.168.1.102
-            Unregistered spp-ctl "192.168.1.102:7777".
-        """
+        """Switch SPP REST API server."""
 
         self.spp_ctl_server.run(commands)
         self.spp_ctl_cli = self.spp_ctl_server.get_current_server()
 
+    def help_server(self):
+        """Print help message of server command."""
+        server.SppCtlServer.help()
+
     def complete_server(self, text, line, begidx, endidx):
         """Completion for server command."""
 
-- 
2.17.1


  parent reply index

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 ` [spp] [PATCH 01/10] controller: move vf help msg to SppVf.help yasufum.o
2019-06-24  7:11 ` yasufum.o [this message]
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 publically 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-3-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

Soft Patch Panel

Archives are clonable:
	git clone --mirror http://inbox.dpdk.org/spp/0 spp/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 spp spp/ http://inbox.dpdk.org/spp \
		spp@dpdk.org
	public-inbox-index spp


Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.spp


AGPL code for this site: git clone https://public-inbox.org/ public-inbox