From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from tama50.ecl.ntt.co.jp (tama50.ecl.ntt.co.jp [129.60.39.147]) by dpdk.org (Postfix) with ESMTP id 058AE4CC5 for ; Thu, 25 Oct 2018 07:19:56 +0200 (CEST) Received: from vc1.ecl.ntt.co.jp (vc1.ecl.ntt.co.jp [129.60.86.153]) by tama50.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id w9P5Jt3g022734; Thu, 25 Oct 2018 14:19:55 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 45660EA7CFC; Thu, 25 Oct 2018 14:19:55 +0900 (JST) Received: from localhost.localdomain (unknown [129.60.13.51]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id 2E691EA7CEC; Thu, 25 Oct 2018 14:19:55 +0900 (JST) From: ogawa.yasufumi@lab.ntt.co.jp To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp Date: Thu, 25 Oct 2018 14:19:42 +0900 Message-Id: <20181025051943.17129-5-ogawa.yasufumi@lab.ntt.co.jp> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20181025051943.17129-1-ogawa.yasufumi@lab.ntt.co.jp> References: <20181025051943.17129-1-ogawa.yasufumi@lab.ntt.co.jp> X-TM-AS-MML: disable Subject: [spp] [PATCH 4/5] controller: update sec exit cmd to call REST API 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: , X-List-Received-Date: Thu, 25 Oct 2018 05:19:57 -0000 From: Yasufumi Ogawa To send `exit` command to spp_nfv or spp_vm, change to call REST API of spp-ctl. Signed-off-by: Yasufumi Ogawa --- 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