[spp] [PATCH 2/2] controller: fix compl for sec enabled immediately

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Thu Feb 21 04:27:39 CET 2019


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

SPP CLI does not complete for sec IDs until secondary list is updated.
This list is updated while running some of commands, such as `status`.
However, this behaviour might confuse user because user cannot find
secondary after launched and doubt it is failed to.

This update is to do completion everytime pressing TAB to update the
list immediately.

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

diff --git a/src/controller/shell.py b/src/controller/shell.py
index 2568523..e3f1ff8 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -362,7 +362,10 @@ class Shell(cmd.Cmd, object):
             print('Invalid command: %s' % tmparg)
 
     def complete_nfv(self, text, line, begidx, endidx):
-        """Completion for nfv command"""
+        """Completion for nfv command."""
+
+        if self.use_cache is False:
+            self.init_spp_procs()
 
         line = self.clean_cmd(line)
 
@@ -463,7 +466,10 @@ class Shell(cmd.Cmd, object):
             print('Invalid command: %s' % tmparg)
 
     def complete_vf(self, text, line, begidx, endidx):
-        """Completion for vf command"""
+        """Completion for vf command."""
+
+        if self.use_cache is False:
+            self.init_spp_procs()
 
         line = self.clean_cmd(line)
 
@@ -542,7 +548,10 @@ class Shell(cmd.Cmd, object):
             print('Invalid command: %s' % tmparg)
 
     def complete_mirror(self, text, line, begidx, endidx):
-        """Completion for mirror command"""
+        """Completion for mirror command."""
+
+        if self.use_cache is False:
+            self.init_spp_procs()
 
         line = self.clean_cmd(line)
 
@@ -610,7 +619,10 @@ class Shell(cmd.Cmd, object):
             print('Invalid command: {}'.format(tmparg))
 
     def complete_pcap(self, text, line, begidx, endidx):
-        """Completion for pcap command"""
+        """Completion for pcap command."""
+
+        if self.use_cache is False:
+            self.init_spp_procs()
 
         line = self.clean_cmd(line)
 
-- 
2.17.1



More information about the spp mailing list