"neutron/plugins/mlnx",
"neutron/plugins/nec",
"neutron/plugins/nuage",
- #"neutron/plugins/ofagent",
- #"neutron/plugins/oneconvergence",
+ "neutron/plugins/ofagent",
+ "neutron/plugins/oneconvergence",
"neutron/plugins/opencontrail",
"neutron/plugins/openvswitch",
"neutron/plugins/plumgrid",
from neutron.common import topics
from neutron import context as n_context
from neutron.extensions import securitygroup as ext_sg
+from neutron.i18n import _LE, _LI
from neutron.openstack.common import log as logging
from neutron.plugins.oneconvergence.lib import config
self.sg_agent = sg_agent
def port_update(self, context, **kwargs):
- LOG.debug(_("port_update received: %s"), kwargs)
+ LOG.debug("port_update received: %s", kwargs)
port = kwargs.get('port')
# Validate that port is on OVS
vif_port = self.agent.int_br.get_vif_port_by_id(port['id'])
self.host = socket.gethostname()
self.agent_id = 'nvsd-q-agent.%s' % self.host
- LOG.info(_("RPC agent_id: %s"), self.agent_id)
+ LOG.info(_LI("RPC agent_id: %s"), self.agent_id)
self.topic = topics.AGENT
self.context = n_context.get_admin_context_without_session()
try:
port_info = self._update_ports(ports)
if port_info:
- LOG.debug(_("Port list is updated"))
+ LOG.debug("Port list is updated")
self._process_devices_filter(port_info)
ports = port_info['current']
self.ports = ports
except Exception:
- LOG.exception(_("Error in agent event loop"))
+ LOG.exception(_LE("Error in agent event loop"))
- LOG.debug(_("AGENT looping....."))
+ LOG.debug("AGENT looping.....")
time.sleep(self.polling_interval)
root_helper = config.AGENT.root_helper
polling_interval = config.AGENT.polling_interval
agent = NVSDNeutronAgent(integ_br, root_helper, polling_interval)
- LOG.info(_("NVSD Agent initialized successfully, now running... "))
+ LOG.info(_LI("NVSD Agent initialized successfully, now running... "))
# Start everything.
agent.daemon_loop()
nvsd_net = response.json()
- LOG.debug(_("Network %(id)s created under tenant %(tenant_id)s"),
+ LOG.debug("Network %(id)s created under tenant %(tenant_id)s",
{'id': nvsd_net['id'], 'tenant_id': tenant_id})
return nvsd_net
resource='network', tenant_id=tenant_id,
resource_id=network_id)
- LOG.debug(_("Network %(id)s updated under tenant %(tenant_id)s"),
+ LOG.debug("Network %(id)s updated under tenant %(tenant_id)s",
{'id': network_id, 'tenant_id': tenant_id})
def delete_network(self, network, subnets=[]):
self.send_request("DELETE", path, resource='network',
tenant_id=tenant_id, resource_id=network_id)
- LOG.debug(_("Network %(id)s deleted under tenant %(tenant_id)s"),
+ LOG.debug("Network %(id)s deleted under tenant %(tenant_id)s",
{'id': network_id, 'tenant_id': tenant_id})
def create_subnet(self, subnet):
self.send_request("POST", uri, body=jsonutils.dumps(subnet),
resource='subnet', tenant_id=tenant_id)
- LOG.debug(_("Subnet %(id)s created under tenant %(tenant_id)s"),
+ LOG.debug("Subnet %(id)s created under tenant %(tenant_id)s",
{'id': subnet['id'], 'tenant_id': tenant_id})
def delete_subnet(self, subnet):
self.send_request("DELETE", uri, resource='subnet',
tenant_id=tenant_id, resource_id=subnet_id)
- LOG.debug(_("Subnet %(id)s deleted under tenant %(tenant_id)s"),
+ LOG.debug("Subnet %(id)s deleted under tenant %(tenant_id)s",
{'id': subnet_id, 'tenant_id': tenant_id})
def update_subnet(self, subnet, subnet_update):
resource='subnet', tenant_id=tenant_id,
resource_id=subnet_id)
- LOG.debug(_("Subnet %(id)s updated under tenant %(tenant_id)s"),
+ LOG.debug("Subnet %(id)s updated under tenant %(tenant_id)s",
{'id': subnet_id, 'tenant_id': tenant_id})
def create_port(self, tenant_id, port):
self.send_request("POST", path, body=jsonutils.dumps(lport),
resource='port', tenant_id=tenant_id)
- LOG.debug(_("Port %(id)s created under tenant %(tenant_id)s"),
+ LOG.debug("Port %(id)s created under tenant %(tenant_id)s",
{'id': port['id'], 'tenant_id': tenant_id})
def update_port(self, tenant_id, port, port_update):
resource='port', tenant_id=tenant_id,
resource_id=port_id)
- LOG.debug(_("Port %(id)s updated under tenant %(tenant_id)s"),
+ LOG.debug("Port %(id)s updated under tenant %(tenant_id)s",
{'id': port_id, 'tenant_id': tenant_id})
def delete_port(self, port_id, port):
self.send_request("DELETE", uri, resource='port', tenant_id=tenant_id,
resource_id=port_id)
- LOG.debug(_("Port %(id)s deleted under tenant %(tenant_id)s"),
+ LOG.debug("Port %(id)s deleted under tenant %(tenant_id)s",
{'id': port_id, 'tenant_id': tenant_id})
def _get_ports(self, tenant_id, network_id):
resource='floating_ip',
tenant_id=tenant_id)
- LOG.debug(_("Flatingip %(id)s created under tenant %(tenant_id)s"),
+ LOG.debug("Flatingip %(id)s created under tenant %(tenant_id)s",
{'id': floating_ip['id'], 'tenant_id': tenant_id})
def update_floatingip(self, floating_ip, floating_ip_update):
tenant_id=tenant_id,
resource_id=floating_ip_id)
- LOG.debug(_("Flatingip %(id)s updated under tenant %(tenant_id)s"),
+ LOG.debug("Flatingip %(id)s updated under tenant %(tenant_id)s",
{'id': floating_ip_id, 'tenant_id': tenant_id})
def delete_floatingip(self, floating_ip):
self.send_request("DELETE", uri, resource='floating_ip',
tenant_id=tenant_id, resource_id=floating_ip_id)
- LOG.debug(_("Flatingip %(id)s deleted under tenant %(tenant_id)s"),
+ LOG.debug("Flatingip %(id)s deleted under tenant %(tenant_id)s",
{'id': floating_ip_id, 'tenant_id': tenant_id})
def create_router(self, router):
resource='router',
tenant_id=tenant_id)
- LOG.debug(_("Router %(id)s created under tenant %(tenant_id)s"),
+ LOG.debug("Router %(id)s created under tenant %(tenant_id)s",
{'id': router['id'], 'tenant_id': tenant_id})
def update_router(self, router):
resource='router', tenant_id=tenant_id,
resource_id=router_id)
- LOG.debug(_("Router %(id)s updated under tenant %(tenant_id)s"),
+ LOG.debug("Router %(id)s updated under tenant %(tenant_id)s",
{'id': router_id, 'tenant_id': tenant_id})
def delete_router(self, tenant_id, router_id):
self.send_request("DELETE", uri, resource='router',
tenant_id=tenant_id, resource_id=router_id)
- LOG.debug(_("Router %(id)s deleted under tenant %(tenant_id)s"),
+ LOG.debug("Router %(id)s deleted under tenant %(tenant_id)s",
{'id': router_id, 'tenant_id': tenant_id})
import requests
from six.moves.urllib import parse
+from neutron.i18n import _LE, _LW
from neutron.openstack.common import log as logging
import neutron.plugins.oneconvergence.lib.exception as exception
headers=headers, data=data)
break
except Exception as e:
- LOG.error(_("Login Failed: %s"), e)
- LOG.error(_("Unable to establish connection"
- " with Controller %s"), self.api_url)
- LOG.error(_("Retrying after 1 second..."))
+ LOG.error(_LE("Login Failed: %s"), e)
+ LOG.error(_LE("Unable to establish connection"
+ " with Controller %s"), self.api_url)
+ LOG.error(_LE("Retrying after 1 second..."))
time.sleep(1)
if response.status_code == requests.codes.ok:
- LOG.debug(_("Login Successful %(uri)s "
- "%(status)s"), {'uri': self.api_url,
- 'status': response.status_code})
+ LOG.debug("Login Successful %(uri)s "
+ "%(status)s", {'uri': self.api_url,
+ 'status': response.status_code})
self.auth_token = jsonutils.loads(response.content)["session_uuid"]
- LOG.debug(_("AuthToken = %s"), self.auth_token)
+ LOG.debug("AuthToken = %s", self.auth_token)
else:
- LOG.error(_("login failed"))
+ LOG.error(_LE("login failed"))
return
"""Issue a request to NVSD controller."""
if self.auth_token is None:
- LOG.warning(_("No Token, Re-login"))
+ LOG.warning(_LW("No Token, Re-login"))
self.login()
headers = {"Content-Type": content_type}
response = self.do_request(method, url=url,
headers=headers, data=body)
- LOG.debug(_("request: %(method)s %(uri)s successful"),
+ LOG.debug("request: %(method)s %(uri)s successful",
{'method': method, 'uri': self.api_url + uri})
request_ok = True
except httplib.IncompleteRead as e:
response = e.partial
request_ok = True
except Exception as e:
- LOG.error(_("request: Request failed from "
+ LOG.error(_LE("request: Request failed from "
"Controller side :%s"), e)
if response is None:
# Timeout.
- LOG.error(_("Response is Null, Request timed out: %(method)s to "
- "%(uri)s"), {'method': method, 'uri': uri})
+ LOG.error(_LE("Response is Null, Request timed out: %(method)s to "
+ "%(uri)s"), {'method': method, 'uri': uri})
self.auth_token = None
raise exception.RequestTimeout()
raise exception.UnAuthorizedException()
if status in self.error_codes:
- LOG.error(_("Request %(method)s %(uri)s body = %(body)s failed "
- "with status %(status)s"), {'method': method,
- 'uri': uri, 'body': body,
- 'status': status})
- LOG.error(_("%s"), response.reason)
+ LOG.error(_LE("Request %(method)s %(uri)s body = %(body)s failed "
+ "with status %(status)s. Reason: %(reason)s)"),
+ {'method': method,
+ 'uri': uri, 'body': body,
+ 'status': status,
+ 'reason': response.reason})
raise self.error_codes[status]()
elif status not in (requests.codes.ok, requests.codes.created,
requests.codes.no_content):
- LOG.error(_("%(method)s to %(url)s, unexpected response code: "
- "%(status)d"), {'method': method, 'url': url,
- 'status': status})
+ LOG.error(_LE("%(method)s to %(url)s, unexpected response code: "
+ "%(status)d"), {'method': method, 'url': url,
+ 'status': status})
return
if not request_ok:
- LOG.error(_("Request failed from Controller side with "
+ LOG.error(_LE("Request failed from Controller side with "
"Status=%s"), status)
raise exception.ServerException()
else:
- LOG.debug(_("Success: %(method)s %(url)s status=%(status)s"),
+ LOG.debug("Success: %(method)s %(url)s status=%(status)s",
{'method': method, 'url': self.api_url + uri,
'status': status})
response.body = response.content
from neutron.db import quota_db # noqa
from neutron.db import securitygroups_rpc_base as sg_db_rpc
from neutron.extensions import portbindings
+from neutron.i18n import _LE
from neutron.openstack.common import log as logging
from neutron.plugins.common import constants as svc_constants
import neutron.plugins.oneconvergence.lib.config # noqa
#Log the message and delete the subnet from the neutron
super(OneConvergencePluginV2,
self).delete_subnet(context, neutron_subnet['id'])
- LOG.error(_("Failed to create subnet, "
- "deleting it from neutron"))
+ LOG.error(_LE("Failed to create subnet, "
+ "deleting it from neutron"))
return neutron_subnet
self.nvsdlib.create_port(tenant_id, neutron_port)
except nvsdexception.NVSDAPIException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Deleting newly created "
- "neutron port %s"), port_id)
+ LOG.error(_LE("Deleting newly created "
+ "neutron port %s"), port_id)
super(OneConvergencePluginV2, self).delete_port(context,
port_id)
self.nvsdlib.create_floatingip(neutron_floatingip)
except nvsdexception.NVSDAPIException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed to create floatingip"))
+ LOG.error(_LE("Failed to create floatingip"))
super(OneConvergencePluginV2,
self).delete_floatingip(context,
neutron_floatingip['id'])
self.nvsdlib.create_router(neutron_router)
except nvsdexception.NVSDAPIException:
with excutils.save_and_reraise_exception():
- LOG.error(_("Failed to create router"))
+ LOG.error(_LE("Failed to create router"))
super(OneConvergencePluginV2,
self).delete_router(context, neutron_router['id'])