summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasufumi Ogawa <yasufum.o@gmail.com>2019-08-22 17:28:05 +0900
committerYasufumi Ogawa <yasufum.o@gmail.com>2019-08-26 10:44:21 +0700
commitb7a4c92560a9b3fdcc1a84eedc1cad8da9cd7304 (patch)
tree79ceb9b47ba5d31c0ab4a14ffd014298b23b92b1
parentea0437add1a2883e3ee80cdf68321e243bef0d4e (diff)
downloadspp-b7a4c92560a9b3fdcc1a84eedc1cad8da9cd7304.zip
spp-b7a4c92560a9b3fdcc1a84eedc1cad8da9cd7304.tar.gz
spp-b7a4c92560a9b3fdcc1a84eedc1cad8da9cd7304.tar.xz
tools/sppc: change env var SPP_CTRL_IP
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>
-rwxr-xr-xtools/sppc/app/spp-nfv.py19
-rwxr-xr-xtools/sppc/app/spp-primary.py27
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] == '\\':