Soft Patch Panel
 help / color / mirror / Atom feed
From: yasufum.o@gmail.com
To: spp@dpdk.org, ferruh.yigit@intel.com, yasufum.o@gmail.com
Subject: [spp] [PATCH 1/2] tools/sppc: change env var SPP_CTRL_IP
Date: Thu, 22 Aug 2019 17:28:05 +0900	[thread overview]
Message-ID: <20190822082806.20327-2-yasufum.o@gmail.com> (raw)
In-Reply-To: <20190822082806.20327-1-yasufum.o@gmail.com>

From: Yasufumi Ogawa <yasufum.o@gmail.com>

The name of `SPP_CTRL_IP` of spp-ctl is ambiguous and it is better to
renmae `SPP_CTL_IP`.

Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com>
---
 tools/sppc/app/spp-nfv.py     | 19 ++++++++++---------
 tools/sppc/app/spp-primary.py | 27 ++++++++++++++-------------
 2 files changed, 24 insertions(+), 22 deletions(-)

diff --git a/tools/sppc/app/spp-nfv.py b/tools/sppc/app/spp-nfv.py
index 6506fed..96e25e7 100755
--- a/tools/sppc/app/spp-nfv.py
+++ b/tools/sppc/app/spp-nfv.py
@@ -28,14 +28,14 @@ def parse_args():
         type=int,
         help='Secondary ID')
     parser.add_argument(
-        '-ip', '--ctrl-ip',
+        '-ip', '--ctl-ip',
         type=str,
-        help="IP address of SPP controller")
+        help="IP address of spp-ctl")
     parser.add_argument(
-        '--ctrl-port',
+        '--ctl-port',
         type=int,
         default=6666,
-        help="Port of SPP controller")
+        help="Port for secondary of spp-ctl")
 
     parser = app_helper.add_sppc_args(parser)
 
@@ -99,12 +99,13 @@ def main():
     else:
         spp_opts += ['-n', str(args.sec_id), '\\']
 
-    # IP address of SPP controller.
-    ctrl_ip = os.getenv('SPP_CTRL_IP', args.ctrl_ip)
-    if ctrl_ip is None:
-        common.error_exit('SPP_CTRL_IP')
+    # IP address of spp-ctl.
+    ctl_ip = os.getenv('SPP_CTL_IP', args.ctl_ip)
+    if ctl_ip is None:
+        print('Env variable "SPP_CTL_IP" is not defined!')
+        exit()
     else:
-        spp_opts += ['-s', '%s:%d' % (ctrl_ip, args.ctrl_port), '\\']
+        spp_opts += ['-s', '{}:{}'.format(ctl_ip, args.ctl_port), '\\']
 
     cmds = docker_cmd + docker_opts + spp_cmd + eal_opts + spp_opts
     if cmds[-1] == '\\':
diff --git a/tools/sppc/app/spp-primary.py b/tools/sppc/app/spp-primary.py
index 6a004f6..6a71490 100755
--- a/tools/sppc/app/spp-primary.py
+++ b/tools/sppc/app/spp-primary.py
@@ -41,14 +41,14 @@ def parse_args():
         type=str,
         help='TAP device IDs')
     parser.add_argument(
-        '-ip', '--ctrl-ip',
+        '-ip', '--ctl-ip',
         type=str,
-        help="IP address of SPP controller")
+        help="IP address of spp-ctl")
     parser.add_argument(
-        '--ctrl-port',
+        '--ctl-port',
         type=int,
         default=5555,
-        help="Port of SPP controller")
+        help="Port for primary of spp-ctl")
 
     parser = app_helper.add_sppc_args(parser)
 
@@ -88,8 +88,8 @@ def main():
         socks = []
         for dev_id in dev_vhost_ids:
             socks.append({
-                'host': '/tmp/sock%d' % dev_id,
-                'guest': '/tmp/sock%d' % dev_id})
+                'host': '/tmp/sock{}'.format(dev_id),
+                'guest': '/tmp/sock{}'.format(dev_id)})
     else:
         dev_vhost_ids = []
 
@@ -122,13 +122,13 @@ def main():
     # Add TAP vdevs
     for i in range(len(dev_tap_ids)):
         eal_opts += [
-            '--vdev', 'net_tap%d,iface=foo%d' % (
+            '--vdev', 'net_tap{},iface=foo{}'.format(
                 dev_tap_ids[i], dev_tap_ids[i]), '\\']
 
     # Add vhost vdevs
     for i in range(len(dev_vhost_ids)):
         eal_opts += [
-            '--vdev', 'eth_vhost%d,iface=%s' % (
+            '--vdev', 'eth_vhost{},iface={}'.format(
                 dev_vhost_ids[i], socks[i]['guest']), '\\']
 
     eal_opts += ['--', '\\']
@@ -142,12 +142,13 @@ def main():
 
     spp_opts += ['-n', str(args.nof_ring), '\\']
 
-    # IP address of SPP controller.
-    ctrl_ip = os.getenv('SPP_CTRL_IP', args.ctrl_ip)
-    if ctrl_ip is None:
-        common.error_exit('SPP_CTRL_IP')
+    # IP address of spp-ctl.
+    ctl_ip = os.getenv('SPP_CTL_IP', args.ctl_ip)
+    if ctl_ip is None:
+        print('Env variable "SPP_CTL_IP" is not defined!')
+        exit()
     else:
-        spp_opts += ['-s', '%s:%d' % (ctrl_ip, args.ctrl_port), '\\']
+        spp_opts += ['-s', '{}:{}'.format(ctl_ip, args.ctl_port), '\\']
 
     cmds = docker_cmd + docker_opts + spp_cmd + eal_opts + spp_opts
     if cmds[-1] == '\\':
-- 
2.17.1


  reply	other threads:[~2019-08-22  8:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22  8:28 [spp] [PATCH 0/2] Rename env variable SPP_CTRL_IP yasufum.o
2019-08-22  8:28 ` yasufum.o [this message]
2019-08-22  8:28 ` [spp] [PATCH 2/2] docs: rename SPP_CTRL_IP for sppc yasufum.o

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=20190822082806.20327-2-yasufum.o@gmail.com \
    --to=yasufum.o@gmail.com \
    --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).