Enable hacking N340, N342

Change-Id: Ic305bd789593cc16bd7cf82229f496fab97c321d
This commit is contained in:
Anna Khmelnitsky 2017-03-17 13:35:49 -07:00
parent 0b635a961c
commit 8c847cb7d9
69 changed files with 251 additions and 208 deletions

42
gbpservice/_i18n.py Normal file
View File

@ -0,0 +1,42 @@
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import oslo_i18n
DOMAIN = "gbpservice"
_translators = oslo_i18n.TranslatorFactory(domain=DOMAIN)
# The primary translation function using the well-known name "_"
_ = _translators.primary
# The contextual translation function using the name "_C"
_C = _translators.contextual_form
# The plural translation function using the name "_P"
_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():
return oslo_i18n.get_available_languages(DOMAIN)

View File

@ -12,14 +12,15 @@
import contextlib
from neutron._i18n import _
from neutron._i18n import _LE
from neutron import context as n_ctx
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
from stevedore import driver
from gbpservice._i18n import _
from gbpservice._i18n import _LE
LOG = logging.getLogger(__name__)
cfg.CONF.import_group('keystone_authtoken', 'keystonemiddleware.auth_token')

View File

@ -10,13 +10,13 @@
# License for the specific language governing permissions and limitations
# under the License.
from gbpservice._i18n import _LE
from gbpservice.contrib.nfp.config_orchestrator.common import (
topics as a_topics)
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.lib import transport
from gbpservice.nfp.orchestrator.openstack import openstack_driver
from neutron._i18n import _LE
from neutron.common import constants as n_constants
from neutron.common import rpc as n_rpc
from neutron.common import topics as n_topics

View File

@ -13,6 +13,7 @@
import ast
import copy
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.config_orchestrator.common import common
from gbpservice.nfp.common import constants as const
from gbpservice.nfp.common import data_formatter as df
@ -21,7 +22,6 @@ from gbpservice.nfp.core import context as module_context
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.lib import transport
from neutron._i18n import _LI
from neutron_fwaas.db.firewall import firewall_db
from oslo_log import helpers as log_helpers

View File

@ -13,6 +13,7 @@
import ast
import copy
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.config_orchestrator.common import common
from gbpservice.nfp.common import constants as const
from gbpservice.nfp.common import data_formatter as df
@ -20,7 +21,6 @@ from gbpservice.nfp.core import context as module_context
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.lib import transport
from neutron._i18n import _LI
from neutron_lbaas.db.loadbalancer import loadbalancer_db
from oslo_log import helpers as log_helpers

View File

@ -13,6 +13,7 @@
import ast
import copy
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.config_orchestrator.common import common
from gbpservice.contrib.nfp.config_orchestrator.common import lbv2_constants
from gbpservice.nfp.common import constants as const
@ -22,7 +23,6 @@ from gbpservice.nfp.core import context as module_context
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.lib import transport
from neutron._i18n import _LI
from neutron_lbaas.common import cert_manager
from neutron_lbaas.common.tls_utils import cert_parser
from neutron_lbaas.db.loadbalancer import loadbalancer_dbv2

View File

@ -13,6 +13,7 @@
import ast
import copy
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.config_orchestrator.common import common
from gbpservice.nfp.common import constants as const
from gbpservice.nfp.common import data_formatter as df
@ -21,7 +22,6 @@ from gbpservice.nfp.core import context as module_context
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.lib import transport
from neutron._i18n import _LI
from neutron_vpnaas.db.vpn import vpn_db
from oslo_log import helpers as log_helpers

View File

@ -13,6 +13,7 @@
import sys
import traceback
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.config_orchestrator.common import (
lbv2_constants as lbv2_const)
from gbpservice.contrib.nfp.config_orchestrator.common import (
@ -22,7 +23,6 @@ from gbpservice.nfp.core import context as module_context
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.lib import transport
from neutron._i18n import _LI
import oslo_messaging as messaging
@ -286,8 +286,8 @@ class NaasNotificationHandler(object):
def handle_notification(self, context, notification_data):
try:
LOG.debug("Handling Notification with Data:%s"
% notification_data)
LOG.debug("Handling Notification with Data:%s",
notification_data)
resource_data = notification_data['notification'][0]['data']
handler = ServicetypeToHandlerMap[notification_data[
'info']['service_type']](self.conf, self.sc)

View File

@ -11,11 +11,11 @@
# under the License.
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.configurator.lib import constants as const
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.core import module as nfp_api
from neutron._i18n import _LI
from neutron.common import rpc as n_rpc
from oslo_config import cfg
import oslo_messaging as messaging

View File

@ -16,8 +16,7 @@ import oslo_messaging as messaging
import requests
import six
from neutron._i18n import _LI
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.configurator.agents import agent_base
from gbpservice.contrib.nfp.configurator.lib import constants as common_const
from gbpservice.contrib.nfp.configurator.lib import fw_constants as const

View File

@ -14,8 +14,7 @@ import copy
import os
import six
from neutron._i18n import _LI
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.configurator.agents import agent_base
from gbpservice.contrib.nfp.configurator.lib import (
generic_config_constants as gen_cfg_const)
@ -301,7 +300,7 @@ class GenericConfigEventHandler(agent_base.AgentBaseEventHandler,
gen_cfg_const.DEVICE_TO_BECOME_DOWN)
def _process_event(self, ev):
LOG.debug(" Handling event %s " % (ev.data))
LOG.debug(" Handling event %s ", (ev.data))
# Process single request data blob
resource_data = ev.data['resource_data']
# The context inside ev.data is the agent info dictionary prepared

View File

@ -12,6 +12,7 @@
import six
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.configurator.agents import agent_base
from gbpservice.contrib.nfp.configurator.lib import data_filter
from gbpservice.contrib.nfp.configurator.lib import lb_constants
@ -20,7 +21,6 @@ from gbpservice.nfp.core import event as nfp_event
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.core import module as nfp_api
from neutron._i18n import _LI
from neutron import context
LOG = nfp_logging.getLogger(__name__)

View File

@ -13,8 +13,7 @@
import os
import six
from neutron._i18n import _LI
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.configurator.agents import agent_base
from gbpservice.contrib.nfp.configurator.lib import data_filter
from gbpservice.contrib.nfp.configurator.lib import lbv2_constants as lb_const

View File

@ -14,6 +14,7 @@
import os
import six
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.configurator.agents import agent_base
from gbpservice.contrib.nfp.configurator.drivers.base import base_driver
from gbpservice.contrib.nfp.configurator.lib import data_filter
@ -23,7 +24,6 @@ from gbpservice.nfp.core import event as nfp_event
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.core import module as nfp_api
from neutron._i18n import _LI
import oslo_messaging as messaging
LOG = nfp_logging.getLogger(__name__)

View File

@ -16,6 +16,7 @@ import time
from oslo_serialization import jsonutils
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.configurator.drivers.base import base_driver
from gbpservice.contrib.nfp.configurator.drivers.firewall.vyos import (
vyos_fw_constants as const)
@ -23,7 +24,6 @@ from gbpservice.contrib.nfp.configurator.lib import constants as common_const
from gbpservice.contrib.nfp.configurator.lib import data_parser
from gbpservice.contrib.nfp.configurator.lib import fw_constants as fw_const
from gbpservice.nfp.core import log as nfp_logging
from neutron._i18n import _LI
LOG = nfp_logging.getLogger(__name__)

View File

@ -12,6 +12,7 @@
from oslo_log import helpers as log_helpers
from gbpservice._i18n import _LI
from gbpservice.contrib.nfp.configurator.lib import constants as const
from gbpservice.contrib.nfp.configurator.lib import demuxer
from gbpservice.contrib.nfp.configurator.lib import utils
@ -19,7 +20,6 @@ from gbpservice.nfp.core import context as module_context
from gbpservice.nfp.core import log as nfp_logging
from gbpservice.nfp.core import rpc
from neutron._i18n import _LI
LOG = nfp_logging.getLogger(__name__)

View File

@ -13,12 +13,12 @@
from keystoneclient import exceptions as k_exceptions
from keystoneclient.v2_0 import client as keyclient
from gbpservice._i18n import _LE
from gbpservice.common import utils
from gbpservice.contrib.nfp.config_orchestrator.common import topics
from gbpservice.nfp.core import log as nfp_logging
import netaddr
from neutron._i18n import _LE
from neutron.api.v2 import attributes as attr
from neutron.common import constants as l3_constants
from neutron.common import exceptions as n_exc

View File

@ -11,8 +11,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from neutron._i18n import _LE
from neutron._i18n import _LW
from neutron.callbacks import registry
from neutron.common import exceptions as n_exc
from neutron.extensions import address_scope
@ -25,6 +23,8 @@ from neutron import quota
from oslo_log import log as logging
from oslo_utils import excutils
from gbpservice._i18n import _LE
from gbpservice._i18n import _LW
from gbpservice.common import utils
from gbpservice.neutron.extensions import group_policy as gp_ext
from gbpservice.neutron.extensions import servicechain as sc_ext

View File

@ -12,7 +12,6 @@
import ast
from neutron._i18n import _LE
from neutron.common import exceptions as n_exc
from neutron.db import common_db_mixin
from neutron.db import models_v2
@ -28,6 +27,7 @@ from sqlalchemy.ext.orderinglist import ordering_list
from sqlalchemy import orm
from sqlalchemy.orm import exc
from gbpservice._i18n import _LE
from gbpservice.neutron.extensions import servicechain as schain
from gbpservice.neutron.services.servicechain.common import exceptions as s_exc

View File

@ -16,7 +16,6 @@
import copy
import re
from neutron._i18n import _LW
from neutron.common import constants as n_constants
from neutron import context as nctx
from neutron.extensions import portbindings
@ -26,6 +25,7 @@ from opflexagent import constants as ofcst
from oslo_log import log
from oslo_utils import importutils
from gbpservice._i18n import _LW
from gbpservice.neutron.services.grouppolicy.drivers.cisco.apic import (
apic_mapping as amap)
from gbpservice.neutron.services.grouppolicy.drivers.cisco.apic import (

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LE
from oslo_log import log
from gbpservice._i18n import _LE
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import exceptions
LOG = log.getLogger(__name__)

View File

@ -16,10 +16,11 @@
from keystoneclient import auth as ksc_auth
from keystoneclient import session as ksc_session
from keystoneclient.v3 import client as ksc_client
from neutron._i18n import _LW
from oslo_config import cfg
from oslo_log import log as logging
from gbpservice._i18n import _LW
LOG = logging.getLogger(__name__)
# REVISIT(rkukura): We use keystone to get the name of the keystone
@ -42,15 +43,15 @@ class ProjectNameCache(object):
def _get_keystone_client(self):
LOG.debug("Getting keystone client")
auth = ksc_auth.load_from_conf_options(cfg.CONF, AUTH_GROUP)
LOG.debug("Got auth: %s" % auth)
LOG.debug("Got auth: %s", auth)
if not auth:
LOG.warning(_LW('No auth_plugin configured in %s'),
AUTH_GROUP)
session = ksc_session.Session.load_from_conf_options(
cfg.CONF, AUTH_GROUP, auth=auth)
LOG.debug("Got session: %s" % session)
LOG.debug("Got session: %s", session)
self.keystone = ksc_client.Client(session=session)
LOG.debug("Got client: %s" % self.keystone)
LOG.debug("Got client: %s", self.keystone)
def ensure_project(self, project_id):
"""Ensure cache contains mapping for project.
@ -76,7 +77,7 @@ class ProjectNameCache(object):
self._get_keystone_client()
LOG.debug("Calling project API")
projects = self.keystone.projects.list()
LOG.debug("Received projects: %s" % projects)
LOG.debug("Received projects: %s", projects)
for project in projects:
self.project_names[project.id] = project.name

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.api import extensions
from neutron.db import address_scope_db
from neutron import manager as n_manager
@ -25,6 +23,8 @@ from oslo_utils import excutils
from aim.api import resource as aim_res
from aim import exceptions as aim_exc
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice.neutron import extensions as extensions_pkg
from gbpservice.neutron.extensions import cisco_apic
from gbpservice.neutron.plugins.ml2plus import driver_api as api_plus

View File

@ -24,9 +24,6 @@ from aim.api import resource as aim_resource
from aim.common import utils
from aim import context as aim_context
from aim import utils as aim_utils
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron._i18n import _LW
from neutron.agent import securitygroups_rpc
from neutron.api.v2 import attributes
from neutron.common import constants as n_constants
@ -53,6 +50,9 @@ import oslo_messaging
from apic_ml2.neutron.plugins.ml2.drivers.cisco.apic import (rpc as
apic_topo_rpc)
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice._i18n import _LW
from gbpservice.network.neutronv2 import local_api
from gbpservice.neutron.extensions import cisco_apic
from gbpservice.neutron.extensions import cisco_apic_l3 as a_l3

View File

@ -13,10 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice.neutron.plugins.ml2plus import driver_api
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.plugins.ml2.common import exceptions as ml2_exc
from neutron.plugins.ml2 import managers
from oslo_log import log

View File

@ -16,14 +16,13 @@
# The following is imported at the beginning to ensure
# that the patches are applied before any of the
# modules save a reference to the functions being patched
from gbpservice.neutron.plugins.ml2plus import patch_neutron # noqa
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice.neutron.extensions import patch # noqa
from gbpservice.neutron.plugins.ml2plus import patch_neutron # noqa
import functools
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.api.v2 import attributes
from neutron.callbacks import events
from neutron.callbacks import registry

View File

@ -13,8 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.api import extensions
from neutron.db import common_db_mixin
from neutron.db import db_base_plugin_v2
@ -28,6 +26,8 @@ from oslo_log import log as logging
from oslo_utils import excutils
from sqlalchemy import inspect
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice.neutron import extensions as extensions_pkg
from gbpservice.neutron.plugins.ml2plus.drivers.apic_aim import (
extension_db as extn_db)

View File

@ -12,7 +12,6 @@
from keystoneclient import exceptions as k_exceptions
from keystoneclient.v2_0 import client as k_client
from neutron._i18n import _LE
from neutron.db import models_v2
from neutron_lib.db import model_base
from oslo_config import cfg
@ -22,6 +21,7 @@ from oslo_serialization import jsonutils
from oslo_utils import excutils
import sqlalchemy as sa
from gbpservice._i18n import _LE
from gbpservice.common import utils
from gbpservice.network.neutronv2 import local_api
from gbpservice.neutron.db.grouppolicy import group_policy_mapping_db as gpdb

View File

@ -17,9 +17,6 @@ import six
from aim.api import resource as aim_resource
from aim import context as aim_context
from aim import utils as aim_utils
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron._i18n import _LW
from neutron.agent.linux import dhcp
from neutron.api.v2 import attributes
from neutron.common import constants as n_constants
@ -34,6 +31,9 @@ from oslo_log import helpers as log
from oslo_log import log as logging
from oslo_utils import excutils
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice._i18n import _LW
from gbpservice.neutron.db.grouppolicy import group_policy_db as gpdb
from gbpservice.neutron.db.grouppolicy import group_policy_mapping_db as gpmdb
from gbpservice.neutron.extensions import cisco_apic

View File

@ -12,8 +12,6 @@
from apic_ml2.neutron.db import port_ha_ipaddress_binding as ha_ip_db
from neutron._i18n import _LE
from neutron._i18n import _LW
from neutron.common import rpc as n_rpc
from neutron.common import topics
from neutron.plugins.ml2 import rpc as ml2_rpc
@ -21,6 +19,8 @@ from opflexagent import rpc as o_rpc
from oslo_db import api as oslo_db_api
from oslo_log import log
from gbpservice._i18n import _LE
from gbpservice._i18n import _LW
from gbpservice.neutron.services.grouppolicy.drivers.cisco.apic import (
nova_client as nclient)
@ -200,7 +200,7 @@ class AIMMappingRPCMixin(ha_ip_db.HAIPOwnerDbMixin):
self._set_dhcp_lease_time(details)
details.pop('_cache', None)
LOG.debug("Details for port %s : %s" % (port['id'], details))
LOG.debug("Details for port %s : %s", (port['id'], details))
return details
def _get_owned_addresses(self, plugin_context, port_id):

View File

@ -25,9 +25,6 @@ from apicapi import apic_mapper
from keystoneclient.auth.identity.generic import password as keypassword
from keystoneclient import client as keyclient
from keystoneclient import session as keysession
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron._i18n import _LW
from neutron.agent.linux import dhcp
from neutron.api.v2 import attributes
from neutron.common import constants as n_constants
@ -53,6 +50,9 @@ import oslo_messaging
from oslo_serialization import jsonutils
import sqlalchemy as sa
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice._i18n import _LW
from gbpservice.neutron.db.grouppolicy.extensions import apic_reuse_bd_db
from gbpservice.neutron.db.grouppolicy import group_policy_mapping_db as gpdb
from gbpservice.neutron.extensions import group_policy as gpolicy
@ -1196,7 +1196,7 @@ class ApicMappingDriver(api.ResourceMappingDriver,
self._notify_port_update(context._plugin_context,
context.current['port_id'])
except n_exc.PortNotFound:
LOG.warning(_LW("Port %s is missing") % context.current['port_id'])
LOG.warning(_LW("Port %s is missing"), context.current['port_id'])
return
def delete_policy_target_group_precommit(self, context):
@ -1560,13 +1560,13 @@ class ApicMappingDriver(api.ResourceMappingDriver,
es=es['name'])
self._check_edge_nat_setting(es)
else:
LOG.warning(UNMANAGED_SEGMENT % context.current['id'])
LOG.warning(UNMANAGED_SEGMENT, context.current['id'])
def create_external_segment_postcommit(self, context):
es = context.current
external_info = self.apic_manager.ext_net_dict.get(es['name'])
if not external_info:
LOG.warning(UNMANAGED_SEGMENT % es['id'])
LOG.warning(UNMANAGED_SEGMENT, es['id'])
else:
if not es['subnet_id']:
subnet = self._use_implicit_external_subnet(context, es)
@ -1584,7 +1584,7 @@ class ApicMappingDriver(api.ResourceMappingDriver,
ext_info = self.apic_manager.ext_net_dict.get(
context.current['name'])
if not ext_info:
LOG.warning(UNMANAGED_SEGMENT % context.current['id'])
LOG.warning(UNMANAGED_SEGMENT, context.current['id'])
return
if (context.current['external_routes'] !=
context.original['external_routes']):
@ -1870,7 +1870,7 @@ class ApicMappingDriver(api.ResourceMappingDriver,
ext_info = self.apic_manager.ext_net_dict.get(es['name'])
if not ext_info:
LOG.warning(_LW("External Segment %s is not managed by APIC "
"mapping driver.") % es['id'])
"mapping driver."), es['id'])
return
pre_existing = (False if is_shadow else self._is_pre_existing(es))
pfx = self._get_shadow_prefix(plugin_context, is_shadow, l3policy_obj,
@ -1891,7 +1891,7 @@ class ApicMappingDriver(api.ResourceMappingDriver,
l3out_info = self._query_l3out_info(mapped_es,
self.name_mapper.tenant(es))
if not l3out_info:
LOG.warning(PRE_EXISTING_SEGMENT % es['name'])
LOG.warning(PRE_EXISTING_SEGMENT, es['name'])
return
mapped_tenant = l3out_info['l3out_tenant']
if ext_info.get('external_epg') == ep['name']:
@ -2105,7 +2105,7 @@ class ApicMappingDriver(api.ResourceMappingDriver,
external_segments = context.current['external_segments']
ext_info = self.apic_manager.ext_net_dict.get(es['name'])
if not ext_info:
LOG.warning(UNMANAGED_SEGMENT % es['id'])
LOG.warning(UNMANAGED_SEGMENT, es['id'])
return
exposed = ext_info.get('cidr_exposed')
@ -2326,7 +2326,7 @@ class ApicMappingDriver(api.ResourceMappingDriver,
for es in added_ess:
ext_info = self.apic_manager.ext_net_dict.get(es['name'])
if not ext_info:
LOG.warning(UNMANAGED_SEGMENT % es['id'])
LOG.warning(UNMANAGED_SEGMENT, es['id'])
continue
pfx = self._get_shadow_prefix(context, is_shadow, l3policy_obj,
self._is_edge_nat(ext_info))
@ -2350,7 +2350,7 @@ class ApicMappingDriver(api.ResourceMappingDriver,
l3out_info = self._query_l3out_info(es_name,
self.name_mapper.tenant(es))
if not l3out_info:
LOG.warning(PRE_EXISTING_SEGMENT % es['name'])
LOG.warning(PRE_EXISTING_SEGMENT, es['name'])
continue
es_tenant = l3out_info['l3out_tenant']
pre_existing_epg = (
@ -2426,7 +2426,7 @@ class ApicMappingDriver(api.ResourceMappingDriver,
for es in added_ess:
ext_info = self.apic_manager.ext_net_dict.get(es['name'])
if not ext_info:
LOG.warning(UNMANAGED_SEGMENT % es['id'])
LOG.warning(UNMANAGED_SEGMENT, es['id'])
continue
pfx = self._get_shadow_prefix(context, is_shadow, l3policy_obj,
self._is_edge_nat(ext_info))
@ -2461,7 +2461,7 @@ class ApicMappingDriver(api.ResourceMappingDriver,
l3out_info = self._query_l3out_info(es_name,
self.name_mapper.tenant(es))
if not l3out_info:
LOG.warning(PRE_EXISTING_SEGMENT % es['name'])
LOG.warning(PRE_EXISTING_SEGMENT, es['name'])
continue
es_tenant = l3out_info['l3out_tenant']
pre_existing_epg = (
@ -2530,7 +2530,7 @@ class ApicMappingDriver(api.ResourceMappingDriver,
l3out_info = self._query_l3out_info(es_name,
self.name_mapper.tenant(es))
if not l3out_info:
LOG.warning(PRE_EXISTING_SEGMENT % es['name'])
LOG.warning(PRE_EXISTING_SEGMENT, es['name'])
return
es_tenant = l3out_info['l3out_tenant']
@ -3188,13 +3188,13 @@ class ApicMappingDriver(api.ResourceMappingDriver,
context, es['name']),
self.name_mapper.tenant(es))
if not l3out_info:
LOG.warning(PRE_EXISTING_SEGMENT % es['name'])
LOG.warning(PRE_EXISTING_SEGMENT, es['name'])
return
if not (l3out_info.get('vrf_name') and
l3out_info.get('vrf_tenant')):
LOG.warning(
_LW("External routed network %s doesn't have private "
"network set") % es['name'])
"network set"), es['name'])
return
es_tenant = l3out_info['l3out_tenant']
nat_vrf_name = self.name_mapper.name_mapper.pre_existing(
@ -3290,13 +3290,13 @@ class ApicMappingDriver(api.ResourceMappingDriver,
context, es['name']),
self.name_mapper.tenant(es))
if not l3out_info:
LOG.warning(PRE_EXISTING_SEGMENT % es['name'])
LOG.warning(PRE_EXISTING_SEGMENT, es['name'])
return
if not (l3out_info.get('vrf_name') and
l3out_info.get('vrf_tenant')):
LOG.warning(
_LW("External routed network %s doesn't have private "
"network set") % es['name'])
"network set"), es['name'])
return
es_tenant = l3out_info['l3out_tenant']
nat_vrf_name = self.name_mapper.name_mapper.pre_existing(

View File

@ -11,13 +11,15 @@
# under the License.
from keystoneauth1 import loading as ks_loading
from neutron._i18n import _LW
from neutron.notifiers import nova as n_nova
from novaclient import client as nclient
from novaclient import exceptions as nova_exceptions
from oslo_config import cfg
from oslo_log import log as logging
from gbpservice._i18n import _LW
LOG = logging.getLogger(__name__)

View File

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LI
from neutron import manager as n_manager
from oslo_log import log as logging
from gbpservice._i18n import _LI
from gbpservice.neutron.db.grouppolicy.extensions import (
apic_auto_ptg_db as auto_ptg_db)
from gbpservice.neutron.db.grouppolicy.extensions import (

View File

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LI
from oslo_log import log as logging
from gbpservice._i18n import _LI
from gbpservice.neutron.db.grouppolicy.extensions import (
apic_reuse_bd_db as db)
from gbpservice.neutron.db.grouppolicy import group_policy_db as gp_db

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LI
from neutron._i18n import _LW
from neutron_lib.db import model_base
from oslo_config import cfg
from oslo_log import helpers as log
@ -19,6 +17,8 @@ from oslo_log import log as logging
from oslo_utils import excutils
import sqlalchemy as sa
from gbpservice._i18n import _LI
from gbpservice._i18n import _LW
from gbpservice.network.neutronv2 import local_api
from gbpservice.neutron.extensions import driver_proxy_group as pg_ext
from gbpservice.neutron.extensions import group_policy as gbp_ext

View File

@ -14,11 +14,11 @@ import requests
from requests import auth
import six
from neutron._i18n import _LI
from oslo_config import cfg
from oslo_log import log as logging
from oslo_serialization import jsonutils
from gbpservice._i18n import _LI
LOG = logging.getLogger(__name__)

View File

@ -15,8 +15,6 @@ import operator
from keystoneclient import exceptions as k_exceptions
from keystoneclient.v2_0 import client as k_client
from neutron._i18n import _LE
from neutron._i18n import _LW
from neutron.api.v2 import attributes
from neutron.common import constants as const
from neutron.common import exceptions as n_exc
@ -32,6 +30,8 @@ from oslo_utils import excutils
import sqlalchemy as sa
from sqlalchemy.orm import exc as sa_exc
from gbpservice._i18n import _LE
from gbpservice._i18n import _LW
from gbpservice.common import utils
from gbpservice.network.neutronv2 import local_api
from gbpservice.neutron.db.grouppolicy import group_policy_db as gpdb
@ -705,7 +705,7 @@ class ImplicitResourceOperations(local_api.LocalAPI,
try:
self._delete_port(plugin_context, port_id)
except n_exc.PortNotFound:
LOG.warning(_LW("Port %s is missing") % port_id)
LOG.warning(_LW("Port %s is missing"), port_id)
def _reject_invalid_router_access(self, context, clean_session=True):
# Validate if the explicit router(s) belong to the tenant.
@ -2299,14 +2299,14 @@ class ResourceMappingDriver(api.PolicyDriver, ImplicitResourceOperations,
port = self._get_port(context._plugin_context, port_id)
if ('port_security_enabled' in port and
not port['port_security_enabled']):
LOG.debug("Port security disabled for port %s " % port_id)
LOG.debug("Port security disabled for port %s ", port_id)
return
cur_sg_list = port[ext_sg.SECURITYGROUPS]
new_sg_list = cur_sg_list + sg_list
port[ext_sg.SECURITYGROUPS] = new_sg_list
self._update_port(context._plugin_context, port_id, port)
except n_exc.PortNotFound:
LOG.warning(_LW("Port %s is missing") % port_id)
LOG.warning(_LW("Port %s is missing"), port_id)
def _disassoc_sgs_from_pt(self, context, pt_id, sg_list):
try:
@ -2323,14 +2323,14 @@ class ResourceMappingDriver(api.PolicyDriver, ImplicitResourceOperations,
port = self._get_port(plugin_context, port_id)
if ('port_security_enabled' in port and
not port['port_security_enabled']):
LOG.debug("Port security disabled for port %s " % port_id)
LOG.debug("Port security disabled for port %s ", port_id)
return
cur_sg_list = port[ext_sg.SECURITYGROUPS]
new_sg_list = list(set(cur_sg_list) - set(sg_list))
port[ext_sg.SECURITYGROUPS] = new_sg_list
self._update_port(plugin_context, port_id, port)
except n_exc.PortNotFound:
LOG.warning(_LW("Port %s is missing") % port_id)
LOG.warning(_LW("Port %s is missing"), port_id)
def _generate_list_of_sg_from_ptg(self, context, ptg_id):
ptg = context._plugin.get_policy_target_group(

View File

@ -11,14 +11,14 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.common import exceptions as n_exc
from oslo_config import cfg
from oslo_log import log
from oslo_utils import excutils
import stevedore
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice.neutron.services.grouppolicy.common import exceptions as gp_exc

View File

@ -13,8 +13,6 @@
import netaddr
import six
from neutron._i18n import _LE
from neutron._i18n import _LW
from neutron.api.v2 import attributes as nattr
from neutron import context as n_ctx
from neutron.extensions import portbindings
@ -25,6 +23,8 @@ from oslo_log import helpers as log
from oslo_log import log as logging
from oslo_utils import excutils
from gbpservice._i18n import _LE
from gbpservice._i18n import _LW
from gbpservice.common import utils as gbp_utils
from gbpservice.neutron.db.grouppolicy import group_policy_db as gpdb
from gbpservice.neutron.db.grouppolicy import group_policy_mapping_db

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.common import exceptions as n_exc
from oslo_config import cfg
from oslo_log import log
@ -19,6 +17,8 @@ from oslo_policy import policy as oslo_policy
from oslo_utils import excutils
import stevedore
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice.neutron.services.grouppolicy.common import exceptions as gp_exc
from gbpservice.neutron.services.grouppolicy import group_policy_driver_api

View File

@ -13,7 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LW
from neutron.common import constants as q_const
from neutron.common import exceptions as n_exc
from neutron.db import common_db_mixin
@ -25,6 +24,7 @@ from oslo_log import log as logging
LOG = logging.getLogger(__name__)
from gbpservice._i18n import _LW
from gbpservice.neutron.services.l3_router import apic_driver

View File

@ -10,12 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LE
from neutron._i18n import _LI
from oslo_config import cfg
from oslo_log import log
import stevedore
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice.neutron.services.servicechain.common import (
exceptions as sc_exc)

View File

@ -16,8 +16,6 @@ import time
from heatclient import client as heat_client
from heatclient import exc as heat_exc
from keystoneclient.v2_0 import client as keyclient
from neutron._i18n import _LE
from neutron._i18n import _LW
from neutron import manager
from neutron.plugins.common import constants as pconst
from neutron_lib.db import model_base
@ -27,6 +25,8 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils
import sqlalchemy as sa
from gbpservice._i18n import _LE
from gbpservice._i18n import _LW
from gbpservice.neutron.services.servicechain.common import exceptions as exc

View File

@ -10,12 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LE
from neutron.plugins.common import constants as pconst
from oslo_log import helpers as log
from oslo_log import log as logging
from oslo_utils import excutils
from gbpservice._i18n import _LE
import gbpservice.neutron.db.servicechain_db as servicechain_db
from gbpservice.neutron.services.grouppolicy.common import constants as gp_cts
from gbpservice.neutron.services.servicechain.plugins.msc import (

View File

@ -10,12 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LI
from neutron.common import exceptions as n_exc
from oslo_config import cfg
from oslo_log import log as logging
import stevedore
from gbpservice._i18n import _LI
from gbpservice.neutron.services.servicechain.plugins.ncp import config # noqa
from gbpservice.neutron.services.servicechain.plugins.ncp import model

View File

@ -12,7 +12,6 @@
import time
from neutron._i18n import _LE
from neutron.plugins.common import constants as pconst
from neutron_lib.db import model_base
from oslo_config import cfg
@ -21,6 +20,7 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils
import sqlalchemy as sa
from gbpservice._i18n import _LE
from gbpservice.neutron.services.servicechain.plugins.ncp import (
exceptions as exc)
from gbpservice.neutron.services.servicechain.plugins.ncp import driver_base

View File

@ -19,8 +19,6 @@ import threading
from keystoneclient import exceptions as k_exceptions
from keystoneclient.v2_0 import client as keyclient
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.common import exceptions as n_exc
from neutron.common import rpc as n_rpc
from neutron.plugins.common import constants as pconst
@ -33,6 +31,8 @@ from oslo_utils import excutils
import sqlalchemy as sa
from sqlalchemy.orm.exc import NoResultFound
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice.common import utils
from gbpservice.neutron.services.grouppolicy.common import constants as gconst
from gbpservice.neutron.services.servicechain.plugins.ncp import (
@ -193,7 +193,7 @@ class NFPClientApi(object):
def get_network_function(self, context, network_function_id):
LOG.debug("Sending RPC GET NETWORK FUNCTION to Service "
"Orchestrator for NF: %s" % network_function_id)
"Orchestrator for NF: %s", network_function_id)
cctxt = self.client.prepare(version=self.RPC_API_VERSION)
return cctxt.call(
context,
@ -474,7 +474,7 @@ class NFPNodeDriver(driver_base.NodeDriverBase):
def _wait_for_node_operation_completion(self, context, network_function_id,
operation):
# Check for NF status in a separate thread
LOG.debug("Spawning thread for nf ACTIVE poll operation: %s" % (
LOG.debug("Spawning thread for nf ACTIVE poll operation: %s", (
operation))
nfp_context = NFPContext.get_nfp_context(context.instance['id'])
nfp_context['sc_node_count'] -= 1
@ -729,7 +729,7 @@ class NFPNodeDriver(driver_base.NodeDriverBase):
network_function = self.nfp_notifier.get_network_function(
context.plugin_context, network_function_id)
LOG.debug("Got %s nf result for NF: %s with status:%s,"
"time waited: %s" % (network_function_id, operation,
"time waited: %s", (network_function_id, operation,
time_waited, network_function['status']))
if not network_function:
LOG.error(_LE("Failed to retrieve network function"))
@ -898,7 +898,7 @@ class NFPNodeDriver(driver_base.NodeDriverBase):
elif service_target.relationship == nfp_constants.PROVIDER:
provider_service_targets.append(service_target)
LOG.debug("provider targets: %s consumer targets %s" % (
LOG.debug("provider targets: %s consumer targets %s", (
provider_service_targets, consumer_service_targets))
if (service_details['device_type'] != 'None' and (
not provider_service_targets or (service_type in

View File

@ -12,9 +12,9 @@
from heatclient import client as heat_client
from heatclient import exc as heat_exc
from neutron._i18n import _LW
from oslo_log import log as logging
from gbpservice._i18n import _LW
LOG = logging.getLogger(__name__)

View File

@ -12,11 +12,11 @@
from keystoneclient import exceptions as k_exceptions
from keystoneclient.v2_0 import client as keyclient
from neutron._i18n import _LE
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
from gbpservice._i18n import _LE
from gbpservice.common import utils
from gbpservice.neutron.services.servicechain.plugins.ncp.node_plumbers import(
traffic_stitching_plumber as tscp)

View File

@ -10,14 +10,14 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron._i18n import _LW
from neutron.api.v2 import attributes as attr
from neutron import manager
from oslo_config import cfg
from oslo_log import log as logging
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice._i18n import _LW
from gbpservice.neutron.extensions import driver_proxy_group as pg_ext
from gbpservice.neutron.extensions import group_policy
from gbpservice.neutron.services.grouppolicy.common import exceptions as exc

View File

@ -10,8 +10,6 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.plugins.common import constants as pconst
from neutron.quota import resource_registry
from oslo_config import cfg
@ -19,6 +17,8 @@ from oslo_log import helpers as log
from oslo_log import log as logging
from oslo_utils import excutils
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice.common import utils
from gbpservice.neutron.db import servicechain_db
from gbpservice.neutron.services.grouppolicy.common import constants as gp_cts

View File

@ -10,12 +10,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LE
from neutron.api.v2 import attributes as nattr
from neutron import manager as n_manager
from neutron.plugins.common import constants as pconst
from oslo_log import log as logging
from gbpservice._i18n import _LE
from gbpservice.neutron.services.grouppolicy.common import exceptions as gp_exc
from gbpservice.neutron.services.grouppolicy import plugin as gbp_plugin

View File

@ -13,11 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LI
from neutron.tests.unit.plugins.ml2.drivers import (
mechanism_logger as ml2_logger)
from oslo_log import log
from gbpservice._i18n import _LI
from gbpservice.neutron.plugins.ml2plus import driver_api
LOG = log.getLogger(__name__)

View File

@ -13,11 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _
from neutron.api import extensions
from neutron.api.v2 import attributes as attr
from neutron.extensions import address_scope as as_ext
from gbpservice._i18n import _
EXTENDED_ATTRIBUTES_2_0 = {
attr.SUBNETPOOLS: {

View File

@ -10,14 +10,14 @@
# License for the specific language governing permissions and limitations
# under the License.
import six
import sys
from neutron._i18n import _
from neutron._i18n import _LE
from oslo_config import cfg
from oslo_log import log as logging
import six
from gbpservice._i18n import _
from gbpservice._i18n import _LE
LOG = logging.getLogger(__name__)

View File

@ -282,7 +282,7 @@ class NfpController(nfp_launcher.NfpLauncher, NfpService):
event = pipe.recv()
except Exception as exc:
LOG.debug("Failed to receive event from pipe "
"with exception - %r - will retry.." % (exc))
"with exception - %r - will retry..", (exc))
eventlet.greenthread.sleep(1.0)
if event:
self.decompress(event)
@ -324,7 +324,7 @@ class NfpController(nfp_launcher.NfpLauncher, NfpService):
event = self._stashq.popleft()
if self.PROCESS_TYPE != "worker":
evm = self._manager._get_event_manager(event.desc.worker)
LOG.debug("Resending event - %s" % (event.identify()))
LOG.debug("Resending event - %s", (event.identify()))
sent = self.pipe_send(evm._pipe, event, resending=True)
else:
sent = self.pipe_send(self._pipe, event, resending=True)

View File

@ -76,7 +76,7 @@ class TaskExecutor(object):
if result_store is not None:
job.update({'result_store': result_store})
LOG.debug("TaskExecutor - (job - %s) added to pipeline" %
LOG.debug("TaskExecutor - (job - %s) added to pipeline",
(str(job)))
self.pipe_line.append(job)
@ -95,7 +95,7 @@ class TaskExecutor(object):
self.fired = True
for job in self.pipe_line:
LOG.debug(
"TaskExecutor - (job - %s) dispatched" %
"TaskExecutor - (job - %s) dispatched",
(str(job)))
th = self.thread_pool.dispatch(self.dispatch, job)
@ -104,7 +104,7 @@ class TaskExecutor(object):
for job in self.pipe_line:
result = job['thread'].wait()
LOG.debug(
"TaskExecutor - (job - %s) complete" %
"TaskExecutor - (job - %s) complete",
(str(job)))
job.pop('thread')

View File

@ -191,7 +191,7 @@ class NfpResourceManager(NfpProcessManager, NfpEventManager):
if decision == 'schedule':
# Dispatch to a worker
self._dispatch_event(event)
LOG.debug("Watchdog started for event - %s" %
LOG.debug("Watchdog started for event - %s",
(event.identify()))
self._watchdog(event)
elif decision == 'discard':
@ -219,7 +219,7 @@ class NfpResourceManager(NfpProcessManager, NfpEventManager):
def event_expired(self, event=None):
if event:
LOG.debug("Watchdog expired for event - %s" % (event.identify()))
LOG.debug("Watchdog expired for event - %s", (event.identify()))
self._watchdog_map.pop(event.desc.uuid, None)
self._controller.event_complete(event, result='FAILED')
@ -228,7 +228,7 @@ class NfpResourceManager(NfpProcessManager, NfpEventManager):
def _watchdog_cancel(self, event):
try:
LOG.debug("Watchdog cancelled for event - %s" % (event.identify()))
LOG.debug("Watchdog cancelled for event - %s", (event.identify()))
wd = self._watchdog_map.pop(event.desc.uuid)
wd.cancel()
except KeyError:

View File

@ -50,7 +50,7 @@ class RpcService(oslo_service.Service):
self.endpoints = managers or []
def start(self):
LOG.debug("RPCAgent listening on topic=%s" % self.topic)
LOG.debug("RPCAgent listening on topic=%s", self.topic)
super(RpcService, self).start()
self.conn = n_rpc.create_connection()
@ -107,7 +107,7 @@ class RpcAgent(object):
def report_state(self):
if hasattr(self, '_report_state'):
LOG.debug("Agent (%s) reporting state" %
LOG.debug("Agent (%s) reporting state",
(self.identify()))
self._report_state.report()
@ -135,7 +135,7 @@ class ReportState(object):
def report(self):
try:
LOG.debug("Reporting state with data (%s)" %
LOG.debug("Reporting state with data (%s)",
(self._data))
self._state_rpc.report_state(self._n_context, self._data)
self._data.pop('start_flag', None)

View File

@ -11,8 +11,8 @@
# under the License.
from heatclient import client as heat_client
from heatclient import exc as heat_exc
from neutron._i18n import _LW
from gbpservice._i18n import _LW
from gbpservice.nfp.core import log as nfp_logging
LOG = nfp_logging.getLogger(__name__)

View File

@ -15,15 +15,15 @@ import copy
import time
from heatclient import exc as heat_exc
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron._i18n import _LW
from neutron.db import api as db_api
from neutron.plugins.common import constants as pconst
from oslo_config import cfg
from oslo_serialization import jsonutils
import yaml
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice._i18n import _LW
from gbpservice.neutron.services.grouppolicy.common import constants as gconst
from gbpservice.neutron.services.servicechain.plugins.ncp import plumber_base
from gbpservice.nfp.common import constants as nfp_constants
@ -330,7 +330,7 @@ class HeatDriver(object):
break
if not provider_subnet:
LOG.error(_LE("Unable to get provider subnet for provider "
"policy target group %(provider_ptg)s") %
"policy target group %(provider_ptg)s"),
{"provider_ptg": provider})
return lb_vip, lb_vip_name
if service_type == pconst.LOADBALANCER:
@ -802,7 +802,7 @@ class HeatDriver(object):
break
if not provider_cidr:
LOG.error(_LE("Unable to get provider cidr for provider "
"policy target group %(provider_ptg)s") %
"policy target group %(provider_ptg)s"),
{"provider_ptg": provider})
return None
@ -1047,7 +1047,7 @@ class HeatDriver(object):
except Exception:
LOG.error(_LE(
"Unable to load stack template for service chain "
"node: %(node_id)s") % {'node_id': service_chain_node})
"node: %(node_id)s"), {'node_id': service_chain_node})
return None, None
config_param_values = service_chain_instance.get(
'config_param_values', '{}')
@ -1171,7 +1171,7 @@ class HeatDriver(object):
stack_params[parameter] = config_param_values[parameter]
LOG.info(_LI('Final stack_template : %(stack_data)s, '
'stack_params : %(params)s') %
'stack_params : %(params)s'),
{'stack_data': stack_template, 'params': stack_params})
return (stack_template, stack_params)
@ -1470,7 +1470,7 @@ class HeatDriver(object):
stack_params[parameter] = config_param_values[parameter]
LOG.info(_LI('Final stack_template : %(stack_data)s, '
'stack_params : %(params)s') %
'stack_params : %(params)s'),
{'stack_data': stack_template, 'params': stack_params})
return (stack_template, stack_params)
@ -1684,7 +1684,7 @@ class HeatDriver(object):
LOG.error(_LE(
"Stack %(stack_name)s %(action)s not "
"completed within %(time)s seconds where "
"stack owner is %(stack_owner)s") %
"stack owner is %(stack_owner)s"),
{'stack_name': stack.stack_name,
'action': action,
'time': wait_timeout,
@ -2050,7 +2050,7 @@ class HeatDriver(object):
return stack_id
except Exception:
LOG.exception(_LE("Processing policy target %(operation)s "
" failed") % {'operation': operation})
" failed"), {'operation': operation})
return None
def notify_chain_parameters_updated(self, network_function_details):
@ -2087,5 +2087,5 @@ class HeatDriver(object):
except Exception:
LOG.exception(_LE(
"Processing policy target group "
"%(operation)s failed") % {'operation': operation})
"%(operation)s failed"), {'operation': operation})
return None

View File

@ -15,12 +15,12 @@ from oslo_serialization import jsonutils
from oslo_utils import uuidutils
from sqlalchemy.orm import exc
from gbpservice._i18n import _LW
from gbpservice.nfp.common import exceptions as nfp_exc
from gbpservice.nfp.orchestrator.db import common_db_mixin
from gbpservice.nfp.orchestrator.db import nfp_db_model
from gbpservice.nfp.core import log as nfp_logging
from neutron._i18n import _LW
LOG = nfp_logging.getLogger(__name__)
@ -671,7 +671,7 @@ class NFPDbBase(common_db_mixin.CommonDbMixin):
svc_gw.network_function_id == nf_id).one())
except exc.NoResultFound:
LOG.warning(_LW("Gateway detail doesn't exist for Network Function"
" %s ") % nf_id)
" %s "), nf_id)
raise
def _get_gw_info_dict(self, gw):

View File

@ -12,8 +12,8 @@
import ast
from collections import defaultdict
from neutron._i18n import _LE
from neutron._i18n import _LW
from gbpservice._i18n import _LE
from gbpservice._i18n import _LW
from gbpservice.nfp.common import constants as nfp_constants
from gbpservice.nfp.common import data_formatter as df
@ -190,7 +190,7 @@ class OrchestrationDriver(object):
else:
LOG.debug("Provider metadata specified in image, doesn't contains "
"%s value, proceeding with default value "
"%s" % (attr, attr_value))
"%s", (attr, attr_value))
def _update_provider_metadata(self, device_data, token=None):
provider_metadata = {}
@ -198,8 +198,8 @@ class OrchestrationDriver(object):
image_name = self._get_image_name(device_data)
provider_metadata = self._get_provider_metadata(device_data,
image_name)
LOG.debug("Provider metadata, specified in image: %s"
% provider_metadata)
LOG.debug("Provider metadata, specified in image: %s",
provider_metadata)
if provider_metadata:
self._update_self_with_provider_metadata(
provider_metadata,
@ -222,8 +222,8 @@ class OrchestrationDriver(object):
try:
provider_metadata = self._get_provider_metadata_fast(
token, admin_tenant_id, image_name, device_data)
LOG.debug("Provider metadata, specified in image: %s"
% provider_metadata)
LOG.debug("Provider metadata, specified in image: %s",
provider_metadata)
if provider_metadata:
self._update_self_with_provider_metadata(
provider_metadata,
@ -246,8 +246,8 @@ class OrchestrationDriver(object):
else:
LOG.debug("No image name provided in service profile's "
"service flavor field, image will be selected "
"based on service vendor's name : %s"
% (device_data['service_details']['service_vendor']))
"based on service vendor's name : %s",
(device_data['service_details']['service_vendor']))
image_name = device_data['service_details']['service_vendor']
image_name = '%s' % image_name.lower()
device_data['service_details']['image_name'] = image_name

View File

@ -13,6 +13,8 @@
import oslo_messaging as messaging
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice.nfp.common import constants as nfp_constants
from gbpservice.nfp.common import topics as nsf_topics
from gbpservice.nfp.common import utils as nfp_utils
@ -25,8 +27,6 @@ from gbpservice.nfp.lib import transport
from gbpservice.nfp.orchestrator.db import nfp_db as nfp_db
from gbpservice.nfp.orchestrator.drivers import orchestration_driver
from gbpservice.nfp.orchestrator.openstack import openstack_driver
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron.common import rpc as n_rpc
from neutron import context as n_context
from neutron.db import api as db_api
@ -129,7 +129,7 @@ class RpcHandler(object):
serialize=original_event.sequence,
binding_key=original_event.binding_key,
key=original_event.desc.uuid)
LOG.debug("poll event started for %s" % (ev.id))
LOG.debug("poll event started for %s", ev.id)
self._controller.poll_event(ev, max_times=10)
else:
ev = self._controller.new_event(
@ -375,7 +375,7 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler):
serialize=original_event.sequence,
binding_key=original_event.binding_key,
key=original_event.desc.uuid)
LOG.debug("poll event started for %s" % (ev.id))
LOG.debug("poll event started for %s", ev.id)
self._controller.poll_event(ev, max_times=max_times)
else:
ev = self._controller.new_event(
@ -403,7 +403,7 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler):
ev.binding_key = device.get('binding_key')
LOG.debug("Releasing tenant based lock for "
"CREATE_NETWORK_FUNCTION_DEVICE event with binding "
"key: %s" % ev.binding_key)
"key: %s", ev.binding_key)
self._controller.event_complete(ev)
def event_cancelled(self, ev, reason):
@ -920,8 +920,8 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler):
"Configuration completed for device with NFD:%(device_id)s. "
"Updated DB status to ACTIVE."),
{'device_id': network_function_device['id']})
LOG.debug("Device detail:%s"
% network_function_device)
LOG.debug("Device detail:%s",
network_function_device)
# Release CNFD Event lock
self._release_cnfd_lock(device)
self._post_configure_device_graph(nfp_context,
@ -986,7 +986,7 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler):
device,
clear_hm_req)
LOG.debug("Clear HM RPC sent to configurator for device: "
"%s with parameters: %s" % (
"%s with parameters: %s", (
device['id'], clear_hm_req))
self._controller.event_complete(event, result="SUCCESS")
@ -1009,7 +1009,7 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler):
self.configurator_rpc.create_network_function_device_config(device,
hm_req)
LOG.debug("Health Check RPC sent to configurator for device: "
"%s with health check parameters: %s" % (
"%s with health check parameters: %s", (
device['id'], hm_req))
self._controller.event_complete(event, result="SUCCESS")
@ -1026,7 +1026,7 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler):
self.configurator_rpc.create_network_function_device_config(device,
hm_req)
LOG.debug("Health Check RPC sent to configurator for device: "
"%s with health check parameters: %s" % (
"%s with health check parameters: %s", (
device['id'], hm_req))
def _get_service_type(self, service_profile_id):
@ -1538,7 +1538,7 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler):
# self._create_event(event_id='DEVICE_CREATE_FAILED',
# event_data=event.data)
LOG.debug("Device create failed for device: %s, with "
"data: %s" % (device['id'], device))
"data: %s", (device['id'], device))
self.device_configuration_complete(event, result='FAILED')
def handle_interfaces_setup_failed(self, event):
@ -1550,7 +1550,7 @@ class DeviceOrchestrator(nfp_api.NfpEventHandler):
self._create_event(event_id='DEVICE_CREATE_FAILED',
event_data=device)
LOG.debug("Interface Plugging failed for device: %s,"
"with config: %s" % (device['id'], device))
"with config: %s", (device['id'], device))
def handle_driver_error(self, event):
device = event.data

View File

@ -10,15 +10,15 @@
# License for the specific language governing permissions and limitations
# under the License.
from neutron._i18n import _LE
from neutron._i18n import _LI
from neutron._i18n import _LW
from neutron.common import rpc as n_rpc
from neutron import context as n_context
from neutron.db import api as db_api
from oslo_log import helpers as log_helpers
import oslo_messaging
from gbpservice._i18n import _LE
from gbpservice._i18n import _LI
from gbpservice._i18n import _LW
from gbpservice.nfp.common import constants as nfp_constants
from gbpservice.nfp.common import exceptions as nfp_exc
from gbpservice.nfp.common import topics as nfp_rpc_topics
@ -136,8 +136,8 @@ class RpcHandler(object):
def get_network_function(self, context, network_function_id):
'''Invoked in an RPC Call. Return the Network function DB object'''
module_context.init()
LOG.debug("Received RPC call for GET NETWORK FUNCTION for NFI %s"
% network_function_id)
LOG.debug("Received RPC call for GET NETWORK FUNCTION for NFI %s",
network_function_id)
service_orchestrator = ServiceOrchestrator(self._controller, self.conf)
return service_orchestrator.get_network_function(
@ -261,8 +261,8 @@ class RpcHandler(object):
'''
module_context.init()
LOG.debug("Received RPC call for GET NETWORK FUNCTION DETAILS in "
"for NF:%s"
% network_function_id)
"for NF:%s",
network_function_id)
service_orchestrator = ServiceOrchestrator(self._controller, self.conf)
return service_orchestrator.get_network_function_details(
network_function_id)
@ -272,8 +272,8 @@ class RpcHandler(object):
'''Invoked in an RPC Call. Return the Port Info Details object'''
module_context.init()
LOG.debug("Received RPC call for GET PORT INFO in "
"for PORT ID:%s"
% port_id)
"for PORT ID:%s",
port_id)
service_orchestrator = ServiceOrchestrator(self._controller, self.conf)
return service_orchestrator.get_port_info(port_id)
@ -284,8 +284,8 @@ class RpcHandler(object):
'''
module_context.init()
LOG.debug("Received RPC call for GET NETWORK FUNCTION CONTEXT in "
"for NF:%s"
% network_function_id)
"for NF:%s",
network_function_id)
service_orchestrator = ServiceOrchestrator(self._controller, self.conf)
return service_orchestrator.get_network_function_context(
network_function_id)
@ -294,8 +294,8 @@ class RpcHandler(object):
def get_plumbing_info(self, context, request_info):
module_context.init()
LOG.debug("Received RPC call for GET PLUMBING INFO "
"for request info:%s"
% request_info)
"for request info:%s",
request_info)
service_orchestrator = ServiceOrchestrator(self._controller, self.conf)
return service_orchestrator.get_pt_info_for_plumbing(request_info)
@ -350,7 +350,7 @@ class RpcHandlerConfigurator(object):
serialize=original_event.sequence,
binding_key=original_event.binding_key,
key=original_event.key)
LOG.debug("poll event started for %s" % (ev.id))
LOG.debug("poll event started for %s", (ev.id))
self._controller.poll_event(ev, max_times=10)
else:
if serialize:
@ -723,7 +723,7 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler):
serialize=original_event.sequence,
binding_key=original_event.binding_key,
key=original_event.desc.uuid)
LOG.debug("poll event started for %s" % (ev.id))
LOG.debug("poll event started for %s", (ev.id))
self._controller.poll_event(ev, max_times=max_times)
else:
if original_event:
@ -1226,13 +1226,13 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler):
LOG.debug("Acquiring tenant based lock for "
"CREATE_NETWORK_FUNCTION_DEVICE event with binding "
"key: %s, sequence: %s" % (
"key: %s, sequence: %s", (
ev.binding_key, ev.sequence))
self._controller.post_event(ev)
if event.binding_key and not nfp_context.get('is_nfi_in_graph'):
LOG.debug("Releasing lock for CREATE_NETWORK_FUNCTION_INSTANCE"
" event for gateway services sharing with binding key:"
" %s" % event.binding_key)
" %s", event.binding_key)
self._controller.event_complete(event)
def handle_device_created(self, event):
@ -1321,8 +1321,8 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler):
return
request_data['tenant_id'] = network_function['tenant_id']
request_data['network_function_details'] = network_function_details
LOG.debug("handle_device_active config_policy_id: %s"
% (request_data['config_policy_id']))
LOG.debug("handle_device_active config_policy_id: %s",
request_data['config_policy_id'])
with nfp_ctx_mgr.DbContextManager as dcm:
dcm.lock(self.db_session, self.db_handler.update_network_function,
network_function['id'],
@ -1422,8 +1422,8 @@ class ServiceOrchestrator(nfp_api.NfpEventHandler):
self._controller.event_complete(event, result='FAILED')
return
LOG.debug("handle_device_active config_policy_id: %s"
% (nfp_context['config_policy_id']))
LOG.debug("handle_device_active config_policy_id: %s",
nfp_context['config_policy_id'])
nfp_context['network_function'].update(
{'config_policy_id': nfp_context['config_policy_id']})
with nfp_ctx_mgr.DbContextManager as dcm:
@ -2591,8 +2591,8 @@ class NSOConfiguratorRpcApi(object):
config_params, operation='create')
LOG.info(_LI("Sending create heat config request to configurator "))
LOG.debug("Sending create heat config request to configurator "
"with config_params = %s"
% config_params)
"with config_params = %s",
config_params)
transport.send_request_to_configurator(self.conf,
self.context,
@ -2608,8 +2608,8 @@ class NSOConfiguratorRpcApi(object):
config_params, operation='delete')
LOG.info(_LI("Sending delete heat config request to configurator "))
LOG.debug("Sending delete heat config request to configurator "
" with config_params = %s"
% config_params)
" with config_params = %s",
config_params)
transport.send_request_to_configurator(self.conf,
self.context,
config_params,

View File

@ -771,8 +771,8 @@ class NeutronClient(OpenstackApi):
"port_id": None}
}
self._update_floatingip(token, floatingip_id, info)
LOG.debug("Successfully disassociated floatingip %s"
% floatingip_id)
LOG.debug("Successfully disassociated floatingip %s",
floatingip_id)
def associate_floating_ip(self, token, floatingip_id, port_id):
"""
@ -788,8 +788,8 @@ class NeutronClient(OpenstackApi):
}
self._update_floatingip(token, floatingip_id, info)
LOG.debug("Successfully associated floatingip %s"
% floatingip_id)
LOG.debug("Successfully associated floatingip %s",
floatingip_id)
def list_ports(self, token, port_ids=None, **kwargs):
"""

View File

@ -53,7 +53,7 @@ class Controller(rest.RestController):
out2 = subprocess.Popen('dhclient eth0', shell=True,
stdout=subprocess.PIPE).stdout.read()
output = "%s\n%s\n%s" % (ip_a, out1, out2)
LOG.info(_LI("Dhclient on eth0, result: %(output)s") %
LOG.info(_LI("Dhclient on eth0, result: %(output)s"),
{'output': output})
except Exception as err:
msg = (
@ -161,7 +161,7 @@ class Controller(rest.RestController):
def _configure_healthmonitor(self, config_data):
LOG.info(_LI("Configures healthmonitor with configuration "
"data : %(healthmonitor_data)s ") %
"data : %(healthmonitor_data)s "),
{'healthmonitor_data': config_data})
def _configure_interfaces(self, config_data):
@ -172,10 +172,10 @@ class Controller(rest.RestController):
out3 = subprocess.Popen('cat /etc/network/interfaces', shell=True,
stdout=subprocess.PIPE).stdout.read()
output = "%s\n%s\n%s" % (out1, out2, out3)
LOG.info(_LI("Dhclient on eth0, result: %(initial_data)s") %
LOG.info(_LI("Dhclient on eth0, result: %(initial_data)s"),
{'initial_data': output})
LOG.info(_LI("Configures interfaces with configuration "
"data : %(interface_data)s ") %
"data : %(interface_data)s "),
{'interface_data': config_data})
def get_source_cidrs_and_gateway_ip(self, route_info):
@ -190,7 +190,7 @@ class Controller(rest.RestController):
def _add_routes(self, route_info):
LOG.info(_LI("Configuring routes with configuration "
"data : %(route_data)s ") %
"data : %(route_data)s "),
{'route_data': route_info['resource_data']})
source_cidrs, gateway_ip = self.get_source_cidrs_and_gateway_ip(
route_info)
@ -205,7 +205,7 @@ class Controller(rest.RestController):
interface_number_string = source_interface.split("eth", 1)[1]
except IndexError:
LOG.error(_LE("Retrieved wrong interface %(interface)s for "
"configuring routes") %
"configuring routes"),
{'interface': source_interface})
try:
routing_table_number = 20 + int(interface_number_string)
@ -221,7 +221,7 @@ class Controller(rest.RestController):
routing_table_number, gateway_ip)
default_route_commands.append(ip_route_command)
output = "%s\n%s" % (out1, out2)
LOG.info(_LI("Static route configuration result: %(output)s") %
LOG.info(_LI("Static route configuration result: %(output)s"),
{'output': output})
except Exception as ex:
raise Exception("Failed to add static routes: %(ex)s" % {
@ -230,7 +230,7 @@ class Controller(rest.RestController):
try:
out = subprocess.Popen(command, shell=True,
stdout=subprocess.PIPE).stdout.read()
LOG.info(_LI("Static route configuration result: %(output)s") %
LOG.info(_LI("Static route configuration result: %(output)s"),
{'output': out})
except Exception as ex:
raise Exception("Failed to add static routes: %(ex)s" % {
@ -270,7 +270,7 @@ class Controller(rest.RestController):
def _apply_user_config(self, config_data):
LOG.info(_LI("Applying user config with configuration "
"type : %(config_type)s and "
"configuration data : %(config_data)s ") %
"configuration data : %(config_data)s "),
{'config_type': config_data['resource'],
'config_data': config_data['resource_data']})
service_config = config_data['resource_data'][

View File

@ -60,7 +60,7 @@ class ConfigureIPtables(object):
LOG.info(_LI("Updating chain with new rules ..."))
count = 0
for rule in self.rules_json.get('rules'):
LOG.info(_LI("adding rule %(count)d") % {'count': count})
LOG.info(_LI("adding rule %(count)d"), {'count': count})
try:
action_values = ["LOG", "ACCEPT"]
action = rule['action'].upper()
@ -82,15 +82,15 @@ class ConfigureIPtables(object):
"-j", action], stdout=PIPE)
output = ps.communicate()[0]
if output:
LOG.error(_LE("Unable to add rule to chain due to: %(output)s")
% {'output': output})
LOG.error(_LE("Unable to add rule to chain due to: %(msg)s"),
{'msg': output})
count = count + 1
ps = Popen(["iptables", "-A", "testchain", "-m", "state", "--state",
"ESTABLISHED,RELATED", "-j", "ACCEPT"], stdout=PIPE)
output = ps.communicate()[0]
if output:
LOG.error(_LE("Unable to add rule to chain due to: %(output)s")
% {'output': output})
LOG.error(_LE("Unable to add rule to chain due to: %(output)s"),
{'output': output})
def main():

View File

@ -88,7 +88,7 @@ commands = python setup.py build_sphinx
# N325 Python 3: Do not use xrange
# N326 Python 3: do not use basestring
# N327 Python 3: do not use dict.iteritems
ignore = E125,E126,E128,E129,E251,E265,E713,F402,F811,F812,H104,H237,H305,H307,H401,H402,H404,H405,H904,N324,N325,N340,N341,N342,N343
ignore = E125,E126,E128,E129,E251,E265,E713,F402,F811,F812,H104,H237,H305,H307,H401,H402,H404,H405,H904,N324,N325,N326,N327,N341,N343
show-source = true
builtins = _
exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools,.ropeproject,rally-scenarios,