[spp] [PATCH 2/5] controller: add paring lcore IDs for vf and mirror
ogawa.yasufumi at lab.ntt.co.jp
ogawa.yasufumi at lab.ntt.co.jp
Wed May 8 03:59:41 CEST 2019
From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
To show lcore IDs of spp_vf and spp_mirror, add parsing lcore IDs in the
response from these processes.
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
src/controller/commands/mirror.py | 14 ++++++++++++++
src/controller/commands/vf.py | 15 +++++++++++++--
2 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/controller/commands/mirror.py b/src/controller/commands/mirror.py
index b5b7a1b..d38812d 100644
--- a/src/controller/commands/mirror.py
+++ b/src/controller/commands/mirror.py
@@ -85,6 +85,9 @@ class SppMirror(object):
Basic Information:
- client-id: 3
- ports: [phy:0, phy:1]
+ - lcore_ids:
+ - master: 1
+ - slaves: [2, 3]
Components:
- core:1, "mr1" (type: mirror)
- rx: ring:0
@@ -96,10 +99,21 @@ class SppMirror(object):
"""
+ # Extract slave lcore IDs first
+ slave_lcore_ids = []
+ for worker in json_obj['components']:
+ slave_lcore_ids.append(str(worker['core']))
+
# Basic Information
print('Basic Information:')
print(' - client-id: %d' % json_obj['client-id'])
print(' - ports: [%s]' % ', '.join(json_obj['ports']))
+ print(' - lcore_ids:')
+ print(' - master: {}'.format(json_obj['master-lcore']))
+ if len(slave_lcore_ids) > 1:
+ print(' - slaves: [{}]'.format(', '.join(slave_lcore_ids)))
+ else:
+ print(' - slave: {}'.format(slave_lcore_ids[0]))
# Componennts
print('Components:')
diff --git a/src/controller/commands/vf.py b/src/controller/commands/vf.py
index ff08231..b673f0f 100644
--- a/src/controller/commands/vf.py
+++ b/src/controller/commands/vf.py
@@ -89,6 +89,9 @@ class SppVf(object):
Basic Information:
- client-id: 3
- ports: [phy:0, phy:1]
+ - lcore_ids:
+ - master: 1
+ - slaves: [2, 3]
Classifier Table:
- "FA:16:3E:7D:CC:35", ring:0
- "FA:17:3E:7D:CC:55", ring:1
@@ -103,10 +106,18 @@ class SppVf(object):
"""
+ # Extract slave lcore IDs first
+ slave_lcore_ids = []
+ for worker in json_obj['components']:
+ slave_lcore_ids.append(str(worker['core']))
+
# Basic Information
print('Basic Information:')
- print(' - client-id: %d' % json_obj['client-id'])
- print(' - ports: [%s]' % ', '.join(json_obj['ports']))
+ print(' - client-id: {}'.format(json_obj['client-id']))
+ print(' - ports: [{}]'.format(', '.join(json_obj['ports'])))
+ print(' - lcore_ids:')
+ print(' - master: {}'.format(json_obj['master-lcore']))
+ print(' - slaves: [{}]'.format(', '.join(slave_lcore_ids)))
# Classifier Table
print('Classifier Table:')
--
2.17.1
More information about the spp
mailing list