Soft Patch Panel
 help / color / mirror / Atom feed
From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 2/5] spp-ctl: add exit cmd support for spp_primary
Date: Thu, 25 Oct 2018 14:20:20 +0900	[thread overview]
Message-ID: <20181025052023.17190-3-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20181025052023.17190-1-ogawa.yasufumi@lab.ntt.co.jp>

From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>

Spp-ctl does not support to exit spp_primary, but it is required using
from `spp.py`. This update is to add a REST API for exiting the process.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/spp-ctl/spp_proc.py   | 4 ++++
 src/spp-ctl/spp_webapi.py | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/src/spp-ctl/spp_proc.py b/src/spp-ctl/spp_proc.py
index aa928f2..83c59ea 100644
--- a/src/spp-ctl/spp_proc.py
+++ b/src/spp-ctl/spp_proc.py
@@ -189,3 +189,7 @@ class PrimaryProc(SppProc):
     @exec_command
     def clear(self):
         return "clear"
+
+    @exec_command
+    def do_exit(self):
+        return "exit"
diff --git a/src/spp-ctl/spp_webapi.py b/src/spp-ctl/spp_webapi.py
index 8332cab..8d0510c 100644
--- a/src/spp-ctl/spp_webapi.py
+++ b/src/spp-ctl/spp_webapi.py
@@ -395,6 +395,7 @@ class V1PrimaryHandler(BaseHandler):
     def set_route(self):
         self.route('/status', 'GET', callback=self.get_status)
         self.route('/status', 'DELETE', callback=self.clear_status)
+        self.route('/', 'DELETE', callback=self.do_exit)
 
     def _get_proc(self):
         proc = self.ctrl.procs.get(spp_proc.ID_PRIMARY)
@@ -417,3 +418,8 @@ class V1PrimaryHandler(BaseHandler):
     def clear_status(self):
         proc = self._get_proc()
         proc.clear()
+
+    def do_exit(self):
+        proc = self._get_proc()
+        self.ctrl.do_exit(proc.type, proc.id)
+        proc.do_exit()
-- 
2.7.4

  parent reply	other threads:[~2018-10-25  5:20 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-25  5:20 [spp] [PATCH 0/5] Add exit command " ogawa.yasufumi
2018-10-25  5:20 ` [spp] [PATCH 1/5] primary: chage to return msg of exit command ogawa.yasufumi
2018-10-25  5:20 ` ogawa.yasufumi [this message]
2018-10-25  5:20 ` [spp] [PATCH 3/5] controller: change pri exit cmd to call REST API ogawa.yasufumi
2018-10-25  5:20 ` [spp] [PATCH 4/5] docs: add DELETE method for exiting spp_primary ogawa.yasufumi
2018-10-25  5:20 ` [spp] [PATCH 5/5] docs: remove exit from pri command ogawa.yasufumi
2018-11-09  3:21 ` [spp] [PATCH v2 0/5] Add exit command support for spp_primary ogawa.yasufumi
2018-11-09  3:21   ` [spp] [PATCH v2 1/5] primary: chage to return msg of exit command ogawa.yasufumi
2018-11-09  3:21   ` [spp] [PATCH v2 2/5] spp-ctl: add exit cmd support for spp_primary ogawa.yasufumi
2018-11-09  3:21   ` [spp] [PATCH v2 3/5] controller: change pri exit cmd to call REST API ogawa.yasufumi
2018-11-09  3:21   ` [spp] [PATCH v2 4/5] docs: add DELETE method for exiting spp_primary ogawa.yasufumi
2018-11-09  3:21   ` [spp] [PATCH v2 5/5] docs: remove exit from pri command ogawa.yasufumi

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=20181025052023.17190-3-ogawa.yasufumi@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --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).