Use PortOpt and IpOpt

Use PortOpt and IpOpt as other OpenStack project does,
as PortOpt and IpOpt from oslo will perform checks to
ensure those configuration options are in correct form.

Change-Id: I914c930ce8427f6888ab120aeac6942a89f50824
This commit is contained in:
Kevin_Zheng 2016-05-05 20:31:21 +08:00 committed by Zhenyu Zheng
parent 8a9e6498b8
commit 1d4eef59af
4 changed files with 24 additions and 16 deletions
tricircle
api
cinder_apigw
nova_apigw
tests

@ -22,10 +22,10 @@ from tricircle.common import restapp
common_opts = [
cfg.StrOpt('bind_host', default='0.0.0.0',
help=_("The host IP to bind to")),
cfg.IntOpt('bind_port', default=19999,
help=_("The port to bind to")),
cfg.IPOpt('bind_host', default='0.0.0.0',
help=_("The host IP to bind to")),
cfg.PortOpt('bind_port', default=19999,
help=_("The port to bind to")),
cfg.IntOpt('api_workers', default=1,
help=_("number of api workers")),
cfg.StrOpt('api_extensions_path', default="",

@ -22,10 +22,10 @@ from tricircle.common import restapp
common_opts = [
cfg.StrOpt('bind_host', default='0.0.0.0',
help=_("The host IP to bind to")),
cfg.IntOpt('bind_port', default=19997,
help=_("The port to bind to")),
cfg.IPOpt('bind_host', default='0.0.0.0',
help=_("The host IP to bind to")),
cfg.PortOpt('bind_port', default=19997,
help=_("The port to bind to")),
cfg.IntOpt('api_workers', default=1,
help=_("number of api workers")),
cfg.StrOpt('api_extensions_path', default="",

@ -22,10 +22,10 @@ from tricircle.nova_apigw.controllers import root
common_opts = [
cfg.StrOpt('bind_host', default='0.0.0.0',
help=_("The host IP to bind to")),
cfg.IntOpt('bind_port', default=19998,
help=_("The port to bind to")),
cfg.IPOpt('bind_host', default='0.0.0.0',
help=_("The host IP to bind to")),
cfg.PortOpt('bind_port', default=19998,
help=_("The port to bind to")),
cfg.IntOpt('api_workers', default=1,
help=_("number of api workers")),
cfg.StrOpt('api_extensions_path', default="",

@ -18,13 +18,21 @@ from oslo_config import cfg
from oslotest import base
CONFLICT_OPT_NAMES = [
'api_extensions_path',
'bind_port',
'bind_host'
]
class TestCase(base.BaseTestCase):
"""Test case base class for all unit tests."""
def setUp(self):
# neutron has configuration options "api_extensions_path" and
# "bind_port" which conflicts with tricircle configuration option,
# so unregister this option before running tricircle tests
# neutron has configuration options "api_extensions_path",
# "bind_port" and "bind_host"which conflicts with tricircle
# configuration option, so unregister this option before
# running tricircle tests
for opt in config.core_opts:
if opt.name == 'api_extensions_path' or opt.name == 'bind_port':
if opt.name in CONFLICT_OPT_NAMES:
cfg.CONF.unregister_opt(opt)
super(TestCase, self).setUp()