From: ogawa.yasufumi@lab.ntt.co.jp
To: spp@dpdk.org, ferruh.yigit@intel.com, ogawa.yasufumi@lab.ntt.co.jp
Subject: [spp] [PATCH 4/9] controller: add IP address and port binding
Date: Thu, 18 Oct 2018 20:25:13 +0900 [thread overview]
Message-ID: <20181018112518.77556-5-ogawa.yasufumi@lab.ntt.co.jp> (raw)
In-Reply-To: <20181018112518.77556-1-ogawa.yasufumi@lab.ntt.co.jp>
From: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
Add IP address and port support for connecting spp-ctl. IP address
option is '-b' or '--bind-addr', and port is '-a' or '--api-port'.
$ python src/spp.py -b 192.168.1.10 -a 7777
Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi@lab.ntt.co.jp>
---
src/controller/shell.py | 5 ++---
src/controller/spp.py | 7 ++++++-
src/controller/spp_ctl_client.py | 4 +---
3 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/controller/shell.py b/src/controller/shell.py
index 1363fc5..f1c9ccd 100644
--- a/src/controller/shell.py
+++ b/src/controller/shell.py
@@ -10,7 +10,6 @@ import re
import readline
from .shell_lib import common
from . import spp_common
-from . import spp_ctl_client
from .spp_common import logger
import subprocess
from . import topo
@@ -47,9 +46,9 @@ class Shell(cmd.Cmd, object):
else:
readline.write_history_file(hist_file)
- def __init__(self):
+ def __init__(self, spp_ctl_cli):
cmd.Cmd.__init__(self)
- self.spp_ctl_cli = spp_ctl_client.SppCtlClient()
+ self.spp_ctl_cli = spp_ctl_cli
def default(self, line):
"""Define defualt behaviour.
diff --git a/src/controller/spp.py b/src/controller/spp.py
index 373bb93..6b0d99c 100644
--- a/src/controller/spp.py
+++ b/src/controller/spp.py
@@ -6,15 +6,20 @@ from __future__ import absolute_import
import argparse
from .shell import Shell
+from . import spp_ctl_client
import sys
def main(argv):
parser = argparse.ArgumentParser(description="SPP Controller")
+ parser.add_argument('-b', '--bind-addr', type=str, default='127.0.0.1',
+ help='bind address, default=127.0.0.1')
+ parser.add_argument('-a', '--api-port', type=int, default=7777,
+ help='bind address, default=7777')
args = parser.parse_args()
- shell = Shell()
+ shell = Shell(spp_ctl_client.SppCtlClient(args.bind_addr, args.api_port))
shell.cmdloop()
shell = None
diff --git a/src/controller/spp_ctl_client.py b/src/controller/spp_ctl_client.py
index 6de1ae4..a1d6d93 100644
--- a/src/controller/spp_ctl_client.py
+++ b/src/controller/spp_ctl_client.py
@@ -7,10 +7,8 @@ import requests
class SppCtlClient(object):
- def __init__(self):
+ def __init__(self, ip_addr='localhost', port=7777):
api_ver = 'v1'
- ip_addr = '127.0.0.1'
- port = 7777
self.base_url = 'http://%s:%d/%s' % (ip_addr, port, api_ver)
def request_handler(func):
--
2.13.1
next prev parent reply other threads:[~2018-10-18 11:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 11:25 [spp] [PATCH 0/9] Change SPP controller to use spp-ctl ogawa.yasufumi
2018-10-18 11:25 ` [spp] [PATCH 1/9] controller: add spp-ctl client for SPP controller ogawa.yasufumi
2018-10-18 11:25 ` [spp] [PATCH 2/9] controller: change controller to use spp-ctl ogawa.yasufumi
2018-10-18 11:25 ` [spp] [PATCH 3/9] spp-ctl: add IP address binding ogawa.yasufumi
2018-10-18 11:25 ` ogawa.yasufumi [this message]
2018-10-18 11:25 ` [spp] [PATCH 5/9] controller: move pri command to SppPrimary ogawa.yasufumi
2018-10-18 11:25 ` [spp] [PATCH 6/9] controller: move sec command to SppSecondary ogawa.yasufumi
2018-10-18 11:25 ` [spp] [PATCH 7/9] controller: move topo command to SppTopo ogawa.yasufumi
2018-10-18 11:25 ` [spp] [PATCH 8/9] controller: move topo_resize " ogawa.yasufumi
2018-10-18 11:25 ` [spp] [PATCH 9/9] controller: move bye command to SppBye ogawa.yasufumi
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=20181018112518.77556-5-ogawa.yasufumi@lab.ntt.co.jp \
--to=ogawa.yasufumi@lab.ntt.co.jp \
--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).