Merge "Use ryu.cfg.CONF for options from Ryu" into stable/juno

This commit is contained in:
Jenkins 2015-03-12 03:10:32 +00:00 committed by Gerrit Code Review
commit 9ff5bb9671
3 changed files with 20 additions and 9 deletions

View File

@ -1,5 +1,5 @@
# Copyright (C) 2014 VA Linux Systems Japan K.K.
# Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
# Copyright (C) 2014,2015 VA Linux Systems Japan K.K.
# Copyright (C) 2014,2015 YAMAMOTO Takashi <yamamoto at valinux co jp>
# Copyright (C) 2014 Fumihiko Kakuma <kakuma at valinux co jp>
# All Rights Reserved.
#
@ -26,6 +26,7 @@ import netaddr
from oslo.config import cfg
from ryu.app.ofctl import api as ryu_api
from ryu.base import app_manager
import ryu.cfg as ryu_cfg
from ryu.controller import handler
from ryu.controller import ofp_event
from ryu.lib import hub
@ -108,12 +109,12 @@ class Bridge(flows.OFAgentIntegrationBridge, ovs_lib.OVSBridge):
protocols='OpenFlow13',
retry_max=cfg.CONF.AGENT.get_datapath_retry_times):
if not controller_names:
host = cfg.CONF.ofp_listen_host
host = ryu_cfg.CONF.ofp_listen_host
if not host:
# 127.0.0.1 is a default for agent style of controller
host = '127.0.0.1'
controller_names = ["tcp:%s:%d" % (host,
cfg.CONF.ofp_tcp_listen_port)]
controller_names = ["tcp:%s:%d" %
(host, ryu_cfg.CONF.ofp_tcp_listen_port)]
try:
self.set_protocols(protocols)
self.set_controller(controller_names)

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 VA Linux Systems Japan K.K.
# Copyright (C) 2014,2015 VA Linux Systems Japan K.K.
# Copyright (C) 2014 Fumihiko Kakuma <kakuma at valinux co jp>
# Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
# Copyright (C) 2014,2015 YAMAMOTO Takashi <yamamoto at valinux co jp>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -98,6 +98,7 @@ class _Mod(object):
def patch_fake_oflib_of():
ryu_mod = mock.Mock()
ryu_base_mod = ryu_mod.base
ryu_cfg_mod = ryu_mod.cfg
ryu_ctrl_mod = ryu_mod.controller
handler = _Mod('ryu.controller.handler')
handler.set_ev_cls = mock.Mock()
@ -128,6 +129,7 @@ def patch_fake_oflib_of():
ryu_ofctl_api = ryu_app_ofctl_mod.api
modules = {'ryu': ryu_mod,
'ryu.base': ryu_base_mod,
'ryu.cfg': ryu_cfg_mod,
'ryu.controller': ryu_ctrl_mod,
'ryu.controller.handler': handler,
'ryu.controller.handler.set_ev_cls': handler.set_ev_cls,

View File

@ -1,6 +1,6 @@
# Copyright (C) 2014 VA Linux Systems Japan K.K.
# Copyright (C) 2014,2015 VA Linux Systems Japan K.K.
# Copyright (C) 2014 Fumihiko Kakuma <kakuma at valinux co jp>
# Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp>
# Copyright (C) 2014,2015 YAMAMOTO Takashi <yamamoto at valinux co jp>
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -55,6 +55,14 @@ class OFAAgentTestBase(OFATestBase):
def setUp(self):
super(OFAAgentTestBase, self).setUp()
ryu_cfg = importutils.import_module('ryu.cfg')
ryu_cfg.CONF = cfg.ConfigOpts()
ryu_cfg.CONF.register_cli_opts([
cfg.StrOpt('ofp-listen-host', default='',
help='openflow listen host'),
cfg.IntOpt('ofp-tcp-listen-port', default=6633,
help='openflow tcp listen port')
])
self.mod_agent = importutils.import_module(self._AGENT_NAME)
self.ryuapp = mock.Mock()