[spp] [PATCH 2/2] controller: update paring lcores for master

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Wed May 8 03:59:29 CEST 2019


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

As master lcore ID is the response of status command, update parsing
lcore IDs for this change.

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

diff --git a/src/controller/commands/nfv.py b/src/controller/commands/nfv.py
index 2613bc2..92d2a3f 100644
--- a/src/controller/commands/nfv.py
+++ b/src/controller/commands/nfv.py
@@ -74,8 +74,15 @@ class SppNfv(object):
         """
 
         nfv_attr = json_obj
-        print('- status: %s' % nfv_attr['status'])
-        print('- lcores: %s' % nfv_attr['lcores'])
+        print('- status: {}'.format(nfv_attr['status']))
+        print('- lcore_ids:')
+        print('  - master: {}'.format(nfv_attr['master-lcore']))
+        # remove master and show remained
+        nfv_attr['lcores'].remove(nfv_attr['master-lcore'])
+        if len(nfv_attr['lcores']) > 1:
+            print('  - slaves: {}'.format(nfv_attr['lcores']))
+        else:
+            print('  - slave: {}'.format(nfv_attr['lcores'][0]))
         print('- ports:')
         for port in nfv_attr['ports']:
             dst = None
@@ -84,9 +91,9 @@ class SppNfv(object):
                     dst = patch['dst']
 
             if dst is None:
-                print('  - %s' % port)
+                print('  - {}'.format(port))
             else:
-                print('  - %s -> %s' % (port, dst))
+                print('  - {} -> {}'.format(port, dst))
 
     def get_ports(self):
         """Get all of ports as a list."""
-- 
2.17.1



More information about the spp mailing list