Remove log translations from neutron-vpnaas
Log messages are no longer being translated. This removes all use of the _LE, _LI, and _LW translation markers to simplify logging and to avoid confusion with new contributions. See: http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html Change-Id: I83e9ab88b0e7084ff828b1c6afaa11bebf532e50
This commit is contained in:
parent
af39435310
commit
e70f1b02cd
@ -27,16 +27,6 @@ _C = _translators.contextual_form
|
|||||||
# The plural translation function using the name "_P"
|
# The plural translation function using the name "_P"
|
||||||
_P = _translators.plural_form
|
_P = _translators.plural_form
|
||||||
|
|
||||||
# Translators for log levels.
|
|
||||||
#
|
|
||||||
# The abbreviated names are meant to reflect the usual use of a short
|
|
||||||
# name like '_'. The "L" is for "log" and the other letter comes from
|
|
||||||
# the level.
|
|
||||||
_LI = _translators.log_info
|
|
||||||
_LW = _translators.log_warning
|
|
||||||
_LE = _translators.log_error
|
|
||||||
_LC = _translators.log_critical
|
|
||||||
|
|
||||||
|
|
||||||
def get_available_languages():
|
def get_available_languages():
|
||||||
return oslo_i18n.get_available_languages(DOMAIN)
|
return oslo_i18n.get_available_languages(DOMAIN)
|
||||||
|
@ -31,7 +31,7 @@ from oslo_utils import uuidutils
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy.orm import exc
|
from sqlalchemy.orm import exc
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _LW
|
|
||||||
from neutron_vpnaas.db.vpn import vpn_models
|
from neutron_vpnaas.db.vpn import vpn_models
|
||||||
from neutron_vpnaas.db.vpn import vpn_validator
|
from neutron_vpnaas.db.vpn import vpn_validator
|
||||||
from neutron_vpnaas.extensions import vpn_endpoint_groups
|
from neutron_vpnaas.extensions import vpn_endpoint_groups
|
||||||
@ -698,7 +698,7 @@ class VPNPluginRpcDbMixin(object):
|
|||||||
vpnservice_db = self._get_vpnservice(
|
vpnservice_db = self._get_vpnservice(
|
||||||
context, vpnservice['id'])
|
context, vpnservice['id'])
|
||||||
except vpnaas.VPNServiceNotFound:
|
except vpnaas.VPNServiceNotFound:
|
||||||
LOG.warning(_LW('vpnservice %s in db is already deleted'),
|
LOG.warning('vpnservice %s in db is already deleted',
|
||||||
vpnservice['id'])
|
vpnservice['id'])
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ from oslo_log import log as logging
|
|||||||
from oslo_rootwrap import wrapper
|
from oslo_rootwrap import wrapper
|
||||||
import six
|
import six
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _, _LE, _LI
|
from neutron_vpnaas._i18n import _
|
||||||
|
|
||||||
if six.PY3:
|
if six.PY3:
|
||||||
import configparser as ConfigParser
|
import configparser as ConfigParser
|
||||||
@ -88,11 +88,11 @@ def filter_command(command, rootwrap_config):
|
|||||||
rawconfig.read(rootwrap_config)
|
rawconfig.read(rootwrap_config)
|
||||||
rw_config = wrapper.RootwrapConfig(rawconfig)
|
rw_config = wrapper.RootwrapConfig(rawconfig)
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
LOG.error(_LE('Incorrect value in %(config)s: %(exc)s'),
|
LOG.error('Incorrect value in %(config)s: %(exc)s',
|
||||||
{'config': rootwrap_config, 'exc': exc.message})
|
{'config': rootwrap_config, 'exc': exc.message})
|
||||||
sys.exit(errno.EINVAL)
|
sys.exit(errno.EINVAL)
|
||||||
except ConfigParser.Error:
|
except ConfigParser.Error:
|
||||||
LOG.error(_LE('Incorrect configuration file: %(config)s'),
|
LOG.error('Incorrect configuration file: %(config)s',
|
||||||
{'config': rootwrap_config})
|
{'config': rootwrap_config})
|
||||||
sys.exit(errno.EINVAL)
|
sys.exit(errno.EINVAL)
|
||||||
|
|
||||||
@ -101,14 +101,14 @@ def filter_command(command, rootwrap_config):
|
|||||||
try:
|
try:
|
||||||
wrapper.match_filter(filters, command, exec_dirs=rw_config.exec_dirs)
|
wrapper.match_filter(filters, command, exec_dirs=rw_config.exec_dirs)
|
||||||
except wrapper.FilterMatchNotExecutable as exc:
|
except wrapper.FilterMatchNotExecutable as exc:
|
||||||
LOG.error(_LE('Command %(command)s is not executable: '
|
LOG.error('Command %(command)s is not executable: '
|
||||||
'%(path)s (filter match = %(name)s)'),
|
'%(path)s (filter match = %(name)s)',
|
||||||
{'command': command,
|
{'command': command,
|
||||||
'path': exc.match.exec_path,
|
'path': exc.match.exec_path,
|
||||||
'name': exc.match.name})
|
'name': exc.match.name})
|
||||||
sys.exit(errno.EINVAL)
|
sys.exit(errno.EINVAL)
|
||||||
except wrapper.NoFilterMatched:
|
except wrapper.NoFilterMatched:
|
||||||
LOG.error(_LE('Unauthorized command: %(cmd)s (no filter matched)'),
|
LOG.error('Unauthorized command: %(cmd)s (no filter matched)',
|
||||||
{'cmd': command})
|
{'cmd': command})
|
||||||
sys.exit(errno.EPERM)
|
sys.exit(errno.EPERM)
|
||||||
|
|
||||||
@ -118,11 +118,11 @@ def execute_with_mount():
|
|||||||
conf()
|
conf()
|
||||||
config.setup_logging()
|
config.setup_logging()
|
||||||
if not conf.cmd:
|
if not conf.cmd:
|
||||||
LOG.error(_LE('No command provided, exiting'))
|
LOG.error('No command provided, exiting')
|
||||||
return errno.EINVAL
|
return errno.EINVAL
|
||||||
|
|
||||||
if not conf.mount_paths:
|
if not conf.mount_paths:
|
||||||
LOG.error(_LE('No mount path provided, exiting'))
|
LOG.error('No mount path provided, exiting')
|
||||||
return errno.EINVAL
|
return errno.EINVAL
|
||||||
|
|
||||||
# Both sudoers and rootwrap.conf will not exist in the directory /etc
|
# Both sudoers and rootwrap.conf will not exist in the directory /etc
|
||||||
@ -138,7 +138,7 @@ def execute_with_mount():
|
|||||||
# http://man7.org/linux/man-pages/man7/namespaces.7.html
|
# http://man7.org/linux/man-pages/man7/namespaces.7.html
|
||||||
if os.path.samefile(os.path.join('/proc/1/ns/net'),
|
if os.path.samefile(os.path.join('/proc/1/ns/net'),
|
||||||
os.path.join('/proc', str(os.getpid()), 'ns/net')):
|
os.path.join('/proc', str(os.getpid()), 'ns/net')):
|
||||||
LOG.error(_LE('Cannot run without netns, exiting'))
|
LOG.error('Cannot run without netns, exiting')
|
||||||
return errno.EINVAL
|
return errno.EINVAL
|
||||||
|
|
||||||
for path, new_path in conf.mount_paths.items():
|
for path, new_path in conf.mount_paths.items():
|
||||||
@ -149,12 +149,12 @@ def execute_with_mount():
|
|||||||
if os.path.isdir(path) and os.path.isabs(path):
|
if os.path.isdir(path) and os.path.isabs(path):
|
||||||
return_code = execute(['mount', '--bind', new_path, path])
|
return_code = execute(['mount', '--bind', new_path, path])
|
||||||
if return_code == 0:
|
if return_code == 0:
|
||||||
LOG.info(_LI('%(new_path)s has been '
|
LOG.info('%(new_path)s has been '
|
||||||
'bind-mounted in %(path)s'),
|
'bind-mounted in %(path)s',
|
||||||
{'new_path': new_path, 'path': path})
|
{'new_path': new_path, 'path': path})
|
||||||
else:
|
else:
|
||||||
LOG.error(_LE('Failed to bind-mount '
|
LOG.error('Failed to bind-mount '
|
||||||
'%(new_path)s in %(path)s'),
|
'%(new_path)s in %(path)s',
|
||||||
{'new_path': new_path, 'path': path})
|
{'new_path': new_path, 'path': path})
|
||||||
return execute(conf.cmd)
|
return execute(conf.cmd)
|
||||||
|
|
||||||
|
@ -20,8 +20,6 @@ from oslo_serialization import jsonutils
|
|||||||
import requests
|
import requests
|
||||||
from requests import exceptions as r_exc
|
from requests import exceptions as r_exc
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _LE, _LW
|
|
||||||
|
|
||||||
|
|
||||||
TIMEOUT = 20.0
|
TIMEOUT = 20.0
|
||||||
|
|
||||||
@ -112,8 +110,8 @@ class CsrRestClient(object):
|
|||||||
except (r_exc.Timeout, r_exc.SSLError) as te:
|
except (r_exc.Timeout, r_exc.SSLError) as te:
|
||||||
# Should never see SSLError, unless requests package is old (<2.0)
|
# Should never see SSLError, unless requests package is old (<2.0)
|
||||||
timeout_val = 0.0 if self.timeout is None else self.timeout
|
timeout_val = 0.0 if self.timeout is None else self.timeout
|
||||||
LOG.warning(_LW("%(method)s: Request timeout%(ssl)s "
|
LOG.warning("%(method)s: Request timeout%(ssl)s "
|
||||||
"(%(timeout).3f sec) for CSR(%(host)s)"),
|
"(%(timeout).3f sec) for CSR(%(host)s)",
|
||||||
{'method': method,
|
{'method': method,
|
||||||
'timeout': timeout_val,
|
'timeout': timeout_val,
|
||||||
'ssl': '(SSLError)'
|
'ssl': '(SSLError)'
|
||||||
@ -121,13 +119,13 @@ class CsrRestClient(object):
|
|||||||
'host': self.host})
|
'host': self.host})
|
||||||
self.status = requests.codes.REQUEST_TIMEOUT
|
self.status = requests.codes.REQUEST_TIMEOUT
|
||||||
except r_exc.ConnectionError:
|
except r_exc.ConnectionError:
|
||||||
LOG.exception(_LE("%(method)s: Unable to connect to "
|
LOG.exception("%(method)s: Unable to connect to "
|
||||||
"CSR(%(host)s)"),
|
"CSR(%(host)s)",
|
||||||
{'method': method, 'host': self.host})
|
{'method': method, 'host': self.host})
|
||||||
self.status = requests.codes.NOT_FOUND
|
self.status = requests.codes.NOT_FOUND
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.error(_LE("%(method)s: Unexpected error for CSR (%(host)s): "
|
LOG.error("%(method)s: Unexpected error for CSR (%(host)s): "
|
||||||
"%(error)s"),
|
"%(error)s",
|
||||||
{'method': method, 'host': self.host, 'error': e})
|
{'method': method, 'host': self.host, 'error': e})
|
||||||
self.status = requests.codes.INTERNAL_SERVER_ERROR
|
self.status = requests.codes.INTERNAL_SERVER_ERROR
|
||||||
else:
|
else:
|
||||||
@ -156,7 +154,7 @@ class CsrRestClient(object):
|
|||||||
self.token = response['token-id']
|
self.token = response['token-id']
|
||||||
LOG.debug("Successfully authenticated with CSR %s", self.host)
|
LOG.debug("Successfully authenticated with CSR %s", self.host)
|
||||||
return True
|
return True
|
||||||
LOG.error(_LE("Failed authentication with CSR %(host)s [%(status)s]"),
|
LOG.error("Failed authentication with CSR %(host)s [%(status)s]",
|
||||||
{'host': self.host, 'status': self.status})
|
{'host': self.host, 'status': self.status})
|
||||||
|
|
||||||
def _do_request(self, method, resource, payload=None, more_headers=None,
|
def _do_request(self, method, resource, payload=None, more_headers=None,
|
||||||
@ -191,7 +189,7 @@ class CsrRestClient(object):
|
|||||||
headers=headers)
|
headers=headers)
|
||||||
if self.status != requests.codes.REQUEST_TIMEOUT:
|
if self.status != requests.codes.REQUEST_TIMEOUT:
|
||||||
return response
|
return response
|
||||||
LOG.error(_LE("%(method)s: Request timeout for CSR(%(host)s)"),
|
LOG.error("%(method)s: Request timeout for CSR(%(host)s)",
|
||||||
{'method': method, 'host': self.host})
|
{'method': method, 'host': self.host})
|
||||||
|
|
||||||
def get_request(self, resource, full_url=False):
|
def get_request(self, resource, full_url=False):
|
||||||
|
@ -26,7 +26,7 @@ from oslo_log import log as logging
|
|||||||
import oslo_messaging
|
import oslo_messaging
|
||||||
from oslo_service import loopingcall
|
from oslo_service import loopingcall
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _, _LE, _LI, _LW
|
from neutron_vpnaas._i18n import _
|
||||||
from neutron_vpnaas.services.vpn.common import topics
|
from neutron_vpnaas.services.vpn.common import topics
|
||||||
from neutron_vpnaas.services.vpn import device_drivers
|
from neutron_vpnaas.services.vpn import device_drivers
|
||||||
from neutron_vpnaas.services.vpn.device_drivers import (
|
from neutron_vpnaas.services.vpn.device_drivers import (
|
||||||
@ -329,7 +329,7 @@ class CiscoCsrIPsecDriver(device_drivers.DeviceDriver):
|
|||||||
if report:
|
if report:
|
||||||
service_report.append(report)
|
service_report.append(report)
|
||||||
if service_report:
|
if service_report:
|
||||||
LOG.info(_LI("Sending status report update to plugin"))
|
LOG.info("Sending status report update to plugin")
|
||||||
self.agent_rpc.update_status(context, service_report)
|
self.agent_rpc.update_status(context, service_report)
|
||||||
LOG.debug("Report: Completed status report processing")
|
LOG.debug("Report: Completed status report processing")
|
||||||
return service_report
|
return service_report
|
||||||
@ -615,8 +615,8 @@ class CiscoCsrIPSecConnection(object):
|
|||||||
LOG.debug("%(resource)s %(which)s is configured",
|
LOG.debug("%(resource)s %(which)s is configured",
|
||||||
{'resource': resource, 'which': which})
|
{'resource': resource, 'which': which})
|
||||||
return
|
return
|
||||||
LOG.error(_LE("Unable to create %(resource)s %(which)s: "
|
LOG.error("Unable to create %(resource)s %(which)s: "
|
||||||
"%(status)d"),
|
"%(status)d",
|
||||||
{'resource': resource, 'which': which,
|
{'resource': resource, 'which': which,
|
||||||
'status': self.csr.status})
|
'status': self.csr.status})
|
||||||
# ToDO(pcm): Set state to error
|
# ToDO(pcm): Set state to error
|
||||||
@ -628,7 +628,7 @@ class CiscoCsrIPSecConnection(object):
|
|||||||
try:
|
try:
|
||||||
getattr(self.csr, create_action)(info)
|
getattr(self.csr, create_action)(info)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
LOG.exception(_LE("Internal error - '%s' is not defined"),
|
LOG.exception("Internal error - '%s' is not defined",
|
||||||
create_action)
|
create_action)
|
||||||
raise CsrResourceCreateFailure(resource=title,
|
raise CsrResourceCreateFailure(resource=title,
|
||||||
which=resource_id)
|
which=resource_id)
|
||||||
@ -641,10 +641,10 @@ class CiscoCsrIPSecConnection(object):
|
|||||||
LOG.debug("%(resource)s configuration %(which)s was removed",
|
LOG.debug("%(resource)s configuration %(which)s was removed",
|
||||||
{'resource': resource, 'which': which})
|
{'resource': resource, 'which': which})
|
||||||
else:
|
else:
|
||||||
LOG.warning(_LW("Unable to delete %(resource)s %(which)s: "
|
LOG.warning("Unable to delete %(resource)s %(which)s: "
|
||||||
"%(status)d"), {'resource': resource,
|
"%(status)d", {'resource': resource,
|
||||||
'which': which,
|
'which': which,
|
||||||
'status': status})
|
'status': status})
|
||||||
|
|
||||||
def do_rollback(self):
|
def do_rollback(self):
|
||||||
"""Undo create steps that were completed successfully."""
|
"""Undo create steps that were completed successfully."""
|
||||||
@ -656,7 +656,7 @@ class CiscoCsrIPSecConnection(object):
|
|||||||
try:
|
try:
|
||||||
getattr(self.csr, delete_action)(step.resource_id)
|
getattr(self.csr, delete_action)(step.resource_id)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
LOG.exception(_LE("Internal error - '%s' is not defined"),
|
LOG.exception("Internal error - '%s' is not defined",
|
||||||
delete_action)
|
delete_action)
|
||||||
raise CsrResourceCreateFailure(resource=step.title,
|
raise CsrResourceCreateFailure(resource=step.title,
|
||||||
which=step.resource_id)
|
which=step.resource_id)
|
||||||
@ -709,10 +709,10 @@ class CiscoCsrIPSecConnection(object):
|
|||||||
route_id, 'Static Route')
|
route_id, 'Static Route')
|
||||||
except CsrResourceCreateFailure:
|
except CsrResourceCreateFailure:
|
||||||
self.do_rollback()
|
self.do_rollback()
|
||||||
LOG.info(_LI("FAILED: Create of IPSec site-to-site connection %s"),
|
LOG.info("FAILED: Create of IPSec site-to-site connection %s",
|
||||||
conn_id)
|
conn_id)
|
||||||
else:
|
else:
|
||||||
LOG.info(_LI("SUCCESS: Created IPSec site-to-site connection %s"),
|
LOG.info("SUCCESS: Created IPSec site-to-site connection %s",
|
||||||
conn_id)
|
conn_id)
|
||||||
|
|
||||||
def delete_ipsec_site_connection(self, context, conn_id):
|
def delete_ipsec_site_connection(self, context, conn_id):
|
||||||
@ -723,11 +723,11 @@ class CiscoCsrIPSecConnection(object):
|
|||||||
"""
|
"""
|
||||||
LOG.debug('Deleting IPSec connection %s', conn_id)
|
LOG.debug('Deleting IPSec connection %s', conn_id)
|
||||||
if not self.steps:
|
if not self.steps:
|
||||||
LOG.warning(_LW('Unable to find connection %s'), conn_id)
|
LOG.warning('Unable to find connection %s', conn_id)
|
||||||
else:
|
else:
|
||||||
self.do_rollback()
|
self.do_rollback()
|
||||||
|
|
||||||
LOG.info(_LI("SUCCESS: Deleted IPSec site-to-site connection %s"),
|
LOG.info("SUCCESS: Deleted IPSec site-to-site connection %s",
|
||||||
conn_id)
|
conn_id)
|
||||||
|
|
||||||
def set_admin_state(self, is_up):
|
def set_admin_state(self, is_up):
|
||||||
@ -735,7 +735,7 @@ class CiscoCsrIPSecConnection(object):
|
|||||||
self.csr.set_ipsec_connection_state(self.tunnel, admin_up=is_up)
|
self.csr.set_ipsec_connection_state(self.tunnel, admin_up=is_up)
|
||||||
if self.csr.status != requests.codes.NO_CONTENT:
|
if self.csr.status != requests.codes.NO_CONTENT:
|
||||||
state = "UP" if is_up else "DOWN"
|
state = "UP" if is_up else "DOWN"
|
||||||
LOG.error(_LE("Unable to change %(tunnel)s admin state to "
|
LOG.error("Unable to change %(tunnel)s admin state to "
|
||||||
"%(state)s"), {'tunnel': self.tunnel,
|
"%(state)s", {'tunnel': self.tunnel,
|
||||||
'state': state})
|
'state': state})
|
||||||
raise CsrAdminStateChangeFailure(tunnel=self.tunnel, state=state)
|
raise CsrAdminStateChangeFailure(tunnel=self.tunnel, state=state)
|
||||||
|
@ -39,7 +39,7 @@ from oslo_log import log as logging
|
|||||||
import oslo_messaging
|
import oslo_messaging
|
||||||
from oslo_service import loopingcall
|
from oslo_service import loopingcall
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _, _LE, _LI, _LW
|
from neutron_vpnaas._i18n import _
|
||||||
from neutron_vpnaas.extensions import vpnaas
|
from neutron_vpnaas.extensions import vpnaas
|
||||||
from neutron_vpnaas.services.vpn.common import topics
|
from neutron_vpnaas.services.vpn.common import topics
|
||||||
from neutron_vpnaas.services.vpn import device_drivers
|
from neutron_vpnaas.services.vpn import device_drivers
|
||||||
@ -309,7 +309,7 @@ class BaseSwanProcess(object):
|
|||||||
self.start()
|
self.start()
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
LOG.exception(
|
LOG.exception(
|
||||||
_LE("Failed to enable vpn process on router %s"),
|
"Failed to enable vpn process on router %s",
|
||||||
self.id)
|
self.id)
|
||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
@ -320,7 +320,7 @@ class BaseSwanProcess(object):
|
|||||||
self.remove_config()
|
self.remove_config()
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
LOG.exception(
|
LOG.exception(
|
||||||
_LE("Failed to disable vpn process on router %s"),
|
"Failed to disable vpn process on router %s",
|
||||||
self.id)
|
self.id)
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@ -463,16 +463,16 @@ class OpenSwanProcess(BaseSwanProcess):
|
|||||||
# logging to error instead of debug because it
|
# logging to error instead of debug because it
|
||||||
# indicates something bad has happened and this is
|
# indicates something bad has happened and this is
|
||||||
# valuable information for figuring it out.
|
# valuable information for figuring it out.
|
||||||
LOG.error(_LE('Process %(pid)s exists with command '
|
LOG.error('Process %(pid)s exists with command '
|
||||||
'line %(cmd_line)s.') %
|
'line %(cmd_line)s.' %
|
||||||
{'pid': pid, 'cmd_line': cmd_line})
|
{'pid': pid, 'cmd_line': cmd_line})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
# This is logged as "info" instead of error because it simply
|
# This is logged as "info" instead of error because it simply
|
||||||
# means that we couldn't find the files to check on them.
|
# means that we couldn't find the files to check on them.
|
||||||
LOG.info(_LI('Unable to find control files on startup for '
|
LOG.info('Unable to find control files on startup for '
|
||||||
'router %(router)s: %(msg)s'),
|
'router %(router)s: %(msg)s',
|
||||||
{'router': self.id, 'msg': e})
|
{'router': self.id, 'msg': e})
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -490,8 +490,8 @@ class OpenSwanProcess(BaseSwanProcess):
|
|||||||
os.remove(ctl_file)
|
os.remove(ctl_file)
|
||||||
|
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
LOG.error(_LE('Unable to remove pluto control '
|
LOG.error('Unable to remove pluto control '
|
||||||
'files for router %(router)s. %(msg)s'),
|
'files for router %(router)s. %(msg)s',
|
||||||
{'router': self.id, 'msg': e})
|
{'router': self.id, 'msg': e})
|
||||||
|
|
||||||
def get_status(self):
|
def get_status(self):
|
||||||
@ -540,8 +540,8 @@ class OpenSwanProcess(BaseSwanProcess):
|
|||||||
eventlet.sleep(wait_interval)
|
eventlet.sleep(wait_interval)
|
||||||
wait_interval *= cfg.CONF.pluto.shutdown_check_back_off
|
wait_interval *= cfg.CONF.pluto.shutdown_check_back_off
|
||||||
else:
|
else:
|
||||||
LOG.warning(_LW('Server appears to still be running, restart '
|
LOG.warning('Server appears to still be running, restart '
|
||||||
'of router %s may fail'), self.id)
|
'of router %s may fail', self.id)
|
||||||
self.start()
|
self.start()
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -553,7 +553,7 @@ class OpenSwanProcess(BaseSwanProcess):
|
|||||||
addrinfo = socket.getaddrinfo(fqdn, None)[0]
|
addrinfo = socket.getaddrinfo(fqdn, None)[0]
|
||||||
return addrinfo[-1][0]
|
return addrinfo[-1][0]
|
||||||
except socket.gaierror:
|
except socket.gaierror:
|
||||||
LOG.exception(_LE("Peer address %s cannot be resolved"), fqdn)
|
LOG.exception("Peer address %s cannot be resolved", fqdn)
|
||||||
|
|
||||||
def _get_nexthop(self, address, connection_id):
|
def _get_nexthop(self, address, connection_id):
|
||||||
# check if address is an ip address or fqdn
|
# check if address is an ip address or fqdn
|
||||||
|
@ -27,7 +27,7 @@ import oslo_messaging as messaging
|
|||||||
from oslo_service import loopingcall
|
from oslo_service import loopingcall
|
||||||
from oslo_service import periodic_task
|
from oslo_service import periodic_task
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _, _LE, _LW
|
from neutron_vpnaas._i18n import _
|
||||||
from neutron_vpnaas.services.vpn.common import topics
|
from neutron_vpnaas.services.vpn.common import topics
|
||||||
from neutron_vpnaas.services.vpn import device_drivers
|
from neutron_vpnaas.services.vpn import device_drivers
|
||||||
|
|
||||||
@ -75,8 +75,8 @@ class NeutronServerAPI(object):
|
|||||||
for conn in svc[_KEY_CONNECTIONS]:
|
for conn in svc[_KEY_CONNECTIONS]:
|
||||||
vyatta_vpn_config.validate_svc_connection(conn)
|
vyatta_vpn_config.validate_svc_connection(conn)
|
||||||
except v_exc.InvalidVPNServiceError:
|
except v_exc.InvalidVPNServiceError:
|
||||||
LOG.error(_LE('Invalid or incomplete VPN service data: '
|
LOG.error('Invalid or incomplete VPN service data: '
|
||||||
'id={id}').format(id=svc.get('id')))
|
'id={id}'.format(id=svc.get('id')))
|
||||||
continue
|
continue
|
||||||
vpn_services.append(svc)
|
vpn_services.append(svc)
|
||||||
|
|
||||||
@ -280,8 +280,8 @@ class _VyattaPeriodicTasks(periodic_task.PeriodicTasks):
|
|||||||
try:
|
try:
|
||||||
ipsec_sa = vrouter.get_vpn_ipsec_sa()
|
ipsec_sa = vrouter.get_vpn_ipsec_sa()
|
||||||
except v_exc.VRouterOperationError as e:
|
except v_exc.VRouterOperationError as e:
|
||||||
LOG.warning(_LW('Failed to fetch tunnel stats from router '
|
LOG.warning('Failed to fetch tunnel stats from router '
|
||||||
'{0}: {1}').format(router_id, unicode(e)))
|
'{0}: {1}'.format(router_id, unicode(e)))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
conn_ok = vyatta_vpn_config.parse_vpn_connections(
|
conn_ok = vyatta_vpn_config.parse_vpn_connections(
|
||||||
|
@ -20,7 +20,7 @@ from neutron.services import provider_configuration as pconf
|
|||||||
from neutron.services import service_base
|
from neutron.services import service_base
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _LI
|
|
||||||
from neutron_vpnaas.db.vpn import vpn_db
|
from neutron_vpnaas.db.vpn import vpn_db
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -56,7 +56,7 @@ class VPNDriverPlugin(VPNPlugin, vpn_db.VPNPluginRpcDbMixin):
|
|||||||
# Load the service driver from neutron.conf.
|
# Load the service driver from neutron.conf.
|
||||||
drivers, default_provider = service_base.load_drivers(
|
drivers, default_provider = service_base.load_drivers(
|
||||||
constants.VPN, self)
|
constants.VPN, self)
|
||||||
LOG.info(_LI("VPN plugin using service driver: %s"), default_provider)
|
LOG.info("VPN plugin using service driver: %s", default_provider)
|
||||||
self.ipsec_driver = drivers[default_provider]
|
self.ipsec_driver = drivers[default_provider]
|
||||||
vpn_db.subscribe()
|
vpn_db.subscribe()
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ from oslo_log import log as logging
|
|||||||
import sqlalchemy as sa
|
import sqlalchemy as sa
|
||||||
from sqlalchemy.orm import exc as sql_exc
|
from sqlalchemy.orm import exc as sql_exc
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _, _LI
|
from neutron_vpnaas._i18n import _
|
||||||
from neutron_vpnaas.db.vpn import vpn_models
|
from neutron_vpnaas.db.vpn import vpn_models
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -223,9 +223,9 @@ def create_tunnel_mapping(context, conn_info):
|
|||||||
msg = _("Attempt to create duplicate entry in Cisco CSR "
|
msg = _("Attempt to create duplicate entry in Cisco CSR "
|
||||||
"mapping table for connection %s") % conn_id
|
"mapping table for connection %s") % conn_id
|
||||||
raise CsrInternalError(reason=msg)
|
raise CsrInternalError(reason=msg)
|
||||||
LOG.info(_LI("Mapped connection %(conn_id)s to Tunnel%(tunnel_id)d "
|
LOG.info("Mapped connection %(conn_id)s to Tunnel%(tunnel_id)d "
|
||||||
"using IKE policy ID %(ike_id)d and IPSec policy "
|
"using IKE policy ID %(ike_id)d and IPSec policy "
|
||||||
"ID %(ipsec_id)d"),
|
"ID %(ipsec_id)d",
|
||||||
{'conn_id': conn_id, 'tunnel_id': csr_tunnel_id,
|
{'conn_id': conn_id, 'tunnel_id': csr_tunnel_id,
|
||||||
'ike_id': csr_ike_id, 'ipsec_id': csr_ipsec_id})
|
'ike_id': csr_ike_id, 'ipsec_id': csr_ipsec_id})
|
||||||
|
|
||||||
@ -235,4 +235,4 @@ def delete_tunnel_mapping(context, conn_info):
|
|||||||
with context.session.begin():
|
with context.session.begin():
|
||||||
sess_qry = context.session.query(IdentifierMap)
|
sess_qry = context.session.query(IdentifierMap)
|
||||||
sess_qry.filter_by(ipsec_site_conn_id=conn_id).delete()
|
sess_qry.filter_by(ipsec_site_conn_id=conn_id).delete()
|
||||||
LOG.info(_LI("Removed mapping for connection %s"), conn_id)
|
LOG.info("Removed mapping for connection %s", conn_id)
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _LI
|
|
||||||
from rally.common import logging
|
from rally.common import logging
|
||||||
from rally.task import scenario
|
from rally.task import scenario
|
||||||
from rally.task import types as types
|
from rally.task import types as types
|
||||||
@ -63,7 +62,7 @@ class TestVpnBasicScenario(vpn_base.VpnBase):
|
|||||||
self.create_ipsec_site_connections(**kwargs)
|
self.create_ipsec_site_connections(**kwargs)
|
||||||
self.assert_statuses(final_status='ACTIVE', **kwargs)
|
self.assert_statuses(final_status='ACTIVE', **kwargs)
|
||||||
self.verify_vpn_connectivity(**kwargs)
|
self.verify_vpn_connectivity(**kwargs)
|
||||||
LOG.info(_LI("VPN CONNECTIVITY TEST PASSED!"))
|
LOG.info("VPN CONNECTIVITY TEST PASSED!")
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _LI
|
|
||||||
from rally.common import logging
|
from rally.common import logging
|
||||||
from rally.task import scenario
|
from rally.task import scenario
|
||||||
from rally.task import types as types
|
from rally.task import types as types
|
||||||
@ -63,7 +63,7 @@ class TestVpnStatusScenario(vpn_base.VpnBase):
|
|||||||
self.update_router(self.router_ids[0], admin_state_up=True)
|
self.update_router(self.router_ids[0], admin_state_up=True)
|
||||||
self.update_router(self.router_ids[1], admin_state_up=True)
|
self.update_router(self.router_ids[1], admin_state_up=True)
|
||||||
self.assert_statuses(final_status='ACTIVE', **kwargs)
|
self.assert_statuses(final_status='ACTIVE', **kwargs)
|
||||||
LOG.info(_LI("VPN STATUS TEST PASSED!"))
|
LOG.info("VPN STATUS TEST PASSED!")
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron_vpnaas._i18n import _LI
|
|
||||||
from rally.common import logging
|
from rally.common import logging
|
||||||
from rally.task import scenario
|
from rally.task import scenario
|
||||||
from rally.task import types as types
|
from rally.task import types as types
|
||||||
@ -56,7 +56,7 @@ class TestVpnTenantScenario(vpn_base.VpnBase):
|
|||||||
self.create_vpn_services()
|
self.create_vpn_services()
|
||||||
self.create_ipsec_site_connections(**kwargs)
|
self.create_ipsec_site_connections(**kwargs)
|
||||||
self.assert_statuses(final_status='ACTIVE', **kwargs)
|
self.assert_statuses(final_status='ACTIVE', **kwargs)
|
||||||
LOG.info(_LI("VPN TENANT TEST PASSED!"))
|
LOG.info("VPN TENANT TEST PASSED!")
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
self.cleanup()
|
self.cleanup()
|
||||||
|
2
tox.ini
2
tox.ini
@ -87,7 +87,7 @@ commands = sphinx-build -W -b html doc/source doc/build
|
|||||||
# TODO(marun) H404 multi line docstring should start with a summary
|
# TODO(marun) H404 multi line docstring should start with a summary
|
||||||
# TODO(dougwig) -- uncomment this to test for remaining linkages
|
# TODO(dougwig) -- uncomment this to test for remaining linkages
|
||||||
# N530 direct neutron imports not allowed
|
# N530 direct neutron imports not allowed
|
||||||
ignore = E125,E126,E128,E129,E265,H404,H405,N530
|
ignore = E125,E126,E128,E129,E265,H404,H405,N530,N531
|
||||||
show-source = true
|
show-source = true
|
||||||
exclude = .venv,.git,.tox,dist,doc,.tmp,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios
|
exclude = .venv,.git,.tox,dist,doc,.tmp,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user