-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
code changes to use single nfp.ini file #582
base: mitaka_21st_march_base
Are you sure you want to change the base?
Changes from 5 commits
d820fb9
363dfda
c5cf652
ae4d4a2
69d57f1
01627a7
df36220
a8e1439
f7a7ea5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
[ORCHESTRATOR] | ||
# Number of worker process to be spawned. | ||
workers=1 | ||
# Path to NFP modules in . format | ||
# NFP core framework will load all .py files | ||
# from this path as nfp modules | ||
nfp_modules_path=gbpservice.nfp.orchestrator.modules | ||
# To invoke OTC Apis | ||
# It could be rpc/REST. | ||
# rpc - where fip access unavaiable for OTC NFP controller | ||
# REST - where fip access is available for OTC NFP controller | ||
backend=rpc | ||
|
||
[PROXY_AGENT] | ||
# Number of worker process to be spawned. | ||
workers=1 | ||
# Path to NFP modules in . format | ||
# NFP core framework will load all .py files | ||
# from this path as nfp modules | ||
nfp_modules_path=gbpservice.nfp.proxy_agent.modules | ||
# To invoke OTC Apis | ||
# Proxy agent will always use unix_rest backend to | ||
# communicate with proxy component inside namespace | ||
backend=unix_rest | ||
|
||
[PROXY] | ||
# Path unix server should bind to | ||
unix_bind_path= /var/run/uds_socket | ||
# Max number of client connections | ||
max_connections=10 | ||
# Num of worker threads to handle connections | ||
worker_threads=100 | ||
# Timeout for 'connect' operation | ||
connect_max_wait_timeout=120 | ||
# Max time an idle channel is allowed to be open | ||
idle_max_wait_timeout=120 | ||
# Min time to wait on channel to declare its idle. | ||
idle_min_wait_timeout=0.1 | ||
#NFP controllers ip address and port | ||
nfp_controller_ip=172.16.0.3 | ||
nfp_controller_port=8070 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you test devstack/lib/nfp change the sed line above has space after = and also has . There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ignore this comment. I am convinced with the sed line. It should work. |
||
|
||
[CONFIG_ORCHESTRATOR] | ||
# Number of worker process to be spawned. | ||
workers=1 | ||
# Path to NFP modules in . format | ||
# NFP core framework will load all .py files | ||
# from this path as nfp modules | ||
nfp_modules_path=gbpservice.contrib.nfp.config_orchestrator.modules | ||
# To invoke OTC Apis | ||
# Proxy agent will always use unix_rest backend to | ||
# communicate with proxy component inside namespace | ||
backend=rpc | ||
|
||
# Section describing params for backend=rpc | ||
[RPC] | ||
# Topic to send OTC request rpc on. | ||
topic=nfp-proxy-agent-topic |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,14 +17,14 @@ | |
import ConfigParser | ||
from gbpservice.nfp.core import log as nfp_logging | ||
import os | ||
from oslo_config import cfg | ||
from oslo_config import cfg as oslo_config | ||
from oslo_log import log as oslo_logging | ||
import socket | ||
import sys | ||
import time | ||
|
||
|
||
oslo_logging.register_options(cfg.CONF) | ||
oslo_logging.register_options(oslo_config.CONF) | ||
|
||
LOG = nfp_logging.getLogger(__name__) | ||
|
||
|
@@ -50,24 +50,15 @@ class ConnectionIdleTimeOut(Exception): | |
|
||
class Configuration(object): | ||
|
||
def __init__(self, filee): | ||
config = ConfigParser.ConfigParser() | ||
config.read(filee) | ||
|
||
self.thread_pool_size = config.getint('OPTIONS', 'thread_pool_size') | ||
self.unix_bind_path = config.get('OPTIONS', 'unix_bind_path') | ||
self.max_connections = config.getint('OPTIONS', 'max_connections') | ||
self.worker_threads = config.getint('OPTIONS', 'worker_threads') | ||
self.connect_max_wait_timeout = config.getfloat( | ||
'OPTIONS', 'connect_max_wait_timeout') | ||
self.idle_max_wait_timeout = config.getfloat( | ||
'OPTIONS', 'idle_max_wait_timeout') | ||
self.idle_min_wait_timeout = config.getfloat( | ||
'OPTIONS', 'idle_min_wait_timeout') | ||
self.rest_server_address = config.get( | ||
'NFP_CONTROLLER', 'rest_server_address') | ||
self.rest_server_port = config.getint( | ||
'NFP_CONTROLLER', 'rest_server_port') | ||
def __init__(self, conf): | ||
self.unix_bind_path = conf.proxy.unix_bind_path | ||
self.max_connections = conf.proxy.max_connections | ||
self.worker_threads = conf.proxy.worker_threads | ||
self.connect_max_wait_timeout = conf.proxy.connect_max_wait_timeout | ||
self.idle_max_wait_timeout = conf.proxy.idle_max_wait_timeout | ||
self.idle_min_wait_timeout = conf.proxy.idle_min_wait_timeout | ||
self.rest_server_address = conf.proxy.nfp_controller_ip | ||
self.rest_server_port = conf.proxy.nfp_controller_port | ||
|
||
|
||
""" | ||
|
@@ -319,15 +310,53 @@ def new_client(self, unixsocket, address): | |
pc = ProxyConnection(self.conf, unixsocket, tcpsocket) | ||
ConnQ.put(pc) | ||
|
||
PROXY_OPTS = [ | ||
oslo_config.IntOpt( | ||
'max_connections', | ||
default=10, | ||
help='Max num of client connections' | ||
), | ||
oslo_config.IntOpt( | ||
'worker_threads', | ||
default=10, | ||
help='Number of threads to be used.' | ||
), | ||
oslo_config.FloatOpt( | ||
'connect_max_wait_timeout', | ||
default=10, | ||
help='Max time to wait for connect.' | ||
), | ||
oslo_config.FloatOpt( | ||
'idle_max_wait_timeout', | ||
default=10, | ||
help='Max time to keep idle channel open.' | ||
), | ||
oslo_config.FloatOpt( | ||
'idle_min_wait_timeout', | ||
default=10, | ||
help='Minimum time to wait on idle channel.' | ||
), | ||
oslo_config.StrOpt( | ||
'unix_bind_path', | ||
default='/var/run/uds_socket', | ||
help='Path for unix server to bind.' | ||
), | ||
oslo_config.StrOpt( | ||
'nfp_controller_ip', | ||
default='172.16.0.3', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May be keep the dafault value as 120.0.0.1 or remove the default value. |
||
help='NFP controllers ip address' | ||
), | ||
oslo_config.IntOpt( | ||
'nfp_controller_port', | ||
default='8070', | ||
help='NFP controllers port num' | ||
) | ||
] | ||
|
||
|
||
def main(argv): | ||
cfg.CONF(args=sys.argv[1:]) | ||
oslo_logging.setup(cfg.CONF, 'nfp') | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument( | ||
'-config-file', "--config-file", action="store", dest='config_file') | ||
parser.add_argument( | ||
'-log-file', "--log-file", action="store", dest='log_file') | ||
args = parser.parse_args(sys.argv[1:]) | ||
conf = Configuration(args.config_file) | ||
oslo_config.CONF.register_opts(PROXY_OPTS, 'proxy') | ||
oslo_config.CONF(args=sys.argv[1:]) | ||
oslo_logging.setup(oslo_config.CONF, 'nfp') | ||
conf = Configuration(oslo_config.CONF) | ||
Proxy(conf).start() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't hardcode. Leave it empty.