no functional changes are intended.
Signed-off-by: YAMAMOTO Takashi <[email protected]>
---
ryu/app/quantum_adapter.py | 24 +++++++++++-------------
ryu/app/simple_vlan.py | 2 +-
ryu/app/tunnel_port_updater.py | 22 ++++++++++------------
ryu/app/wsgi.py | 2 +-
ryu/cmd/manager.py | 2 +-
ryu/cmd/of_config_cli.py | 2 +-
ryu/cmd/ofa_neutron_agent.py | 2 +-
ryu/cmd/rpc_cli.py | 2 +-
ryu/controller/controller.py | 2 +-
ryu/flags.py | 2 +-
ryu/lib/ovs/bridge.py | 5 +++--
ryu/log.py | 2 +-
ryu/services/protocols/vrrp/rpc_manager.py | 13 ++++++-------
ryu/tests/switch/tester.py | 2 +-
ryu/topology/switches.py | 8 ++++----
15 files changed, 44 insertions(+), 48 deletions(-)
diff --git a/ryu/app/quantum_adapter.py b/ryu/app/quantum_adapter.py
index f6b267d..bd1914f 100644
--- a/ryu/app/quantum_adapter.py
+++ b/ryu/app/quantum_adapter.py
@@ -15,7 +15,6 @@
# limitations under the License.
import traceback
-from oslo.config import cfg
try:
from neutronclient import client as q_client
@@ -45,10 +44,7 @@ from ryu.lib.ovs import bridge
from ryu.lib.quantum_ifaces import QuantumIfaces
-CONF = cfg.CONF
-
-
-def _get_auth_token(logger):
+def _get_auth_token(CONF, logger):
httpclient = q_client.HTTPClient(
username=CONF.neutron_admin_username,
tenant_name=CONF.neutron_admin_tenant_name,
@@ -65,7 +61,7 @@ def _get_auth_token(logger):
return httpclient.auth_token
-def _get_quantum_client(token):
+def _get_quantum_client(CONF, token):
if token:
my_client = q_clientv2.Client(
endpoint_url=CONF.neutron_url,
@@ -130,14 +126,15 @@ class OVSPort(object):
class OVSSwitch(object):
- def __init__(self, dpid, nw, ifaces, logger):
+ def __init__(self, CONF, dpid, nw, ifaces, logger):
# TODO: clean up
+ self.CONF = CONF
self.dpid = dpid
self.network_api = nw
self.ifaces = ifaces
self.logger = logger
self._q_api = None # lazy initialization
- self.ctrl_addr = CONF.neutron_controller_addr
+ self.ctrl_addr = self.CONF.neutron_controller_addr
if not self.ctrl_addr:
raise ValueError('option neutron_controler_addr must be speicfied')
@@ -153,9 +150,9 @@ class OVSSwitch(object):
def q_api(self):
if self._q_api is None:
token = None
- if CONF.neutron_auth_strategy:
- token = _get_auth_token(self.logger)
- self._q_api = _get_quantum_client(token)
+ if self.CONF.neutron_auth_strategy:
+ token = _get_auth_token(self.CONF, self.logger)
+ self._q_api = _get_quantum_client(self.CONF, token)
return self._q_api
def set_ovsdb_addr(self, dpid, ovsdb_addr):
@@ -176,7 +173,7 @@ class OVSSwitch(object):
self.ovsdb_addr = ovsdb_addr
if self.ovs_bridge is None:
self.logger.debug('ovsdb: adding ports %s', self.ports)
- ovs_bridge = bridge.OVSBridge(dpid, ovsdb_addr)
+ ovs_bridge = bridge.OVSBridge(self.CONF, dpid, ovsdb_addr)
self.ovs_bridge = ovs_bridge
ovs_bridge.init()
# TODO: for multi-controller
@@ -352,7 +349,8 @@ class QuantumAdapter(app_manager.RyuApp):
ovs_switch = self.dps.get(dpid)
if not ovs_switch:
if create:
- ovs_switch = OVSSwitch(dpid, self.nw, self.ifaces, self.logger)
+ ovs_switch = OVSSwitch(self.CONF, dpid, self.nw, self.ifaces,
+ self.logger)
self.dps[dpid] = ovs_switch
else:
self.logger.debug('ovs switch %s is already known', dpid)
diff --git a/ryu/app/simple_vlan.py b/ryu/app/simple_vlan.py
index a64d4eb..f18151a 100644
--- a/ryu/app/simple_vlan.py
+++ b/ryu/app/simple_vlan.py
@@ -124,7 +124,7 @@ class SimpleVLAN(app_manager.RyuApp):
self.logger.debug('ovs_port_update dpid %s port_no %s', dpid, port_no)
# ovs-vsctl --db=ovsdb_addr --timeout=2
# set Port port.name tag=tunnel_key
- ovs_br = bridge.OVSBridge(dpid, ovsdb_addr, 2)
+ ovs_br = bridge.OVSBridge(self.CONF, dpid, ovsdb_addr, 2)
# ofp_phy_port::name is zero-padded
port_name = port.name.rstrip('\x00')
try:
diff --git a/ryu/app/tunnel_port_updater.py b/ryu/app/tunnel_port_updater.py
index c828348..3c1f5c8 100644
--- a/ryu/app/tunnel_port_updater.py
+++ b/ryu/app/tunnel_port_updater.py
@@ -17,7 +17,7 @@
# This module updates OVS tunnel ports for OpenStack integration.
import collections
-from oslo.config import cfg
+from ryu import cfg
import logging
import netaddr
@@ -34,12 +34,6 @@ from ryu.lib import hub
from ryu.lib.ovs import bridge as ovs_bridge
-CONF = cfg.CONF
-CONF.register_opts([
- cfg.StrOpt('tunnel-type', default='gre',
- help='tunnel type for ovs tunnel port')
-])
-
_TUNNEL_TYPE_TO_NW_ID = {
'gre': rest_nw_id.NW_ID_VPORT_GRE,
}
@@ -104,15 +98,15 @@ class TunnelPort(object):
class TunnelDP(object):
- def __init__(self, dpid, ovsdb_addr, tunnel_ip, tunnel_type, conf_switch_,
- network_api, tunnel_api, logger):
+ def __init__(self, CONF, dpid, ovsdb_addr, tunnel_ip, tunnel_type,
+ conf_switch_, network_api, tunnel_api, logger):
super(TunnelDP, self).__init__()
self.dpid = dpid
self.network_api = network_api
self.tunnel_api = tunnel_api
self.logger = logger
- self.ovs_bridge = ovs_bridge.OVSBridge(dpid, ovsdb_addr)
+ self.ovs_bridge = ovs_bridge.OVSBridge(CONF, dpid, ovsdb_addr)
self.tunnel_ip = tunnel_ip
self.tunnel_type = tunnel_type
@@ -355,7 +349,11 @@ class TunnelPortUpdater(app_manager.RyuApp):
def __init__(self, *args, **kwargs):
super(TunnelPortUpdater, self).__init__(args, kwargs)
- self.tunnel_type = CONF.tunnel_type
+ self.CONF.register_opts([
+ cfg.StrOpt('tunnel-type', default='gre',
+ help='tunnel type for ovs tunnel port')
+ ])
+ self.tunnel_type = self.CONF.tunnel_type
self.cs = kwargs['conf_switch']
self.nw = kwargs['network']
self.tunnels = kwargs['tunnels']
@@ -373,7 +371,7 @@ class TunnelPortUpdater(app_manager.RyuApp):
ovs_tunnel_addr)
if dpid not in self.tunnel_dpset:
# TODO:XXX changing ovsdb_addr, ovs_tunnel_addr
- tunnel_dp = TunnelDP(dpid, ovsdb_addr, ovs_tunnel_addr,
+ tunnel_dp = TunnelDP(self.CONF, dpid, ovsdb_addr, ovs_tunnel_addr,
self.tunnel_type, self.cs,
self.network_api, self.tunnel_api,
self.logger)
diff --git a/ryu/app/wsgi.py b/ryu/app/wsgi.py
index 80698c0..384c32c 100644
--- a/ryu/app/wsgi.py
+++ b/ryu/app/wsgi.py
@@ -16,7 +16,7 @@
import inspect
-from oslo.config import cfg
+from ryu import cfg
import webob.dec
from ryu.lib import hub
diff --git a/ryu/cmd/manager.py b/ryu/cmd/manager.py
index 234b96c..b1180f7 100755
--- a/ryu/cmd/manager.py
+++ b/ryu/cmd/manager.py
@@ -28,7 +28,7 @@ hub.patch()
# eg. oslo.config.cfg.
import ryu.contrib
-from oslo.config import cfg
+from ryu import cfg
import logging
import sys
diff --git a/ryu/cmd/of_config_cli.py b/ryu/cmd/of_config_cli.py
index 6973b80..0f4c2cf 100755
--- a/ryu/cmd/of_config_cli.py
+++ b/ryu/cmd/of_config_cli.py
@@ -25,7 +25,7 @@
import ryu.contrib
-from oslo.config import cfg
+from ryu import cfg
import cmd
import sys
diff --git a/ryu/cmd/ofa_neutron_agent.py b/ryu/cmd/ofa_neutron_agent.py
index 42656b3..80e9353 100755
--- a/ryu/cmd/ofa_neutron_agent.py
+++ b/ryu/cmd/ofa_neutron_agent.py
@@ -29,7 +29,7 @@ hub.patch()
# eg. oslo.config.cfg.
import ryu.contrib
-from oslo.config import cfg
+from ryu import cfg
import sys
from neutron.openstack.common import log as os_logging
diff --git a/ryu/cmd/rpc_cli.py b/ryu/cmd/rpc_cli.py
index 05696b3..a297000 100755
--- a/ryu/cmd/rpc_cli.py
+++ b/ryu/cmd/rpc_cli.py
@@ -31,7 +31,7 @@
import ryu.contrib
-from oslo.config import cfg
+from ryu import cfg
import cmd
import signal
diff --git a/ryu/controller/controller.py b/ryu/controller/controller.py
index 942b12e..93d2b33 100644
--- a/ryu/controller/controller.py
+++ b/ryu/controller/controller.py
@@ -15,7 +15,7 @@
# limitations under the License.
import contextlib
-from oslo.config import cfg
+from ryu import cfg
import logging
from ryu.lib import hub
from ryu.lib.hub import StreamServer
diff --git a/ryu/flags.py b/ryu/flags.py
index 66ac1ab..98cb96c 100644
--- a/ryu/flags.py
+++ b/ryu/flags.py
@@ -17,7 +17,7 @@
global flags
"""
-from oslo.config import cfg
+from ryu import cfg
CONF = cfg.CONF
diff --git a/ryu/lib/ovs/bridge.py b/ryu/lib/ovs/bridge.py
index 4556e04..cc43646 100644
--- a/ryu/lib/ovs/bridge.py
+++ b/ryu/lib/ovs/bridge.py
@@ -19,7 +19,7 @@ slimmed down version of OVSBridge in quantum agent
"""
import functools
-from oslo.config import cfg
+from ryu import cfg
import logging
import ryu.exception as ryu_exc
@@ -88,7 +88,8 @@ class TunnelPort(object):
class OVSBridge(object):
- def __init__(self, datapath_id, ovsdb_addr, timeout=None, exception=None):
+ def __init__(self, CONF, datapath_id, ovsdb_addr, timeout=None,
+ exception=None):
super(OVSBridge, self).__init__()
self.datapath_id = datapath_id
self.vsctl = ovs_vsctl.VSCtl(ovsdb_addr)
diff --git a/ryu/log.py b/ryu/log.py
index b9a3c3a..d4af519 100644
--- a/ryu/log.py
+++ b/ryu/log.py
@@ -15,7 +15,7 @@
# limitations under the License.
from __future__ import print_function
-from oslo.config import cfg
+from ryu import cfg
import inspect
import platform
import logging
diff --git a/ryu/services/protocols/vrrp/rpc_manager.py
b/ryu/services/protocols/vrrp/rpc_manager.py
index 0ba15e1..7b92d2b 100644
--- a/ryu/services/protocols/vrrp/rpc_manager.py
+++ b/ryu/services/protocols/vrrp/rpc_manager.py
@@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-from oslo.config import cfg
+from ryu import cfg
import socket
import netaddr
@@ -26,11 +26,6 @@ from ryu.lib import hub
from ryu.lib import mac
VRRP_RPC_PORT = 50004 # random
-CONF = cfg.CONF
-
-CONF.register_opts([
- cfg.IntOpt('vrrp-rpc-port', default=VRRP_RPC_PORT,
- help='port for vrrp rpc interface')])
class RPCError(Exception):
@@ -49,6 +44,10 @@ class Peer(object):
class RpcVRRPManager(app_manager.RyuApp):
def __init__(self, *args, **kwargs):
super(RpcVRRPManager, self).__init__(*args, **kwargs)
+ self.CONF.register_opts([
+ cfg.IntOpt('vrrp-rpc-port', default=VRRP_RPC_PORT,
+ help='port for vrrp rpc interface')])
+
self._args = args
self._kwargs = kwargs
self._peers = []
@@ -90,7 +89,7 @@ class RpcVRRPManager(app_manager.RyuApp):
hub.spawn(self._peer_loop_thread, peer)
def _peer_accept_thread(self):
- server = hub.StreamServer(('', CONF.vrrp_rpc_port),
+ server = hub.StreamServer(('', self.CONF.vrrp_rpc_port),
self.peer_accept_handler)
server.serve_forever()
diff --git a/ryu/tests/switch/tester.py b/ryu/tests/switch/tester.py
index f1c132f..59101e1 100644
--- a/ryu/tests/switch/tester.py
+++ b/ryu/tests/switch/tester.py
@@ -21,7 +21,7 @@ import signal
import sys
import traceback
-from oslo.config import cfg
+from ryu import cfg
# import all packet libraries.
PKT_LIB_PATH = 'ryu.lib.packet'
diff --git a/ryu/topology/switches.py b/ryu/topology/switches.py
index e53a229..fb3af8e 100644
--- a/ryu/topology/switches.py
+++ b/ryu/topology/switches.py
@@ -17,7 +17,7 @@ import logging
import struct
import time
import json
-from oslo.config import cfg
+from ryu import cfg
from ryu.topology import event
from ryu.base import app_manager
@@ -453,10 +453,10 @@ class Switches(app_manager.RyuApp):
self.links = LinkState() # Link class -> timestamp
self.is_active = True
- self.link_discovery = CONF.observe_links
+ self.link_discovery = self.CONF.observe_links
if self.link_discovery:
- self.install_flow = CONF.install_lldp_flow
- self.explicit_drop = CONF.explicit_drop
+ self.install_flow = self.CONF.install_lldp_flow
+ self.explicit_drop = self.CONF.explicit_drop
self.lldp_event = hub.Event()
self.link_event = hub.Event()
self.threads.append(hub.spawn(self.lldp_loop))
--
1.8.3.1
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel