except Exception:
self.needs_resync = True
LOG.exception(_('Unable to sync network state on deleted '
- 'network %s') % deleted_id)
+ 'network %s'), deleted_id)
for network in active_networks:
pool.spawn_n(self.configure_dhcp_for_network, network)
class InvalidContentType(NeutronException):
- message = "Invalid content type %(content_type)s"
+ message = _("Invalid content type %(content_type)s")
class ExternalIpAddressExhausted(BadRequest):
host = kwargs.get('host')
LOG.warning(_('Updating lease expiration is now deprecated. Issued '
- 'from host %(host)s.') % host)
+ 'from host %s.'), host)
def create_dhcp_port(self, context, **kwargs):
"""Create the dhcp port."""
context, router['id'])
added, removed = utils.diff_list_of_dict(old_routes,
routes)
- LOG.debug('Added routes are %s' % added)
+ LOG.debug(_('Added routes are %s'), added)
for route in added:
router_routes = RouterRoute(
router_id=router['id'],
nexthop=route['nexthop'])
context.session.add(router_routes)
- LOG.debug('Removed routes are %s' % removed)
+ LOG.debug(_('Removed routes are %s'), removed)
for route in removed:
del_context = context.session.query(RouterRoute)
del_context.filter_by(router_id=router['id'],
def _ensure_host_set_on_ports(self, context, plugin, host, routers):
for router in routers:
- LOG.debug("checking router: %s for host: %s" %
- (router['id'], host))
+ LOG.debug(_("Checking router: %(id)s for host: %(host)s"),
+ {'id': router['id'], 'host': host})
self._ensure_host_set_on_port(context, plugin, host,
router.get('gw_port'))
for interface in router.get(constants.INTERFACE_KEY, []):
parser.add_argument(
'--device-owner',
default='network', choices=['network', 'compute'],
- help=_('owner type of the device: network/compute'))
+ help=_('Owner type of the device: network/compute'))
return parser
def run(self, parsed_args):
"""
immutable = (NETWORK_TYPE, PHYSICAL_NETWORK, SEGMENTATION_ID)
if any(attributes.is_attr_set(attrs.get(a)) for a in immutable):
- msg = _("plugin does not support updating provider attributes")
+ msg = _("Plugin does not support updating provider attributes")
raise q_exc.InvalidInput(error_message=msg)
SUCCESS_CODES = range(200, 207)
FAILURE_CODES = [0, 301, 302, 303, 400, 401, 403, 404, 500, 501, 502, 503,
504, 505]
-SYNTAX_ERROR_MESSAGE = 'Syntax error in server config file, aborting plugin'
+SYNTAX_ERROR_MESSAGE = _('Syntax error in server config file, aborting plugin')
BASE_URI = '/networkService/v1.1'
ORCHESTRATION_SERVICE_ID = 'Neutron v2.0'
METADATA_SERVER_IP = '169.254.169.254'
timeout = server_timeout
# validate config
- assert servers is not None, 'Servers not defined. Aborting plugin'
+ assert servers is not None, _('Servers not defined. Aborting plugin')
servers = tuple(s.rsplit(':', 1) for s in servers.split(','))
servers = tuple((server, int(port)) for server, port in servers)
assert all(len(s) == 2 for s in servers), SYNTAX_ERROR_MESSAGE
# we will first get the interface identifier before deleting in the DB
if not interface_info:
- msg = "Either subnet_id or port_id must be specified"
+ msg = _("Either subnet_id or port_id must be specified")
raise exceptions.BadRequest(resource='router', msg=msg)
if 'port_id' in interface_info:
port = self._get_port(context, interface_info['port_id'])
subnet = self._get_subnet(context, interface_info['subnet_id'])
interface_id = subnet['network_id']
else:
- msg = "Either subnet_id or port_id must be specified"
+ msg = _("Either subnet_id or port_id must be specified")
raise exceptions.BadRequest(resource='router', msg=msg)
with context.session.begin(subtransactions=True):
payload = {'subnet': updated_subnet}
self._dhcp_agent_notifier.notify(context, payload,
'subnet.update.end')
- LOG.debug("Adding host route: ")
- LOG.debug("destination:%s nexthop:%s" % (destination,
- nexthop))
+ LOG.debug(_("Adding host route: "))
+ LOG.debug(_("Destination:%(dst)s nexthop:%(next)s"),
+ {'dst': destination, 'next': nexthop})
def _get_network_with_floatingips(self, network, context=None):
if context is None:
router_db,
r['router_rules'])
else:
- LOG.debug('No rules in router')
+ LOG.debug(_('No rules in router'))
router_db['router_rules'] = self._get_router_rules_by_router_id(
context, router_db['id'])
del_context = context.session.query(RouterRule)
del_context.filter_by(router_id=router['id']).delete()
context.session.expunge_all()
- LOG.debug('Updating router rules to %s' % rules)
+ LOG.debug(_('Updating router rules to %s'), rules)
for rule in rules:
router_rule = RouterRule(
router_id=router['id'],
LOG.debug(_("Returning the allocated vlan (%d) to the pool"),
vlan_id)
self._vlan_bitmap.release_vlan(int(vlan_id))
- raise Exception("Brocade plugin raised exception, check logs")
+ raise Exception(_("Brocade plugin raised exception, "
+ "check logs"))
brocade_db.create_network(context, net_uuid, vlan_id)
self._process_l3_create(context, net, network['network'])
# Proper formatting
LOG.warning(_("Brocade NOS driver:"))
LOG.warning(_("%s"), e)
- raise Exception("Brocade plugin raised exception, check logs")
+ raise Exception(_("Brocade plugin raised exception, "
+ "check logs"))
# now ok to delete the network
brocade_db.delete_network(context, net_id)
# Proper formatting
LOG.warning(_("Brocade NOS driver:"))
LOG.warning(_("%s"), e)
- raise Exception("Brocade plugin raised exception, check logs")
+ raise Exception(_("Brocade plugin raised exception, "
+ "check logs"))
# save to brocade persistent db
brocade_db.create_port(context, port_id, network_id,
cfg.StrOpt('provider_vlan_name_prefix', default='p-',
help=_("VLAN Name prefix for provider vlans")),
cfg.BoolOpt('provider_vlan_auto_create', default=True,
- help='Provider VLANs are automatically created as needed '
- 'on the Nexus switch'),
+ help=_('Provider VLANs are automatically created as needed '
+ 'on the Nexus switch')),
cfg.BoolOpt('provider_vlan_auto_trunk', default=True,
- help='Provider VLANs are automatically trunked as needed '
- 'on the ports of the Nexus switch'),
+ help=_('Provider VLANs are automatically trunked as needed '
+ 'on the ports of the Nexus switch')),
cfg.BoolOpt('svi_round_robin', default=False,
help=_("Distribute SVI interfaces over all switches")),
cfg.StrOpt('model_class',
read_ok = multi_parser.read(CONF.config_file)
if len(read_ok) != len(CONF.config_file):
- raise cfg.Error("Some config files were not parsed properly")
+ raise cfg.Error(_("Some config files were not parsed properly"))
for parsed_file in multi_parser.parsed:
for parsed_item in parsed_file.keys():
filter_by(allocated=False))
for alloc in allocs:
if alloc.vxlan_id in vxlan_ids:
- LOG.debug(_("Removing vxlan %s from pool") %
+ LOG.debug(_("Removing vxlan %s from pool"),
alloc.vxlan_id)
db_session.delete(alloc)
one())
if alloc.allocated:
raise c_exc.VxlanIdInUse(vxlan_id=vxlan_id)
- LOG.debug(_("Reserving specific vxlan %s from pool") % vxlan_id)
+ LOG.debug(_("Reserving specific vxlan %s from pool"), vxlan_id)
except exc.NoResultFound:
- LOG.debug(_("Reserving specific vxlan %s outside pool") % vxlan_id)
+ LOG.debug(_("Reserving specific vxlan %s outside pool"), vxlan_id)
alloc = n1kv_models_v2.N1kvVxlanAllocation(vxlan_id=vxlan_id)
db_session.add(alloc)
alloc.allocated = True
def create_profile_binding(tenant_id, profile_id, profile_type):
"""Create Network/Policy Profile association with a tenant."""
if profile_type not in ["network", "policy"]:
- raise q_exc.NeutronException("Invalid profile type")
+ raise q_exc.NeutronException(_("Invalid profile type"))
if _profile_binding_exists(tenant_id, profile_id, profile_type):
return get_profile_binding(tenant_id, profile_id)
db_session.delete(binding)
except c_exc.ProfileTenantBindingNotFound:
LOG.debug(_("Profile-Tenant binding missing for profile ID "
- "%(profile_id)s and tenant ID %(tenant_id)s") %
+ "%(profile_id)s and tenant ID %(tenant_id)s"),
{"profile_id": profile_id, "tenant_id": tenant_id})
return
:param network_profile: network profile object
"""
if not re.match(r"(\d+)\-(\d+)", network_profile["segment_range"]):
- msg = _("invalid segment range. example range: 500-550")
+ msg = _("Invalid segment range. example range: 500-550")
raise q_exc.InvalidInput(error_message=msg)
def _validate_network_profile(self, net_p):
:param net_p: network profile object
"""
if any(net_p[arg] == "" for arg in ["segment_type"]):
- msg = _("arguments segment_type missing"
+ msg = _("Arguments segment_type missing"
" for network profile")
LOG.exception(msg)
raise q_exc.InvalidInput(error_message=msg)
raise q_exc.InvalidInput(error_message=msg)
if segment_type == c_const.NETWORK_TYPE_VLAN:
if "physical_network" not in net_p:
- msg = _("argument physical_network missing "
+ msg = _("Argument physical_network missing "
"for network profile")
LOG.exception(msg)
raise q_exc.InvalidInput(error_message=msg)
if segment_type in [c_const.NETWORK_TYPE_TRUNK,
c_const.NETWORK_TYPE_OVERLAY]:
if "sub_type" not in net_p:
- msg = _("argument sub_type missing "
+ msg = _("Argument sub_type missing "
"for network profile")
LOG.exception(msg)
raise q_exc.InvalidInput(error_message=msg)
if segment_type in [c_const.NETWORK_TYPE_VLAN,
c_const.NETWORK_TYPE_OVERLAY]:
if "segment_range" not in net_p:
- msg = _("argument segment_range missing "
+ msg = _("Argument segment_range missing "
"for network profile")
LOG.exception(msg)
raise q_exc.InvalidInput(error_message=msg)
(profile_seg_min <= seg_max <= profile_seg_max) or
((seg_min <= profile_seg_min) and
(seg_max >= profile_seg_max))):
- msg = _("segment range overlaps with another profile")
+ msg = _("Segment range overlaps with another profile")
LOG.exception(msg)
raise q_exc.InvalidInput(error_message=msg)
cdb.add_provider_network(network_id,
const.NETWORK_TYPE_VLAN,
provider_vlan_id)
- LOG.debug(_("provider network added to DB: %(network_id)s, "
- "%(vlan_id)s"), {'network_id': network_id,
- 'vlan_id': provider_vlan_id})
+ LOG.debug(_("Provider network added to DB: %(network_id)s, "
+ "%(vlan_id)s"),
+ {'network_id': network_id, 'vlan_id': provider_vlan_id})
return ovs_output[0]
def update_network(self, context, id, network):
self._func_name(),
args)
if cdb.remove_provider_network(id):
- LOG.debug(_("provider network removed from DB: %s"), id)
+ LOG.debug(_("Provider network removed from DB: %s"), id)
return ovs_output[0]
def get_network(self, context, id, fields=None):
:param network_profile: network profile dict
"""
- LOG.debug(_("logical network"))
+ LOG.debug(_("Logical network"))
body = {'name': network_profile['name']}
return self._post(self.logical_networks_path,
body=body)
elif type(data) is dict:
return wsgi.Serializer().serialize(data, self._set_content_type())
else:
- raise Exception("unable to serialize object of type = '%s'" %
+ raise Exception(_("Unable to serialize object of type = '%s'") %
type(data))
def _deserialize(self, data, status_code):
if network_type == c_const.NETWORK_TYPE_VLAN:
if physical_network_set:
if physical_network not in self.network_vlan_ranges:
- msg = (_("unknown provider:physical_network %s"),
+ msg = (_("Unknown provider:physical_network %s") %
physical_network)
raise q_exc.InvalidInput(error_message=msg)
elif 'default' in self.network_vlan_ranges:
return
# TBD : Need to handle provider network updates
- msg = _("plugin does not support updating provider attributes")
+ msg = _("Plugin does not support updating provider attributes")
raise q_exc.InvalidInput(error_message=msg)
def _get_cluster(self, segment1, segment2, clusters):
self._add_dummy_profile_only_if_testing(network)
profile_id = self._process_network_profile(context, network['network'])
segment_pairs = None
- LOG.debug(_('create network: profile_id=%s'), profile_id)
+ LOG.debug(_('Create network: profile_id=%s'), profile_id)
session = context.session
with session.begin(subtransactions=True):
if not network_type:
segment_pairs = (
self._parse_multi_segments(context, network['network'],
n1kv_profile.SEGMENT_ADD))
- LOG.debug(_('seg list %s '), segment_pairs)
+ LOG.debug(_('Seg list %s '), segment_pairs)
elif network_type == c_const.NETWORK_TYPE_TRUNK:
network_profile = self.get_network_profile(context,
profile_id)
physical_network,
network_profile['sub_type']
))
- LOG.debug(_('seg list %s '), segment_pairs)
+ LOG.debug(_('Seg list %s '), segment_pairs)
else:
if not segmentation_id:
raise q_exc.TenantNetworksDisabled()
if profile_id_set:
profile_id = self._process_policy_profile(context,
port['port'])
- LOG.debug(_('create port: profile_id=%s'), profile_id)
+ LOG.debug(_('Create port: profile_id=%s'), profile_id)
session = context.session
with session.begin(subtransactions=True):
pt = super(N1kvNeutronPluginV2, self).create_port(context,
else:
# Must make sure we re-raise the error that led us here, since
# otherwise getattr() and even hasattr() doesn't work corretly.
- raise AttributeError("'%s' object has no attribute '%s'" %
- (self._model, name))
+ raise AttributeError(
+ _("'%(model)s' object has no attribute '%(name)s'") %
+ {'model': self._model, 'name': name})
def _extend_fault_map(self):
"""Extend the Neutron Fault Map for Cisco exceptions.
except cisco_exc.NexusPortBindingNotFound:
if auto_create and auto_trunk:
# Create vlan and trunk vlan on the port
- LOG.debug("Nexus: create & trunk vlan %s" % vlan_name)
+ LOG.debug(_("Nexus: create & trunk vlan %s"), vlan_name)
self._client.create_and_trunk_vlan(
switch_ip, vlan_id, vlan_name, etype, port_id)
vlan_created = True
vlan_trunked = True
elif auto_create:
# Create vlan but do not trunk it on the port
- LOG.debug("Nexus: create vlan %s" % vlan_name)
+ LOG.debug(_("Nexus: create vlan %s"), vlan_name)
self._client.create_vlan(switch_ip, vlan_id, vlan_name)
vlan_created = True
elif auto_trunk:
# Only trunk vlan on the port
- LOG.debug("Nexus: trunk vlan %s" % vlan_name)
+ LOG.debug(_("Nexus: trunk vlan %s"), vlan_name)
self._client.enable_vlan_on_trunk_int(
switch_ip, vlan_id, etype, port_id)
vlan_trunked = True
with excutils.save_and_reraise_exception():
# Add binding failed, roll back any vlan creation/enabling
if vlan_created and vlan_trunked:
- LOG.debug("Nexus: delete & untrunk vlan %s" %
+ LOG.debug(_("Nexus: delete & untrunk vlan %s"),
vlan_name)
self._client.delete_and_untrunk_vlan(switch_ip,
vlan_id,
etype, port_id)
elif vlan_created:
- LOG.debug("Nexus: delete vlan %s" % vlan_name)
+ LOG.debug(_("Nexus: delete vlan %s"), vlan_name)
self._client.delete_vlan(switch_ip, vlan_id)
elif vlan_trunked:
- LOG.debug("Nexus: untrunk vlan %s" % vlan_name)
+ LOG.debug(_("Nexus: untrunk vlan %s"), vlan_name)
self._client.disable_vlan_on_trunk_int(switch_ip,
vlan_id,
etype,
if cdb.is_provider_vlan(vlan_id):
auto_delete = conf.CISCO.provider_vlan_auto_create
auto_untrunk = conf.CISCO.provider_vlan_auto_trunk
- LOG.debug("delete_network(): provider vlan %s" % vlan_id)
+ LOG.debug(_("delete_network(): provider vlan %s"), vlan_id)
instance_id = False
for row in rows:
"device_owner": ["network:router_gateway"]})
if len(gw_ports) != 1:
raise c_exc.EmbranePluginException(
- err_msg=_("there must be only one gateway port "
+ err_msg=_("There must be only one gateway port "
"per router at once"))
gw_port = gw_ports[0]
"device_owner": ["network:router_gateway"]})
if len(gw_ports) != 1:
raise c_exc.EmbranePluginException(
- err_msg=_("there must be only one gateway port"
- " per router at once"))
+ err_msg=_("There must be only one gateway port "
+ "per router at once"))
gw_port = gw_ports[0]
utif_info = (self._plugin_support.retrieve_utif_info(context,
cfg.StrOpt('resource_pool_id', default='default',
help=_('Shared resource pool id')),
cfg.BoolOpt('async_requests', default=True,
- help=_('define if the requests have '
+ help=_('Define if the requests have '
'run asynchronously or not')),
]
class UtifInfoError(embrane_exc.EmbranePluginException):
- message = _("cannot retrieve utif info for the following reason: "
+ message = _("Cannot retrieve utif info for the following reason: "
"%(err_msg)s")
def _treat_devices_added(self, devices):
resync = False
for device in devices:
- LOG.info(_("Adding port %s") % device)
+ LOG.info(_("Adding port %s"), device)
try:
device_details = self.plugin_rpc.get_device_details(
self.context,
device,
self.agent_id)
except Exception as e:
- LOG.debug(_(
- "Unable to get port details for device %(device)s: %(e)s"),
- dict(device=device, e=e))
+ LOG.debug(
+ _("Unable to get port details for "
+ "device %(device)s: %(e)s"),
+ {'device': device, 'e': e})
resync = True
continue
if 'port_id' in device_details:
- LOG.info(_(
- "Port %(device)s updated. Details: %(device_details)s") %
- dict(device=device, device_details=device_details))
+ LOG.info(
+ _("Port %(device)s updated. Details: %(device_details)s"),
+ {'device': device, 'device_details': device_details})
self._treat_vif_port(
device_details['port_id'],
device_details['network_id'],
desc = job.Description
elap = job.ElapsedTime
- LOG.debug(_("WMI job succeeded: %(desc)s, Elapsed=%(elap)s") %
+ LOG.debug(_("WMI job succeeded: %(desc)s, Elapsed=%(elap)s"),
{'desc': desc, 'elap': elap})
def _create_switch_port(self, vswitch_name, switch_port_name):
hyper_opts = [
cfg.BoolOpt('force_hyperv_utils_v1',
default=False,
- help='Force V1 WMI utility classes'),
+ help=_('Force V1 WMI utility classes')),
]
CONF = cfg.CONF
cls = v2_class
else:
cls = v1_class
- LOG.debug("Loading class: %(module_name)s.%(class_name)s",
+ LOG.debug(_("Loading class: %(module_name)s.%(class_name)s"),
{'module_name': cls.__module__, 'class_name': cls.__name__})
return cls
self.agent_state)
self.agent_state.pop('start_flag', None)
except Exception:
- LOG.exception("Failed reporting state!")
+ LOG.exception(_("Failed reporting state!"))
def setup_rpc(self, physical_interfaces):
if physical_interfaces:
mac = utils.get_interface_mac(devices[0].name)
else:
LOG.error(_("Unable to obtain MAC address for unique ID. "
- "Agent terminated!"))
+ "Agent terminated!"))
exit(1)
self.agent_id = '%s%s' % ('lb', (mac.replace(":", "")))
LOG.info(_("RPC agent_id: %s"), self.agent_id)
{'bridge': bridge})
dhcp = bridge.get_dhcp_subnets()
if not dhcp:
- raise MidonetApiException(msg="Tried to delete non-existent DHCP")
+ raise MidonetApiException(
+ msg=_("Tried to delete non-existent DHCP"))
dhcp[0].delete()
@handle_api_error
read_ok = multi_parser.read(cfg.CONF.config_file)
if len(read_ok) != len(cfg.CONF.config_file):
- raise cfg.Error("Some config files were not parsed properly")
+ raise cfg.Error(_("Some config files were not parsed properly"))
for parsed_file in multi_parser.parsed:
for parsed_item in parsed_file.keys():
LOG = logging.getLogger(__name__)
-EOS_UNREACHABLE_MSG = 'Unable to reach EOS'
+EOS_UNREACHABLE_MSG = _('Unable to reach EOS')
class AristaRPCWrapper(object):
ret = ret[len(command_start):-len(command_end)]
except Exception as error:
host = cfg.CONF.ml2_arista.eapi_host
- msg = ('Error %s while trying to execute commands %s on EOS %s' %
- (error, full_command, host))
- LOG.exception(_("%s"), msg)
+ msg = (_('Error %(err)s while trying to execute '
+ 'commands %(cmd)s on EOS %(host)s') %
+ {'err': error, 'cmd': full_command, 'host': host})
+ LOG.exception(msg)
raise arista_exc.AristaRpcError(msg=msg)
return ret
def synchronize(self):
"""Sends data to EOS which differs from neutron DB."""
- LOG.info('Syncing Neutron <-> EOS')
+ LOG.info(_('Syncing Neutron <-> EOS'))
try:
eos_tenants = self._rpc.get_tenants()
except arista_exc.AristaRpcError:
tunnel_ip = kwargs.get('tunnel_ip')
tunnel_type = kwargs.get('tunnel_type')
if not tunnel_type:
- msg = "network_type value needed by the ML2 plugin"
+ msg = _("Network_type value needed by the ML2 plugin")
raise exc.InvalidInput(error_message=msg)
driver = self.type_manager.drivers.get(tunnel_type)
if driver:
physical_network, segmentation_id):
LOG.info(_("Provisioning network %s"), network_id)
if network_type == constants.TYPE_VLAN:
- LOG.debug(_("creating VLAN Network"))
+ LOG.debug(_("Creating VLAN Network"))
elif network_type == constants.TYPE_IB:
- LOG.debug(_("creating IB Network"))
+ LOG.debug(_("Creating IB Network"))
else:
LOG.error(_("Unknown network type %(network_type)s "
"for network %(network_id)s"),
resync_a = False
resync_b = False
if port_info.get('added'):
- LOG.debug(_("ports added!"))
+ LOG.debug(_("Ports added!"))
resync_a = self.treat_devices_added(port_info['added'])
if port_info.get('removed'):
- LOG.debug(_("ports removed!"))
+ LOG.debug(_("Ports removed!"))
resync_b = self.treat_devices_removed(port_info['removed'])
# If one of the above opertaions fails => resync with plugin
return (resync_a | resync_b)
help=_("List of <physical_network>:<physical_interface>")),
cfg.StrOpt('vnic_type',
default=constants.VIF_TYPE_DIRECT,
- help=_("type of VM network interface: mlnx_direct or "
+ help=_("Type of VM network interface: mlnx_direct or "
"hostdev")),
cfg.StrOpt('daemon_endpoint',
default='tcp://127.0.0.1:5001',
for entries in allocations.itervalues():
for entry in entries:
if not entry.allocated:
- LOG.debug(_("removing vlan %(seg_id)s on physical "
+ LOG.debug(_("Removing vlan %(seg_id)s on physical "
"network %(net)s from pool"),
{'seg_id': entry.segmentation_id,
'net': entry.physical_network})
constants.TYPE_FLAT]:
if physical_network_set:
if physical_network not in self.network_vlan_ranges:
- msg = _("unknown provider:physical_network "
+ msg = _("Unknown provider:physical_network "
"%s") % physical_network
raise q_exc.InvalidInput(error_message=msg)
elif 'default' in self.network_vlan_ranges:
self.base_binding_dict[portbindings.VIF_TYPE] = vnic_type
return vnic_type
else:
- msg = (_("unsupported vnic type %(vnic_type)s "
+ msg = (_("Unsupported vnic type %(vnic_type)s "
"for network type %(net_type)s") %
{'vnic_type': vnic_type, 'net_type': net_type})
else:
- msg = _("invalid vnic_type on port_create")
+ msg = _("Invalid vnic_type on port_create")
else:
msg = _("vnic_type is not defined in port profile")
raise q_exc.InvalidInput(error_message=msg)
return net
def update_network(self, context, net_id, network):
- LOG.debug(_("update network"))
+ LOG.debug(_("Update network"))
provider._raise_if_updates_provider_attributes(network['network'])
session = context.session
return net
def delete_network(self, context, net_id):
- LOG.debug(_("delete network"))
+ LOG.debug(_("Delete network"))
session = context.session
with session.begin(subtransactions=True):
binding = db.get_network_binding(session, net_id)
db.set_port_status(port['id'], new_status)
else:
entry = {'device': device}
- LOG.debug("%s can not be found in database", device)
+ LOG.debug(_("%s can not be found in database"), device)
return entry
def update_device_down(self, rpc_context, **kwargs):
self.ofc.create_ofc_tenant(context, tenant_id)
self.ofc.create_ofc_network(context, tenant_id, net_id, net_name)
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
- LOG.error(_("failed to create network id=%(id)s on "
+ LOG.error(_("Failed to create network id=%(id)s on "
"OFC: %(exc)s"), {'id': net_id, 'exc': exc})
network['network']['status'] = const.NET_STATUS_ERROR
pf = self.deactivate_packet_filter(context, pf)
if pf['status'] == pf_db.PF_STATUS_ERROR:
- msg = _("failed to delete packet_filter id=%s which remains in "
+ msg = _("Failed to delete packet_filter id=%s which remains in "
"error status.") % id
LOG.error(msg)
raise nexc.OFCException(reason=msg)
packet_filter)
pf_status = pf_db.PF_STATUS_ACTIVE
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
- LOG.error(_("failed to create packet_filter id=%(id)s on "
+ LOG.error(_("Failed to create packet_filter id=%(id)s on "
"OFC: %(exc)s"), {'id': pf_id, 'exc': str(exc)})
pf_status = pf_db.PF_STATUS_ERROR
self.ofc.delete_ofc_packet_filter(context, pf_id)
pf_status = pf_db.PF_STATUS_DOWN
except (nexc.OFCException, nexc.OFCConsistencyBroken) as exc:
- LOG.error(_("failed to delete packet_filter id=%(id)s from "
+ LOG.error(_("Failed to delete packet_filter id=%(id)s from "
"OFC: %(exc)s"), {'id': pf_id, 'exc': str(exc)})
pf_status = pf_db.PF_STATUS_ERROR
else:
'net_id': port_data['network_id']})
except q_exc.NotFound:
- LOG.warning(_("port %s not found in NVP"), port_data['id'])
+ LOG.warning(_("Port %s not found in NVP"), port_data['id'])
def _nvp_delete_router_port(self, context, port_data):
# Delete logical router port
"L3GatewayAttachment",
self.cluster.default_l3_gw_service_uuid)
except nvp_exc.NvpPluginException:
- LOG.exception(_("Unable to create L3GW port on logical router "
+ LOG.exception(_("Unable to create L3GW port on logical router "
"%(router_uuid)s. Verify Default Layer-3 Gateway "
- "service %(def_l3_gw_svc)s id is correct") %
+ "service %(def_l3_gw_svc)s id is correct"),
{'router_uuid': lrouter['uuid'],
'def_l3_gw_svc':
self.cluster.default_l3_gw_service_uuid})
nvplib.delete_lrouter(self.cluster, router_id)
except q_exc.NotFound:
LOG.warning(_("Logical router '%s' not found "
- "on NVP Platform") % router_id)
+ "on NVP Platform"), router_id)
except NvpApiClient.NvpApiException:
raise nvp_exc.NvpPluginException(
- err_msg=(_("Unable to delete logical router '%s'"
+ err_msg=(_("Unable to delete logical router '%s' "
"on NVP Platform") % router_id))
def add_router_interface(self, context, router_id, interface_info):
multi_parser = cfg.MultiConfigParser()
read_ok = multi_parser.read(conf.config_file)
if len(read_ok) != len(conf.config_file):
- raise cfg.Error("Some config files were not parsed properly")
+ raise cfg.Error(_("Some config files were not parsed properly"))
for parsed_file in multi_parser.parsed:
for section in parsed_file.keys():
return err_msg
unexpected_keys = [key for key in device if key not in key_specs]
if unexpected_keys:
- err_msg = ("Unexpected keys found in device description:%s",
- ",".join(unexpected_keys))
+ err_msg = (_("Unexpected keys found in device description:%s")
+ % ",".join(unexpected_keys))
return err_msg
except TypeError:
return (_("%s: provided data are not iterable") %
nw_gw_quota_opts = [
cfg.IntOpt('quota_network_gateway',
default=5,
- help=_('number of network gateways allowed per tenant, '
+ help=_('Number of network gateways allowed per tenant, '
'-1 for unlimited'))
]
router_id, route)
added_routes.append(uuid)
except NvpApiClient.NvpApiException:
- LOG.exception(_('Cannot update NVP routes %(routes)s for'
- ' router %(router_id)s') % {'routes': routes,
- 'router_id': router_id})
+ LOG.exception(_('Cannot update NVP routes %(routes)s for '
+ 'router %(router_id)s'),
+ {'routes': routes, 'router_id': router_id})
# Roll back to keep NVP in consistent state
with excutils.save_and_reraise_exception():
if nvp_routes:
filters={'tag': neutron_port_id,
'tag_scope': 'q_port_id'})
LOG.debug(_("Looking for port with q_port_id tag '%(neutron_port_id)s' "
- "on: '%(lswitch_uuid)s'") %
+ "on: '%(lswitch_uuid)s'"),
{'neutron_port_id': neutron_port_id,
'lswitch_uuid': lswitch_uuid})
res = do_request(HTTP_GET, uri, cluster=cluster)
if num_results > 1:
LOG.warn(_("Found '%(num_ports)d' ports with "
"q_port_id tag: '%(neutron_port_id)s'. "
- "Only 1 was expected.") %
+ "Only 1 was expected."),
{'num_ports': num_results,
'neutron_port_id': neutron_port_id})
return res["results"][0]
:param execption_locals: calling context local variable dict.
:returns: a formatted string.
"""
- msg = ["Error. %s exception: %s." % (etype, e)]
+ msg = [_("Error. %(type)s exception: %(exc)s.") %
+ {'type': etype, 'exc': e}]
l = dict((k, v) for k, v in exception_locals.iteritems()
if k != 'request')
- msg.append("locals=[%s]" % str(l))
+ msg.append(_("locals=[%s]") % str(l))
return ' '.join(msg)
http_uri,
cluster=cluster)
except Exception as e:
- msg = ("Error '%s' when connecting to controller(s): %s."
- % (str(e), ', '.join(cluster.nvp_controllers)))
+ msg = (_("Error '%(err)s' when connecting to controller(s): %(ctl)s.")
+ % {'err': str(e), 'ctl': ', '.join(cluster.nvp_controllers)})
raise Exception(msg)
'cb': str(task._result_callback)}
LOG.exception(msg)
- LOG.debug(_("Task %(task)s return %(status)s") % {
- 'task': str(task),
- 'status': task.status})
+ LOG.debug(_("Task %(task)s return %(status)s"),
+ {'task': str(task), 'status': task.status})
task._finished()
'transaction had been commited (%s attempts left)'),
max_retries - (i + 1))
- raise q_exc.NeutronException(message='Unable to generate a new tunnel id')
+ raise q_exc.NeutronException(
+ message=_('Unable to generate a new tunnel id'))
"""
def __init__(self):
- LOG.info('Python PLUMgrid Fake Library Started ')
+ LOG.info(_('Python PLUMgrid Fake Library Started '))
pass
def director_conn(self, director_plumgrid, director_port, timeout,
director_admin, director_password):
- LOG.info('Fake Director: %s', director_plumgrid + ':' + director_port)
+ LOG.info(_('Fake Director: %s'),
+ director_plumgrid + ':' + director_port)
pass
def create_network(self, tenant_id, net_db):
"""
def __init__(self):
- LOG.info('Python PLUMgrid Library Started ')
+ LOG.info(_('Python PLUMgrid Library Started '))
def director_conn(self, director_plumgrid, director_port, timeout,
director_admin, director_password):
LOG = logging.getLogger(__name__)
PLUM_DRIVER = 'neutron.plugins.plumgrid.drivers.plumlib.Plumlib'
-ERR_MESSAGE = 'PLUMgrid Director communication failed'
+ERR_MESSAGE = _('PLUMgrid Director communication failed')
director_server_opts = [
cfg.StrOpt('director_server', default='localhost',
'tcp:%s:%d' % (ovsdb_ip, ovsdb_port))
def port_update(self, context, **kwargs):
- LOG.debug(_("port update received"))
+ LOG.debug(_("Port update received"))
port = kwargs.get('port')
vif_port = self.int_br.get_vif_port_by_id(port['id'])
if not vif_port:
def _set_rules(data):
default_rule = 'default'
- LOG.debug(_("loading policies from file: %s"), _POLICY_PATH)
+ LOG.debug(_("Loading policies from file: %s"), _POLICY_PATH)
# Ensure backward compatibility with folsom/grizzly convention
# for extension rules
policies = policy.Rules.load_json(data, default_rule)
'minus for unlimited')),
cfg.IntOpt('quota_port',
default=50,
- help=_('number of ports allowed per tenant, minus for '
+ help=_('Number of ports allowed per tenant, minus for '
'unlimited')),
cfg.StrOpt('quota_driver',
default='neutron.quota.ConfDriver',
help=_('Seconds between running periodic tasks')),
cfg.IntOpt('periodic_fuzzy_delay',
default=5,
- help=_('range of seconds to randomly delay when starting the'
- ' periodic task scheduler to reduce stampeding.'
- ' (Disable by setting to 0)')),
+ help=_('Range of seconds to randomly delay when starting the '
+ 'periodic task scheduler to reduce stampeding. '
+ '(Disable by setting to 0)')),
]
CONF = cfg.CONF
CONF.register_opts(service_opts)
try:
plist = resp['body']['response']
except ValueError:
- LOG.warn(_("unable to parse interface mapping."))
+ LOG.warn(_("Unable to parse interface mapping."))
return
else:
- LOG.warn(_("unable to read interface mapping."))
+ LOG.warn(_("Unable to read interface mapping."))
return
if ri.ex_gw_port:
candidates = plugin.get_lbaas_agents(context, active=True)
if not candidates:
- LOG.warn(_('No active lbaas agents for pool %s') % pool['id'])
+ LOG.warn(_('No active lbaas agents for pool %s'), pool['id'])
return
chosen_agent = random.choice(candidates)
self.agent_state)
self.agent_state.pop('start_flag', None)
except Exception:
- LOG.exception("Failed reporting state!")
+ LOG.exception(_("Failed reporting state!"))
def initialize_service_hook(self, started_by):
self.sync_state()
pool_stats['members'] = self._get_servers_stats(parsed_stats)
return pool_stats
else:
- LOG.warn(_('Stats socket not found for pool %s') % pool_id)
+ LOG.warn(_('Stats socket not found for pool %s'), pool_id)
return {}
def _get_backend_stats(self, parsed_stats):
if not agents:
return []
elif len(agents) > 1:
- LOG.warning(_('Multiple lbaas agents found on host %s') % host)
+ LOG.warning(_('Multiple lbaas agents found on host %s'), host)
pools = self.plugin.list_pools_on_lbaas_agent(context,
agents[0].id)
def _load_drivers(self):
"""Loads plugin-driver from configuration."""
- LOG.info(_("Loading Metering driver %s") % self.conf.driver)
+ LOG.info(_("Loading Metering driver %s"), self.conf.driver)
if not self.conf.driver:
raise SystemExit(_('A metering driver must be specified'))
self.metering_driver = importutils.import_object(
'last_update': info['last_update'],
'host': self.host}
- LOG.debug("Send metering report: %s" % data)
+ LOG.debug(_("Send metering report: %s"), data)
notifier_api.notify(self.context,
notifier_api.publisher_id('metering'),
'l3.meter',
if not self.conf.interface_driver:
raise SystemExit(_('An interface driver must be specified'))
- LOG.info(_("Loading interface driver %s") % self.conf.interface_driver)
+ LOG.info(_("Loading interface driver %s"), self.conf.interface_driver)
self.driver = importutils.import_object(self.conf.interface_driver,
self.conf)
default=os.path.join(
TEMPLATE_PATH,
'template/openswan/ipsec.conf.template'),
- help='Template file for ipsec configuration'),
+ help=_('Template file for ipsec configuration')),
cfg.StrOpt(
'ipsec_secret_template',
default=os.path.join(
TEMPLATE_PATH,
'template/openswan/ipsec.secret.template'),
- help='Template file for ipsec secret configuration')
+ help=_('Template file for ipsec secret configuration'))
]
cfg.CONF.register_opts(openswan_opts, 'openswan')
family = info[0]
bind_addr = info[-1]
except Exception:
- LOG.exception(_("Unable to listen on %(host)s:%(port)s") %
+ LOG.exception(_("Unable to listen on %(host)s:%(port)s"),
{'host': host, 'port': port})
sys.exit(1)
file_black_list = ["./neutron/tests/unit",
"./neutron/openstack",
- "./quantum/plugins/bigswitch/tests"]
+ "./neutron/plugins/bigswitch/tests"]