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 55D791B455 for ; Wed, 10 Oct 2018 06:43:36 +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 w9A4hZq1026047; Wed, 10 Oct 2018 13:43:35 +0900 Received: from vc1.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id EC49FEA7621; Wed, 10 Oct 2018 13:43:34 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc1.ecl.ntt.co.jp (Postfix) with ESMTP id D7843EA7514; Wed, 10 Oct 2018 13:43:34 +0900 (JST) Received: from [IPv6:::1] (watercress.nslab.ecl.ntt.co.jp [129.60.13.73]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id CAB644006B0; Wed, 10 Oct 2018 13:43:34 +0900 (JST) References: <20181009105047.42568-1-ogawa.yasufumi@lab.ntt.co.jp> <20181009105047.42568-4-ogawa.yasufumi@lab.ntt.co.jp> <20181010065600.2E02.277DD91C@valinux.co.jp> From: Yasufumi Ogawa Message-ID: <379f6621-f974-bb96-c564-b1770c1c4c50@lab.ntt.co.jp> Date: Wed, 10 Oct 2018 13:41:30 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20181010065600.2E02.277DD91C@valinux.co.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: Itsuro ODA Cc: spp@dpdk.org, ferruh.yigit@intel.com X-TM-AS-MML: disable Subject: Re: [spp] [PATCH 3/4] spp-ctl: update syntax of add and del command 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: Wed, 10 Oct 2018 04:43:37 -0000 On 2018/10/10 6:56, Itsuro ODA wrote: > Hi Yasufumi, > > I think it seems a bit strange to split port to if_type > and if_num before calling port_add/port_del. How about the > following fix ? I understand your point. Although the reason of dividing 'if_type' and 'if_num' was to remove the delimiter explicitly before sending the request to spp_nfv, but all of processes are already updated to expect the same delimiter and no need to remove. Your proposal is more simple and better for considering code maintenance. Thanks > > --- > diff --git a/src/spp-ctl/spp_proc.py b/src/spp-ctl/spp_proc.py > index aa83b76..3b01e3f 100644 > --- a/src/spp-ctl/spp_proc.py > +++ b/src/spp-ctl/spp_proc.py > @@ -145,12 +145,12 @@ class NfvProc(SppProc): > return "status" > > @exec_command > - def port_add(self, if_type, if_num): > - return "add {if_type} {if_num}".format(**locals()) > + def port_add(self, port): > + return "add {port}".format(**locals()) > > @exec_command > - def port_del(self, if_type, if_num): > - return "del {if_type} {if_num}".format(**locals()) > + def port_del(self, port): > + return "del {port}".format(**locals()) > > @exec_command > def patch_add(self, src_port, dst_port): > diff --git a/src/spp-ctl/spp_webapi.py b/src/spp-ctl/spp_webapi.py > index ddf6513..6bfc436 100644 > --- a/src/spp-ctl/spp_webapi.py > +++ b/src/spp-ctl/spp_webapi.py > @@ -376,11 +376,10 @@ class V1NFVHandler(BaseHandler): > def nfv_port(self, proc, body): > self._validate_nfv_port(body) > > - if_type, if_num = body['port'].split(":") > if body['action'] == "add": > - proc.port_add(if_type, if_num) > + proc.port_add(body['port']) > else: > - proc.port_del(if_type, if_num) > + proc.port_del(body['port']) > > def _validate_nfv_patch(self, body): > for key in ['src', 'dst']: > --- > > On Tue, 9 Oct 2018 19:50:46 +0900 > ogawa.yasufumi@lab.ntt.co.jp wrote: > >> From: Yasufumi Ogawa >> >> Because add and del command are updated to use resource UID, spp-ctl is >> also updated to use resource UID. >> >> Signed-off-by: Yasufumi Ogawa >> --- >> src/spp-ctl/spp_proc.py | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/src/spp-ctl/spp_proc.py b/src/spp-ctl/spp_proc.py >> index aa83b76..726de3e 100644 >> --- a/src/spp-ctl/spp_proc.py >> +++ b/src/spp-ctl/spp_proc.py >> @@ -146,11 +146,11 @@ class NfvProc(SppProc): >> >> @exec_command >> def port_add(self, if_type, if_num): >> - return "add {if_type} {if_num}".format(**locals()) >> + return "add {if_type}:{if_num}".format(**locals()) >> >> @exec_command >> def port_del(self, if_type, if_num): >> - return "del {if_type} {if_num}".format(**locals()) >> + return "del {if_type}:{if_num}".format(**locals()) >> >> @exec_command >> def patch_add(self, src_port, dst_port): >> -- >> 2.7.4 > > Thanks. > -- Yasufumi Ogawa NTT Network Service Systems Labs