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/4] controller: unify accepting resource UID format
Date: Tue,  9 Oct 2018 19:48:47 +0900	[thread overview]
Message-ID: <20181009104847.42502-5-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20181009104847.42502-1-ogawa.yasufumi@lab.ntt.co.jp>

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

Delimiter of resource UID is different between patch command and add/del
commands.

  spp > sec 1;add ring 0  # separated with ' '
  spp > sec 1;patch ring:0 ring:1  # separated with ':'

It should be same format because confusing. This update is to change
add/del commands to use delimiter ':'.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/controller/shell.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/controller/shell.py b/src/controller/shell.py
index 2808440..09b9e86 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -249,7 +249,7 @@ class Shell(cmd.Cmd, object):
     def is_patched_ids_valid(self, id1, id2, delim=':'):
         """Check if port IDs are valid
 
-        Supported format is port ID of integer or resource ID such as
+        Supported format is port ID of integer or resource UID such as
         'phy:0' or 'ring:1'. Default delimiter ':' can be overwritten
         by giving 'delim' option.
         """
@@ -279,17 +279,21 @@ class Shell(cmd.Cmd, object):
         if length == 1:
             if cmdlist[0] in level1:
                 valid = 1
+
         elif length == 2:
             if cmdlist[0] == 'patch':
                 if cmdlist[1] in patch_args:
                     valid = 1
+
+            elif cmdlist[0] == 'add' or cmdlist[0] == 'del':
+                p_type, p_id = cmdlist[1].split(':')
+                if p_type in add_del_args:
+                    if str.isdigit(p_id):
+                        valid = 1
+
         elif length == 3:
             if cmdlist[0] in level2:
-                if cmdlist[0] == 'add' or cmdlist[0] == 'del':
-                    if cmdlist[1] in add_del_args:
-                        if str.isdigit(cmdlist[2]):
-                            valid = 1
-                elif cmdlist[0] == 'patch':
+                if cmdlist[0] == 'patch':
                     if self.is_patched_ids_valid(cmdlist[1], cmdlist[2]):
                         valid = 1
 
-- 
2.7.4

      parent reply	other threads:[~2018-10-09 10:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09 10:48 [spp] [PATCH 0/4] Port management with resource UID ogawa.yasufumi
2018-10-09 10:48 ` [spp] [PATCH 1/4] shared: add parsing " ogawa.yasufumi
2018-10-09 10:48 ` [spp] [PATCH 2/4] spp_nfv: change to use parse_resource_uid ogawa.yasufumi
2018-10-09 10:48 ` [spp] [PATCH 3/4] spp_vm: " ogawa.yasufumi
2018-10-09 10:48 ` ogawa.yasufumi [this message]

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=20181009104847.42502-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).