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 66469A046B for ; Mon, 24 Jun 2019 09:11:33 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5E1D91BF28; Mon, 24 Jun 2019 09:11:33 +0200 (CEST) Received: from mail-pg1-f173.google.com (mail-pg1-f173.google.com [209.85.215.173]) by dpdk.org (Postfix) with ESMTP id 9A7B51BF28 for ; Mon, 24 Jun 2019 09:11:32 +0200 (CEST) Received: by mail-pg1-f173.google.com with SMTP id s27so6614940pgl.2 for ; Mon, 24 Jun 2019 00:11:32 -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=qElY0imwBoK7UdkXybRDe82CuJw93Db9U74nwiug3Ok=; b=CmAK3enRRdntg9xujUSK5VSpIFlQ1ZGYBIXJ2uSbranHEwyAZhAFVzwVzEdMy4A+Nv LaLH+6kDkCCFgWCpy+T82o4UOJ1y3iEutHz6S9ADcb38l8klDvTVdqooAeS5xRpY/aHv f0t0FAZ3d5Nk5SZgpV3TS/pSTjKzsLQbmc291kOKws3RUPmBbu6QKjfvEbfk2tfiLJ9d 698ze3yTM0hMSQrGt0IOhDXGJ/RD+O4vpACiSjn37kd/dY9IGkKbizCro379OjExxZmL 4vh16UmGlop+xscq5dZCzp8PB3B6eDcMjMTFzcL/JaKdkV6TMuFUP67uQd9X61ar2E+I EIsA== 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=qElY0imwBoK7UdkXybRDe82CuJw93Db9U74nwiug3Ok=; b=I/bRiWxBcpoJiLtaaFWm7Ch20RTqKJ50vo0ckDxPO/XEnXg5GDiEqrkdbR1wDhBvo+ uEJw/fUcHRc0s8Iz1BO3RKft4I8NwGvPY1RW+0LsY9tKhsaA4SBA4ot/T/Lr/57z0pIS GACcf5k96jihnQ+y/defIa1/VHHDvY0vUu1R1RUT3VJ7nUiobwiz/eDDkUtBwp5H542/ UgkpXMT+bH7MxPvzIAc2TdACjtmgJ5FN9X+9EISBXRx094BqwmVxNfCQA1CG3BtzyowL bcHtkF7CPmhPfxsGA8tD74b3so2BbqfKyRfmjfQFFxpKAkyp78DTsNuhwkyt9MtxVoDR e16A== X-Gm-Message-State: APjAAAUWJF+hRr2aLAExADsVYa8gIPyV/AafY67JKifjGWuTx9llNTOt +Frm57PkfPQ84X9QkLnWp8OZYWig X-Google-Smtp-Source: APXvYqxQJ9Xpm/EvVF8rjPc2fG+U1IWMtBXJz9EY1axF0UVQOekmwRa4QKuW7jAO1rfja+T0L9Izig== X-Received: by 2002:a63:78c3:: with SMTP id t186mr32416992pgc.340.1561360291665; Mon, 24 Jun 2019 00:11:31 -0700 (PDT) Received: from localhost.localdomain ([192.47.164.146]) by smtp.gmail.com with ESMTPSA id y17sm6357948pfe.148.2019.06.24.00.11.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Jun 2019 00:11:31 -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:16 +0900 Message-Id: <20190624071124.23451-3-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 02/10] controller: move server help msg to SppCtlServer 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_server` to `SppCtlServer.help` to reduce the number of lines. Signed-off-by: Yasufumi Ogawa --- 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