Soft Patch Panel
 help / color / mirror / Atom feed
* [spp] [PATCH 0/2] Misc update for SPP controller
@ 2018-03-06 11:16 ogawa.yasufumi
  2018-03-06 11:16 ` [spp] [PATCH 1/2] controller: fix bug ogawa.yasufumi
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ogawa.yasufumi @ 2018-03-06 11:16 UTC (permalink / raw)
  To: ferruh.yigit, spp; +Cc: Yasufumi Ogawa

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

Yasufumi Ogawa (2):
  controller: fix bug
  controller: change formatter for sec to common

 src/controller/shell.py | 16 +++++++++++-----
 src/controller/spp.py   |  2 +-
 2 files changed, 12 insertions(+), 6 deletions(-)

-- 
2.13.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [spp] [PATCH 1/2] controller: fix bug
  2018-03-06 11:16 [spp] [PATCH 0/2] Misc update for SPP controller ogawa.yasufumi
@ 2018-03-06 11:16 ` ogawa.yasufumi
  2018-03-06 11:16 ` [spp] [PATCH 2/2] controller: change formatter for sec to common ogawa.yasufumi
  2018-03-27 23:47 ` [spp] [PATCH 0/2] Misc update for SPP controller Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: ogawa.yasufumi @ 2018-03-06 11:16 UTC (permalink / raw)
  To: ferruh.yigit, spp; +Cc: Yasufumi Ogawa

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

Modify path of python in shebang in controller/spp.py to become the same
as spp.py in root dir.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
 src/controller/spp.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/controller/spp.py b/src/controller/spp.py
index 7672cc9..d5cbf46 100644
--- a/src/controller/spp.py
+++ b/src/controller/spp.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
 """Soft Patch Panel"""
 
 from __future__ import print_function
-- 
2.13.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [spp] [PATCH 2/2] controller: change formatter for sec to common
  2018-03-06 11:16 [spp] [PATCH 0/2] Misc update for SPP controller ogawa.yasufumi
  2018-03-06 11:16 ` [spp] [PATCH 1/2] controller: fix bug ogawa.yasufumi
@ 2018-03-06 11:16 ` ogawa.yasufumi
  2018-03-27 23:47 ` [spp] [PATCH 0/2] Misc update for SPP controller Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: ogawa.yasufumi @ 2018-03-06 11:16 UTC (permalink / raw)
  To: ferruh.yigit, spp; +Cc: Yasufumi Ogawa

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

Change formatter method clean_sec_cmd() to be used from primary and
secondary commonly. Method name is also changed to clean_cmd().

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

diff --git a/src/controller/shell.py b/src/controller/shell.py
index 86598d3..91b78f1 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -163,7 +163,7 @@ class Shell(cmd.Cmd, object):
 
         return valid
 
-    def clean_sec_cmd(self, cmdstr):
+    def clean_cmd(self, cmdstr):
         """remove unwanted spaces to avoid invalid command error"""
 
         tmparg = re.sub(r'\s+', " ", cmdstr)
@@ -226,11 +226,17 @@ class Shell(cmd.Cmd, object):
         spp > pri;clear
         """
 
-        if command and command in self.PRI_CMDS:
+        # Remove unwanted spaces and first char ';'
+        command = self.clean_cmd(command)[1:]
+
+        if logger is not None:
+            logger.info("Receive pri command: '%s'" % command)
+
+        if command and (command in self.PRI_CMDS):
             result, message = self.command_primary(command)
             self.response(result, message)
         else:
-            message = "primary invalid command"
+            message = "Invalid pri command: '%s'" % command
             print(message)
             self.response(self.CMD_ERROR, message)
 
@@ -258,7 +264,7 @@ class Shell(cmd.Cmd, object):
         """
 
         # remove unwanted spaces to avoid invalid command error
-        tmparg = self.clean_sec_cmd(arg)
+        tmparg = self.clean_cmd(arg)
         cmds = tmparg.split(';')
         if len(cmds) < 2:
             message = "error"
@@ -282,7 +288,7 @@ class Shell(cmd.Cmd, object):
         """Completion for secondary process commands"""
 
         try:
-            cleaned_line = self.clean_sec_cmd(line)
+            cleaned_line = self.clean_cmd(line)
             if len(cleaned_line.split()) == 1:
                 completions = [str(i)+";" for i in spp_common.SECONDARY_LIST]
             elif len(cleaned_line.split()) == 2:
-- 
2.13.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [spp] [PATCH 0/2] Misc update for SPP controller
  2018-03-06 11:16 [spp] [PATCH 0/2] Misc update for SPP controller ogawa.yasufumi
  2018-03-06 11:16 ` [spp] [PATCH 1/2] controller: fix bug ogawa.yasufumi
  2018-03-06 11:16 ` [spp] [PATCH 2/2] controller: change formatter for sec to common ogawa.yasufumi
@ 2018-03-27 23:47 ` Ferruh Yigit
  2 siblings, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2018-03-27 23:47 UTC (permalink / raw)
  To: ogawa.yasufumi, spp

On 3/6/2018 11:16 AM, ogawa.yasufumi@lab.ntt.co.jp wrote:
> From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
> 
> Yasufumi Ogawa (2):
>   controller: fix bug
>   controller: change formatter for sec to common

Series applied thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-27 23:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-06 11:16 [spp] [PATCH 0/2] Misc update for SPP controller ogawa.yasufumi
2018-03-06 11:16 ` [spp] [PATCH 1/2] controller: fix bug ogawa.yasufumi
2018-03-06 11:16 ` [spp] [PATCH 2/2] controller: change formatter for sec to common ogawa.yasufumi
2018-03-27 23:47 ` [spp] [PATCH 0/2] Misc update for SPP controller Ferruh Yigit

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