Soft Patch Panel
 help / color / mirror / Atom feed
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
To: Itsuro ODA <oda@valinux.co.jp>
Cc: spp@dpdk.org, ferruh.yigit@intel.com
Subject: Re: [spp] [PATCH 3/4] spp-ctl: update syntax of add and del command
Date: Wed, 10 Oct 2018 13:41:30 +0900	[thread overview]
Message-ID: <379f6621-f974-bb96-c564-b1770c1c4c50@lab.ntt.co.jp> (raw)
In-Reply-To: <20181010065600.2E02.277DD91C@valinux.co.jp>

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 <ogawa.yasufumi@lab.ntt.co.jp>
>>
>> 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 <ogawa.yasufumi@lab.ntt.co.jp>
>> ---
>>   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

  reply	other threads:[~2018-10-10  4:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09 10:50 [spp] [PATCH 0/4] Update response of status of spp_nfv and spp_vm ogawa.yasufumi
2018-10-09 10:50 ` [spp] [PATCH 1/4] shared: update status format of spp_nfv ogawa.yasufumi
2018-10-09 10:50 ` [spp] [PATCH 2/4] controller: update parsing status message ogawa.yasufumi
2018-10-09 10:50 ` [spp] [PATCH 3/4] spp-ctl: update syntax of add and del command ogawa.yasufumi
2018-10-09 21:56   ` Itsuro ODA
2018-10-10  4:41     ` Yasufumi Ogawa [this message]
2018-10-09 10:50 ` [spp] [PATCH 4/4] spp-ctl: update parsing status ogawa.yasufumi
2018-10-11 10:33 ` [spp] [PATCH v2 0/4] Update response of status of spp_nfv and spp_vm ogawa.yasufumi
2018-10-11 10:33   ` [spp] [PATCH v2 1/4] shared: update status format of spp_nfv ogawa.yasufumi
2018-10-11 10:33   ` [spp] [PATCH v2 2/4] controller: update parsing status message ogawa.yasufumi
2018-10-11 10:33   ` [spp] [PATCH v2 3/4] spp-ctl: update syntax of add and del command ogawa.yasufumi
2018-10-11 10:33   ` [spp] [PATCH v2 4/4] spp-ctl: update parsing status 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=379f6621-f974-bb96-c564-b1770c1c4c50@lab.ntt.co.jp \
    --to=ogawa.yasufumi@lab.ntt.co.jp \
    --cc=ferruh.yigit@intel.com \
    --cc=oda@valinux.co.jp \
    --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).