caveats: no config file backward compat
Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
ryu/app/quantum_adapter.py | 24 ++++++++++++------------
ryu/flags.py | 22 +++++++++++++---------
2 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/ryu/app/quantum_adapter.py b/ryu/app/quantum_adapter.py
index 46cdd9d..8a7c0ff 100644
--- a/ryu/app/quantum_adapter.py
+++ b/ryu/app/quantum_adapter.py
@@ -45,12 +45,12 @@ CONF = cfg.CONF
def _get_auth_token(logger):
httpclient = q_client.HTTPClient(
- username=CONF.quantum_admin_username,
- tenant_name=CONF.quantum_admin_tenant_name,
- password=CONF.quantum_admin_password,
- auth_url=CONF.quantum_admin_auth_url,
- timeout=CONF.quantum_url_timeout,
- auth_strategy=CONF.quantum_auth_strategy)
+ username=CONF.quantum.admin_username,
+ tenant_name=CONF.quantum.admin_tenant_name,
+ password=CONF.quantum.admin_password,
+ auth_url=CONF.quantum.admin_auth_url,
+ timeout=CONF.quantum.url_timeout,
+ auth_strategy=CONF.quantum.auth_strategy)
try:
httpclient.authenticate()
except (q_exc.Unauthorized, q_exc.Forbidden, q_exc.EndpointNotFound) as e:
@@ -63,12 +63,12 @@ def _get_auth_token(logger):
def _get_quantum_client(token):
if token:
my_client = q_clientv2.Client(
- endpoint_url=CONF.quantum_url,
- token=token, timeout=CONF.quantum_url_timeout)
+ endpoint_url=CONF.quantum.url,
+ token=token, timeout=CONF.quantum.url_timeout)
else:
my_client = q_clientv2.Client(
- endpoint_url=CONF.quantum_url,
- auth_strategy=None, timeout=CONF.quantum_url_timeout)
+ endpoint_url=CONF.quantum.url,
+ auth_strategy=None, timeout=CONF.quantum.url_timeout)
return my_client
@@ -128,7 +128,7 @@ class OVSSwitch(object):
def __init__(self, dpid, nw, ifaces, logger):
# TODO: clean up
token = None
- if CONF.quantum_auth_strategy:
+ if CONF.quantum.auth_strategy:
token = _get_auth_token(logger)
q_api = _get_quantum_client(token)
@@ -137,7 +137,7 @@ class OVSSwitch(object):
self.ifaces = ifaces
self.logger = logger
self.q_api = q_api
- self.ctrl_addr = CONF.quantum_controller_addr
+ self.ctrl_addr = CONF.quantum.controller_addr
self.ovsdb_addr = None
self.tunnel_ip = None
diff --git a/ryu/flags.py b/ryu/flags.py
index 533f7de..0fddbf4 100644
--- a/ryu/flags.py
+++ b/ryu/flags.py
@@ -21,24 +21,28 @@ from oslo.config import cfg
CONF = cfg.CONF
+quantum_group = cfg.OptGroup(name='quantum',
+ title='Openstack Quantum related options')
+CONF.register_group(quantum_group)
CONF.register_cli_opts([
# app/quantum_adapter
- cfg.StrOpt('quantum-url', default='http://localhost:9696',
+ cfg.StrOpt('url', default='http://localhost:9696',
help='URL for connecting to quantum'),
- cfg.IntOpt('quantum-url-timeout', default=30,
+ cfg.IntOpt('url-timeout', default=30,
help='timeout value for connecting to quantum in seconds'),
- cfg.StrOpt('quantum-admin-username', default='quantum',
+ cfg.StrOpt('admin-username', default='quantum',
help='username for connecting to quantum in admin context'),
- cfg.StrOpt('quantum-admin-password', default='service_password',
+ cfg.StrOpt('admin-password', default='service_password',
help='password for connecting to quantum in admin context'),
- cfg.StrOpt('quantum-admin-tenant-name', default='service',
+ cfg.StrOpt('admin-tenant-name', default='service',
help='tenant name for connecting to quantum in admin context'),
- cfg.StrOpt('quantum-admin-auth-url', default='http://localhost:5000/v2.0',
+ cfg.StrOpt('admin-auth-url', default='http://localhost:5000/v2.0',
help='auth url for connecting to quantum in admin context'),
- cfg.StrOpt('quantum-auth-strategy', default='keystone',
+ cfg.StrOpt('auth-strategy', default='keystone',
help='auth strategy for connecting to quantum in admin'
'context'),
- cfg.StrOpt('quantum-controller-addr', default=None,
+ cfg.StrOpt('controller-addr', default=None,
help='openflow method:address:port to set controller of'
'ovs bridge')
-])
+], group=quantum_group)
+
--
1.8.0.1
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel