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 4/5] controller: update sec exit cmd to call REST API
Date: Thu, 25 Oct 2018 14:19:42 +0900	[thread overview]
Message-ID: <20181025051943.17129-5-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20181025051943.17129-1-ogawa.yasufumi@lab.ntt.co.jp>

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

To send `exit` command to spp_nfv or spp_vm, change to call REST API of
spp-ctl.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/controller/commands/sec.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/controller/commands/sec.py b/src/controller/commands/sec.py
index 77cfe62..ec1da58 100644
--- a/src/controller/commands/sec.py
+++ b/src/controller/commands/sec.py
@@ -107,7 +107,15 @@ class SppSecondary(object):
                         print('Error: unknown response.')
 
         elif cmd == 'exit':
-            print('do nothing.')
+            res = self.spp_ctl_cli.delete('nfvs/%d' % sec_id)
+            if res is not None:
+                error_codes = self.spp_ctl_cli.rest_common_error_codes
+                if res.status_code == 204:
+                    print('Exit sec %d' % sec_id)
+                elif res.status_code in error_codes:
+                    pass
+                else:
+                    print('Error: unknown response.')
 
         else:
             print('Invalid command "%s".' % cmd)
-- 
2.7.4

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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-25  5:19 [spp] [PATCH 0/5] Add exit command support for spp_nfv and spp_vm ogawa.yasufumi
2018-10-25  5:19 ` [spp] [PATCH 1/5] spp_nfv: chage to return msg of exit command ogawa.yasufumi
2018-10-25  5:19 ` [spp] [PATCH 2/5] spp-ctl: add exit cmd support for spp_nfv ogawa.yasufumi
2018-10-25  5:19 ` [spp] [PATCH 3/5] spp_vm: chage to return msg of exit command ogawa.yasufumi
2018-10-25  5:19 ` ogawa.yasufumi [this message]
2018-10-25  5:19 ` [spp] [PATCH 5/5] docs: add DELETE method for exiting spp_nfv 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=20181025051943.17129-5-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).