from neutron.common import constants as l3_constants
from neutron.openstack.common import excutils
+from neutron.openstack.common.gettextutils import _LE, _LI
from neutron.openstack.common import log as logging
from neutron.plugins.ml2 import db
from neutron.plugins.ml2.drivers.brocade.db import models as brocade_db
'rbridge_id': cfg.CONF.ml2_brocade.rbridge_id
}
self._driver = driver.NOSdriver()
- LOG.info(_("rbridge id %s"), self._switch['rbridge_id'])
+ LOG.info(_LI("rbridge id %s"), self._switch['rbridge_id'])
def create_router(self, context, router):
""" creates a vrf on NOS device."""
'device_owner': [DEVICE_OWNER_ROUTER_INTF]}
port_count = self._core_plugin.get_ports_count(context,
port_filters)
- LOG.info(_("BrocadeSVIPlugin.add_router_interface ports_count %d"),
+ LOG.info(_LI("BrocadeSVIPlugin.add_router_interface ports_count "
+ "%d"),
port_count)
# port count is checked against 2 since the current port is already
if port_count == 2:
# This subnet is already part of some router
# (this is not supported in this version of brocade svi plugin)
- LOG.error(_("BrocadeSVIPlugin: adding redundant router "
- "interface is not supported"))
- raise Exception(_("BrocadeSVIPlugin:adding redundant router "
- "interface is not supported"))
+ msg = _("BrocadeSVIPlugin: adding redundant router interface "
+ "is not supported")
+ LOG.error(msg)
+ raise Exception(msg)
try:
switch = self._switch
gateway_ip_cidr,
str(router_id))
except Exception:
- LOG.error(_("Failed to create Brocade resources to add router "
- "interface. info=%(info)s, router_id=%(router_id)s"),
+ LOG.error(_LE("Failed to create Brocade resources to add router "
+ "interface. info=%(info)s, router_id=%(router_id)s"),
{"info": info, "router_id": router_id})
with excutils.save_and_reraise_exception():
with context.session.begin(subtransactions=True):
str(router_id))
except Exception:
with excutils.save_and_reraise_exception():
- LOG.error(_("Fail remove of interface from brocade router "
- "interface. info=%(info)s, "
- "router_id=%(router_id)s") %
- ({"info": info, "router_id": router_id}))
+ LOG.error(_LE("Fail remove of interface from brocade "
+ "router interface. info=%(info)s, "
+ "router_id=%(router_id)s"),
+ {"info": info, "router_id": router_id})
return True
@staticmethod
from neutron.db import l3_agentschedulers_db
from neutron.db import l3_gwmode_db
from neutron.openstack.common import excutils
+from neutron.openstack.common.gettextutils import _LE, _LI
from neutron.openstack.common import log as logging
from neutron.plugins.common import constants
from neutron.plugins.ml2.driver_context import NetworkContext # noqa
return new_router
except Exception:
with excutils.save_and_reraise_exception():
- LOG.error(_("Error creating router on Arista HW "
- "router=%s ") % new_router)
+ LOG.error(_LE("Error creating router on Arista HW router=%s "),
+ new_router)
super(AristaL3ServicePlugin, self).delete_router(context,
new_router['id'])
original_router, new_router)
return new_router
except Exception:
- LOG.error(_("Error updating router on Arista HW "
- "router=%s ") % new_router)
+ LOG.error(_LE("Error updating router on Arista HW router=%s "),
+ new_router)
@log.log
def delete_router(self, context, router_id):
try:
self.driver.delete_router(context, tenant_id, router_id, router)
except Exception as e:
- LOG.error(_("Error deleting router on Arista HW "
- "router %(r)s exception=%(e)s") %
+ LOG.error(_LE("Error deleting router on Arista HW "
+ "router %(r)s exception=%(e)s"),
{'r': router, 'e': e})
with context.session.begin(subtransactions=True):
return new_router
except Exception:
with excutils.save_and_reraise_exception():
- LOG.error(_("Error Adding subnet %(subnet)s to "
- "router %(router_id)s on Arista HW") %
+ LOG.error(_LE("Error Adding subnet %(subnet)s to "
+ "router %(router_id)s on Arista HW"),
{'subnet': subnet, 'router_id': router_id})
super(AristaL3ServicePlugin, self).remove_router_interface(
context,
self.driver.remove_router_interface(context, router_info)
return new_router
except Exception as exc:
- LOG.error(_("Error removing interface %(interface)s from "
- "router %(router_id)s on Arista HW"
- "Exception =(exc)s") % {'interface': interface_info,
- 'router_id': router_id,
- 'exc': exc})
+ LOG.error(_LE("Error removing interface %(interface)s from "
+ "router %(router_id)s on Arista HW"
+ "Exception =(exc)s"),
+ {'interface': interface_info, 'router_id': router_id,
+ 'exc': exc})
def synchronize(self):
"""Synchronizes Router DB from Neturon DB with EOS.
Uses idempotent properties of EOS configuration, which means
same commands can be repeated.
"""
- LOG.info(_('Syncing Neutron Router DB <-> EOS'))
+ LOG.info(_LI('Syncing Neutron Router DB <-> EOS'))
ctx = nctx.get_admin_context()
routers = super(AristaL3ServicePlugin, self).get_routers(ctx)
try:
self.driver.add_router_interface(self, r)
except Exception:
- LOG.error(_("Error Adding interface %(subnet_id)s to "
- "router %(router_id)s on Arista HW") %
- {'subnet_id': subnet_id,
- 'router_id': r})
+ LOG.error(_LE("Error Adding interface %(subnet_id)s "
+ "to router %(router_id)s on Arista HW"),
+ {'subnet_id': subnet_id, 'router_id': r})
def _validate_interface_info(self, interface_info):
port_id_specified = interface_info and 'port_id' in interface_info