Merge "Update i18n translation for Cisco plugins and cfg agent log msg's"
This commit is contained in:
commit
253652133d
|
@ -60,7 +60,8 @@ def _directory_to_check_translation(filename):
|
||||||
"neutron/services",
|
"neutron/services",
|
||||||
"neutron/plugins/ml2",
|
"neutron/plugins/ml2",
|
||||||
"neutron/plugins/openvswitch",
|
"neutron/plugins/openvswitch",
|
||||||
"neutron/plugins/linuxbridge"]
|
"neutron/plugins/linuxbridge",
|
||||||
|
"neutron/plugins/cisco"]
|
||||||
return any([dir in filename for dir in dirs])
|
return any([dir in filename for dir in dirs])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ from neutron.openstack.common import loopingcall
|
||||||
from neutron.openstack.common import periodic_task
|
from neutron.openstack.common import periodic_task
|
||||||
from neutron.openstack.common import service
|
from neutron.openstack.common import service
|
||||||
from neutron.openstack.common import timeutils
|
from neutron.openstack.common import timeutils
|
||||||
|
from neutron.openstack.common.gettextutils import _LE, _LI, _LW
|
||||||
from neutron.plugins.cisco.cfg_agent import device_status
|
from neutron.plugins.cisco.cfg_agent import device_status
|
||||||
from neutron.plugins.cisco.common import cisco_constants as c_constants
|
from neutron.plugins.cisco.common import cisco_constants as c_constants
|
||||||
from neutron import service as neutron_service
|
from neutron import service as neutron_service
|
||||||
|
@ -132,7 +133,7 @@ class CiscoCfgAgent(manager.Manager):
|
||||||
self.routing_service_helper = importutils.import_object(
|
self.routing_service_helper = importutils.import_object(
|
||||||
svc_helper_class, host, self.conf, self)
|
svc_helper_class, host, self.conf, self)
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
LOG.warn(_("Error in loading routing service helper. Class "
|
LOG.warning(_LW("Error in loading routing service helper. Class "
|
||||||
"specified is %(class)s. Reason:%(reason)s"),
|
"specified is %(class)s. Reason:%(reason)s"),
|
||||||
{'class': self.conf.cfg_agent.routing_svc_helper_class,
|
{'class': self.conf.cfg_agent.routing_svc_helper_class,
|
||||||
'reason': e})
|
'reason': e})
|
||||||
|
@ -143,7 +144,7 @@ class CiscoCfgAgent(manager.Manager):
|
||||||
self.loop.start(interval=self.conf.cfg_agent.rpc_loop_interval)
|
self.loop.start(interval=self.conf.cfg_agent.rpc_loop_interval)
|
||||||
|
|
||||||
def after_start(self):
|
def after_start(self):
|
||||||
LOG.info(_("Cisco cfg agent started"))
|
LOG.info(_LI("Cisco cfg agent started"))
|
||||||
|
|
||||||
def get_routing_service_helper(self):
|
def get_routing_service_helper(self):
|
||||||
return self.routing_service_helper
|
return self.routing_service_helper
|
||||||
|
@ -203,7 +204,7 @@ class CiscoCfgAgent(manager.Manager):
|
||||||
self.routing_service_helper.process_service(device_ids,
|
self.routing_service_helper.process_service(device_ids,
|
||||||
removed_devices_info)
|
removed_devices_info)
|
||||||
else:
|
else:
|
||||||
LOG.warn(_("No routing service helper loaded"))
|
LOG.warning(_LW("No routing service helper loaded"))
|
||||||
LOG.debug("Processing services completed")
|
LOG.debug("Processing services completed")
|
||||||
|
|
||||||
def _process_backlogged_hosting_devices(self, context):
|
def _process_backlogged_hosting_devices(self, context):
|
||||||
|
@ -232,7 +233,7 @@ class CiscoCfgAgent(manager.Manager):
|
||||||
if payload['hosting_data'].keys():
|
if payload['hosting_data'].keys():
|
||||||
self.process_services(removed_devices_info=payload)
|
self.process_services(removed_devices_info=payload)
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
LOG.error(_("Invalid payload format for received RPC message "
|
LOG.error(_LE("Invalid payload format for received RPC message "
|
||||||
"`hosting_devices_removed`. Error is %{error}s. "
|
"`hosting_devices_removed`. Error is %{error}s. "
|
||||||
"Payload is %(payload)s"),
|
"Payload is %(payload)s"),
|
||||||
{'error': e, 'payload': payload})
|
{'error': e, 'payload': payload})
|
||||||
|
@ -276,20 +277,20 @@ class CiscoCfgAgentWithStateReport(CiscoCfgAgent):
|
||||||
self.send_agent_report(self.agent_state, context)
|
self.send_agent_report(self.agent_state, context)
|
||||||
res = self.devmgr_rpc.register_for_duty(context)
|
res = self.devmgr_rpc.register_for_duty(context)
|
||||||
if res is True:
|
if res is True:
|
||||||
LOG.info(_("[Agent registration] Agent successfully "
|
LOG.info(_LI("[Agent registration] Agent successfully "
|
||||||
"registered"))
|
"registered"))
|
||||||
return
|
return
|
||||||
elif res is False:
|
elif res is False:
|
||||||
LOG.warn(_("[Agent registration] Neutron server said that "
|
LOG.warning(_LW("[Agent registration] Neutron server said "
|
||||||
"device manager was not ready. Retrying in %0.2f "
|
"that device manager was not ready. Retrying "
|
||||||
"seconds "), REGISTRATION_RETRY_DELAY)
|
"in %0.2f seconds "), REGISTRATION_RETRY_DELAY)
|
||||||
time.sleep(REGISTRATION_RETRY_DELAY)
|
time.sleep(REGISTRATION_RETRY_DELAY)
|
||||||
elif res is None:
|
elif res is None:
|
||||||
LOG.error(_("[Agent registration] Neutron server said that no "
|
LOG.error(_LE("[Agent registration] Neutron server said that "
|
||||||
"device manager was found. Cannot "
|
"no device manager was found. Cannot continue. "
|
||||||
"continue. Exiting!"))
|
"Exiting!"))
|
||||||
raise SystemExit("Cfg Agent exiting")
|
raise SystemExit("Cfg Agent exiting")
|
||||||
LOG.error(_("[Agent registration] %d unsuccessful registration "
|
LOG.error(_LE("[Agent registration] %d unsuccessful registration "
|
||||||
"attempts. Exiting!"), MAX_REGISTRATION_ATTEMPTS)
|
"attempts. Exiting!"), MAX_REGISTRATION_ATTEMPTS)
|
||||||
raise SystemExit("Cfg Agent exiting")
|
raise SystemExit("Cfg Agent exiting")
|
||||||
|
|
||||||
|
@ -323,12 +324,12 @@ class CiscoCfgAgentWithStateReport(CiscoCfgAgent):
|
||||||
LOG.debug("Send agent report successfully completed")
|
LOG.debug("Send agent report successfully completed")
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# This means the server does not support report_state
|
# This means the server does not support report_state
|
||||||
LOG.warn(_("Neutron server does not support state report. "
|
LOG.warning(_LW("Neutron server does not support state report. "
|
||||||
"State report for this agent will be disabled."))
|
"State report for this agent will be disabled."))
|
||||||
self.heartbeat.stop()
|
self.heartbeat.stop()
|
||||||
return
|
return
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_("Failed sending agent report!"))
|
LOG.exception(_LE("Failed sending agent report!"))
|
||||||
|
|
||||||
|
|
||||||
def main(manager='neutron.plugins.cisco.cfg_agent.'
|
def main(manager='neutron.plugins.cisco.cfg_agent.'
|
||||||
|
|
|
@ -23,6 +23,7 @@ from ncclient import manager
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
|
from neutron.openstack.common.gettextutils import _LE, _LI, _LW
|
||||||
from neutron.plugins.cisco.cfg_agent import cfg_exceptions as cfg_exc
|
from neutron.plugins.cisco.cfg_agent import cfg_exceptions as cfg_exc
|
||||||
from neutron.plugins.cisco.cfg_agent.device_drivers.csr1kv import (
|
from neutron.plugins.cisco.cfg_agent.device_drivers.csr1kv import (
|
||||||
cisco_csr1kv_snippets as snippets)
|
cisco_csr1kv_snippets as snippets)
|
||||||
|
@ -59,7 +60,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
self._csr_conn = None
|
self._csr_conn = None
|
||||||
self._intfs_enabled = False
|
self._intfs_enabled = False
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
LOG.error(_("Missing device parameter:%s. Aborting "
|
LOG.error(_LE("Missing device parameter:%s. Aborting "
|
||||||
"CSR1kvRoutingDriver initialization"), e)
|
"CSR1kvRoutingDriver initialization"), e)
|
||||||
raise cfg_exc.CSR1kvInitializationException()
|
raise cfg_exc.CSR1kvInitializationException()
|
||||||
|
|
||||||
|
@ -225,7 +226,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
elif action is 'delete':
|
elif action is 'delete':
|
||||||
self._remove_static_route(dest, dest_mask, next_hop, vrf_name)
|
self._remove_static_route(dest, dest_mask, next_hop, vrf_name)
|
||||||
else:
|
else:
|
||||||
LOG.error(_('Unknown route command %s'), action)
|
LOG.error(_LE('Unknown route command %s'), action)
|
||||||
|
|
||||||
def _csr_create_vrf(self, ri):
|
def _csr_create_vrf(self, ri):
|
||||||
vrf_name = self._csr_get_vrf_name(ri)
|
vrf_name = self._csr_get_vrf_name(ri)
|
||||||
|
@ -317,7 +318,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
parse = ciscoconfparse.CiscoConfParse(ioscfg)
|
parse = ciscoconfparse.CiscoConfParse(ioscfg)
|
||||||
intfs_raw = parse.find_lines("^interface GigabitEthernet")
|
intfs_raw = parse.find_lines("^interface GigabitEthernet")
|
||||||
intfs = [raw_if.strip().split(' ')[1] for raw_if in intfs_raw]
|
intfs = [raw_if.strip().split(' ')[1] for raw_if in intfs_raw]
|
||||||
LOG.info(_("Interfaces:%s"), intfs)
|
LOG.info(_LI("Interfaces:%s"), intfs)
|
||||||
return intfs
|
return intfs
|
||||||
|
|
||||||
def _get_interface_ip(self, interface_name):
|
def _get_interface_ip(self, interface_name):
|
||||||
|
@ -332,9 +333,9 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
for line in children:
|
for line in children:
|
||||||
if 'ip address' in line:
|
if 'ip address' in line:
|
||||||
ip_address = line.strip().split(' ')[2]
|
ip_address = line.strip().split(' ')[2]
|
||||||
LOG.info(_("IP Address:%s"), ip_address)
|
LOG.info(_LI("IP Address:%s"), ip_address)
|
||||||
return ip_address
|
return ip_address
|
||||||
LOG.warn(_("Cannot find interface: %s"), interface_name)
|
LOG.warning(_LW("Cannot find interface: %s"), interface_name)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _interface_exists(self, interface):
|
def _interface_exists(self, interface):
|
||||||
|
@ -369,7 +370,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
confstr = snippets.ENABLE_INTF % i
|
confstr = snippets.ENABLE_INTF % i
|
||||||
rpc_obj = conn.edit_config(target='running', config=confstr)
|
rpc_obj = conn.edit_config(target='running', config=confstr)
|
||||||
if self._check_response(rpc_obj, 'ENABLE_INTF'):
|
if self._check_response(rpc_obj, 'ENABLE_INTF'):
|
||||||
LOG.info(_("Enabled interface %s "), i)
|
LOG.info(_LI("Enabled interface %s "), i)
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
except Exception:
|
except Exception:
|
||||||
return False
|
return False
|
||||||
|
@ -388,7 +389,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
# raw format ['ip vrf <vrf-name>',....]
|
# raw format ['ip vrf <vrf-name>',....]
|
||||||
vrf_name = line.strip().split(' ')[2]
|
vrf_name = line.strip().split(' ')[2]
|
||||||
vrfs.append(vrf_name)
|
vrfs.append(vrf_name)
|
||||||
LOG.info(_("VRFs:%s"), vrfs)
|
LOG.info(_LI("VRFs:%s"), vrfs)
|
||||||
return vrfs
|
return vrfs
|
||||||
|
|
||||||
def _get_capabilities(self):
|
def _get_capabilities(self):
|
||||||
|
@ -433,7 +434,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
if acls_raw:
|
if acls_raw:
|
||||||
if exp_cfg_lines[1] in acls_raw:
|
if exp_cfg_lines[1] in acls_raw:
|
||||||
return True
|
return True
|
||||||
LOG.error(_("Mismatch in ACL configuration for %s"), acl_no)
|
LOG.error(_LE("Mismatch in ACL configuration for %s"), acl_no)
|
||||||
return False
|
return False
|
||||||
LOG.debug("%s is not present in config", acl_no)
|
LOG.debug("%s is not present in config", acl_no)
|
||||||
return False
|
return False
|
||||||
|
@ -462,9 +463,9 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
confstr = snippets.CREATE_VRF % vrf_name
|
confstr = snippets.CREATE_VRF % vrf_name
|
||||||
rpc_obj = conn.edit_config(target='running', config=confstr)
|
rpc_obj = conn.edit_config(target='running', config=confstr)
|
||||||
if self._check_response(rpc_obj, 'CREATE_VRF'):
|
if self._check_response(rpc_obj, 'CREATE_VRF'):
|
||||||
LOG.info(_("VRF %s successfully created"), vrf_name)
|
LOG.info(_LI("VRF %s successfully created"), vrf_name)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_("Failed creating VRF %s"), vrf_name)
|
LOG.exception(_LE("Failed creating VRF %s"), vrf_name)
|
||||||
|
|
||||||
def _remove_vrf(self, vrf_name):
|
def _remove_vrf(self, vrf_name):
|
||||||
if vrf_name in self._get_vrfs():
|
if vrf_name in self._get_vrfs():
|
||||||
|
@ -472,13 +473,13 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
confstr = snippets.REMOVE_VRF % vrf_name
|
confstr = snippets.REMOVE_VRF % vrf_name
|
||||||
rpc_obj = conn.edit_config(target='running', config=confstr)
|
rpc_obj = conn.edit_config(target='running', config=confstr)
|
||||||
if self._check_response(rpc_obj, 'REMOVE_VRF'):
|
if self._check_response(rpc_obj, 'REMOVE_VRF'):
|
||||||
LOG.info(_("VRF %s removed"), vrf_name)
|
LOG.info(_LI("VRF %s removed"), vrf_name)
|
||||||
else:
|
else:
|
||||||
LOG.warning(_("VRF %s not present"), vrf_name)
|
LOG.warning(_LW("VRF %s not present"), vrf_name)
|
||||||
|
|
||||||
def _create_subinterface(self, subinterface, vlan_id, vrf_name, ip, mask):
|
def _create_subinterface(self, subinterface, vlan_id, vrf_name, ip, mask):
|
||||||
if vrf_name not in self._get_vrfs():
|
if vrf_name not in self._get_vrfs():
|
||||||
LOG.error(_("VRF %s not present"), vrf_name)
|
LOG.error(_LE("VRF %s not present"), vrf_name)
|
||||||
confstr = snippets.CREATE_SUBINTERFACE % (subinterface, vlan_id,
|
confstr = snippets.CREATE_SUBINTERFACE % (subinterface, vlan_id,
|
||||||
vrf_name, ip, mask)
|
vrf_name, ip, mask)
|
||||||
self._edit_running_config(confstr, 'CREATE_SUBINTERFACE')
|
self._edit_running_config(confstr, 'CREATE_SUBINTERFACE')
|
||||||
|
@ -491,7 +492,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
|
|
||||||
def _set_ha_HSRP(self, subinterface, vrf_name, priority, group, ip):
|
def _set_ha_HSRP(self, subinterface, vrf_name, priority, group, ip):
|
||||||
if vrf_name not in self._get_vrfs():
|
if vrf_name not in self._get_vrfs():
|
||||||
LOG.error(_("VRF %s not present"), vrf_name)
|
LOG.error(_LE("VRF %s not present"), vrf_name)
|
||||||
confstr = snippets.SET_INTC_HSRP % (subinterface, vrf_name, group,
|
confstr = snippets.SET_INTC_HSRP % (subinterface, vrf_name, group,
|
||||||
priority, group, ip)
|
priority, group, ip)
|
||||||
action = "SET_INTC_HSRP (Group: %s, Priority: % s)" % (group, priority)
|
action = "SET_INTC_HSRP (Group: %s, Priority: % s)" % (group, priority)
|
||||||
|
@ -676,7 +677,7 @@ class CSR1kvRoutingDriver(devicedriver_api.RoutingDriverBase):
|
||||||
xml_str = rpc_obj.xml
|
xml_str = rpc_obj.xml
|
||||||
if "<ok />" in xml_str:
|
if "<ok />" in xml_str:
|
||||||
LOG.debug("RPCReply for %s is OK", snippet_name)
|
LOG.debug("RPCReply for %s is OK", snippet_name)
|
||||||
LOG.info(_("%s successfully executed"), snippet_name)
|
LOG.info(_LI("%s successfully executed"), snippet_name)
|
||||||
return True
|
return True
|
||||||
# Not Ok, we throw a ConfigurationException
|
# Not Ok, we throw a ConfigurationException
|
||||||
e_type = rpc_obj._root[0][0].text
|
e_type = rpc_obj._root[0][0].text
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron.openstack.common import excutils
|
from neutron.openstack.common import excutils
|
||||||
|
from neutron.openstack.common.gettextutils import _LE
|
||||||
from neutron.openstack.common import importutils
|
from neutron.openstack.common import importutils
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.plugins.cisco.cfg_agent import cfg_exceptions
|
from neutron.plugins.cisco.cfg_agent import cfg_exceptions
|
||||||
|
@ -76,7 +77,7 @@ class DeviceDriverManager(object):
|
||||||
return driver
|
return driver
|
||||||
except ImportError:
|
except ImportError:
|
||||||
with excutils.save_and_reraise_exception(reraise=False):
|
with excutils.save_and_reraise_exception(reraise=False):
|
||||||
LOG.exception(_("Error loading cfg agent driver %(driver)s "
|
LOG.exception(_LE("Error loading cfg agent driver %(driver)s "
|
||||||
"for hosting device template "
|
"for hosting device template "
|
||||||
"%(t_name)s(%(t_id)s)"),
|
"%(t_name)s(%(t_id)s)"),
|
||||||
{'driver': driver_class, 't_id': hd_id,
|
{'driver': driver_class, 't_id': hd_id,
|
||||||
|
|
|
@ -19,6 +19,8 @@ from oslo.config import cfg
|
||||||
from neutron.agent.linux import utils as linux_utils
|
from neutron.agent.linux import utils as linux_utils
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common import timeutils
|
from neutron.openstack.common import timeutils
|
||||||
|
from neutron.openstack.common.gettextutils import _LI, _LW
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
@ -54,7 +56,7 @@ def _is_pingable(ip):
|
||||||
linux_utils.execute(ping_cmd, check_exit_code=True)
|
linux_utils.execute(ping_cmd, check_exit_code=True)
|
||||||
return True
|
return True
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
LOG.warn(_("Cannot ping ip address: %s"), ip)
|
LOG.warning(_LW("Cannot ping ip address: %s"), ip)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
@ -138,22 +140,22 @@ class DeviceStatus(object):
|
||||||
hd = self.backlog_hosting_devices[hd_id]['hd']
|
hd = self.backlog_hosting_devices[hd_id]['hd']
|
||||||
if not timeutils.is_older_than(hd['created_at'],
|
if not timeutils.is_older_than(hd['created_at'],
|
||||||
hd['booting_time']):
|
hd['booting_time']):
|
||||||
LOG.info(_("Hosting device: %(hd_id)s @ %(ip)s hasn't passed "
|
LOG.info(_LI("Hosting device: %(hd_id)s @ %(ip)s hasn't "
|
||||||
"minimum boot time. Skipping it. "),
|
"passed minimum boot time. Skipping it. "),
|
||||||
{'hd_id': hd_id, 'ip': hd['management_ip_address']})
|
{'hd_id': hd_id, 'ip': hd['management_ip_address']})
|
||||||
continue
|
continue
|
||||||
LOG.info(_("Checking hosting device: %(hd_id)s @ %(ip)s for "
|
LOG.info(_LI("Checking hosting device: %(hd_id)s @ %(ip)s for "
|
||||||
"reachability."), {'hd_id': hd_id,
|
"reachability."), {'hd_id': hd_id,
|
||||||
'ip': hd['management_ip_address']})
|
'ip': hd['management_ip_address']})
|
||||||
if _is_pingable(hd['management_ip_address']):
|
if _is_pingable(hd['management_ip_address']):
|
||||||
hd.pop('backlog_insertion_ts', None)
|
hd.pop('backlog_insertion_ts', None)
|
||||||
del self.backlog_hosting_devices[hd_id]
|
del self.backlog_hosting_devices[hd_id]
|
||||||
response_dict['reachable'].append(hd_id)
|
response_dict['reachable'].append(hd_id)
|
||||||
LOG.info(_("Hosting device: %(hd_id)s @ %(ip)s is now "
|
LOG.info(_LI("Hosting device: %(hd_id)s @ %(ip)s is now "
|
||||||
"reachable. Adding it to response"),
|
"reachable. Adding it to response"),
|
||||||
{'hd_id': hd_id, 'ip': hd['management_ip_address']})
|
{'hd_id': hd_id, 'ip': hd['management_ip_address']})
|
||||||
else:
|
else:
|
||||||
LOG.info(_("Hosting device: %(hd_id)s @ %(ip)s still not "
|
LOG.info(_LI("Hosting device: %(hd_id)s @ %(ip)s still not "
|
||||||
"reachable "), {'hd_id': hd_id,
|
"reachable "), {'hd_id': hd_id,
|
||||||
'ip': hd['management_ip_address']})
|
'ip': hd['management_ip_address']})
|
||||||
if timeutils.is_older_than(
|
if timeutils.is_older_than(
|
||||||
|
|
|
@ -25,7 +25,7 @@ from neutron.common import utils as common_utils
|
||||||
from neutron import context as n_context
|
from neutron import context as n_context
|
||||||
from neutron.openstack.common import excutils
|
from neutron.openstack.common import excutils
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
from neutron.openstack.common.gettextutils import _LE, _LI, _LW
|
||||||
from neutron.plugins.cisco.cfg_agent import cfg_exceptions
|
from neutron.plugins.cisco.cfg_agent import cfg_exceptions
|
||||||
from neutron.plugins.cisco.cfg_agent.device_drivers import driver_mgr
|
from neutron.plugins.cisco.cfg_agent.device_drivers import driver_mgr
|
||||||
from neutron.plugins.cisco.cfg_agent import device_status
|
from neutron.plugins.cisco.cfg_agent import device_status
|
||||||
|
@ -226,7 +226,7 @@ class RoutingServiceHelper():
|
||||||
self._drivermgr.remove_driver_for_hosting_device(hd_id)
|
self._drivermgr.remove_driver_for_hosting_device(hd_id)
|
||||||
LOG.debug("Routing service processing successfully completed")
|
LOG.debug("Routing service processing successfully completed")
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_("Failed processing routers"))
|
LOG.exception(_LE("Failed processing routers"))
|
||||||
self.fullsync = True
|
self.fullsync = True
|
||||||
|
|
||||||
def collect_state(self, configurations):
|
def collect_state(self, configurations):
|
||||||
|
@ -287,7 +287,7 @@ class RoutingServiceHelper():
|
||||||
return self.plugin_rpc.get_routers(self.context,
|
return self.plugin_rpc.get_routers(self.context,
|
||||||
hd_ids=device_ids)
|
hd_ids=device_ids)
|
||||||
except messaging.MessagingException:
|
except messaging.MessagingException:
|
||||||
LOG.exception(_("RPC Error in fetching routers from plugin"))
|
LOG.exception(_LE("RPC Error in fetching routers from plugin"))
|
||||||
self.fullsync = True
|
self.fullsync = True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -374,7 +374,7 @@ class RoutingServiceHelper():
|
||||||
cur_router_ids.add(r['id'])
|
cur_router_ids.add(r['id'])
|
||||||
hd = r['hosting_device']
|
hd = r['hosting_device']
|
||||||
if not self._dev_status.is_hosting_device_reachable(hd):
|
if not self._dev_status.is_hosting_device_reachable(hd):
|
||||||
LOG.info(_("Router: %(id)s is on an unreachable "
|
LOG.info(_LI("Router: %(id)s is on an unreachable "
|
||||||
"hosting device. "), {'id': r['id']})
|
"hosting device. "), {'id': r['id']})
|
||||||
continue
|
continue
|
||||||
if r['id'] not in self.router_info:
|
if r['id'] not in self.router_info:
|
||||||
|
@ -383,11 +383,11 @@ class RoutingServiceHelper():
|
||||||
ri.router = r
|
ri.router = r
|
||||||
self._process_router(ri)
|
self._process_router(ri)
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
LOG.exception(_("Key Error, missing key: %s"), e)
|
LOG.exception(_LE("Key Error, missing key: %s"), e)
|
||||||
self.updated_routers.add(r['id'])
|
self.updated_routers.add(r['id'])
|
||||||
continue
|
continue
|
||||||
except cfg_exceptions.DriverException as e:
|
except cfg_exceptions.DriverException as e:
|
||||||
LOG.exception(_("Driver Exception on router:%(id)s. "
|
LOG.exception(_LE("Driver Exception on router:%(id)s. "
|
||||||
"Error is %(e)s"), {'id': r['id'], 'e': e})
|
"Error is %(e)s"), {'id': r['id'], 'e': e})
|
||||||
self.updated_routers.update(r['id'])
|
self.updated_routers.update(r['id'])
|
||||||
continue
|
continue
|
||||||
|
@ -398,7 +398,7 @@ class RoutingServiceHelper():
|
||||||
for router in removed_routers:
|
for router in removed_routers:
|
||||||
self._router_removed(router['id'])
|
self._router_removed(router['id'])
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_("Exception in processing routers on device:%s"),
|
LOG.exception(_LE("Exception in processing routers on device:%s"),
|
||||||
device_id)
|
device_id)
|
||||||
self.sync_devices.add(device_id)
|
self.sync_devices.add(device_id)
|
||||||
|
|
||||||
|
@ -541,7 +541,7 @@ class RoutingServiceHelper():
|
||||||
"""
|
"""
|
||||||
ri = self.router_info.get(router_id)
|
ri = self.router_info.get(router_id)
|
||||||
if ri is None:
|
if ri is None:
|
||||||
LOG.warn(_("Info for router %s was not found. "
|
LOG.warning(_LW("Info for router %s was not found. "
|
||||||
"Skipping router removal"), router_id)
|
"Skipping router removal"), router_id)
|
||||||
return
|
return
|
||||||
ri.router['gw_port'] = None
|
ri.router['gw_port'] = None
|
||||||
|
@ -556,7 +556,7 @@ class RoutingServiceHelper():
|
||||||
del self.router_info[router_id]
|
del self.router_info[router_id]
|
||||||
self.removed_routers.discard(router_id)
|
self.removed_routers.discard(router_id)
|
||||||
except cfg_exceptions.DriverException:
|
except cfg_exceptions.DriverException:
|
||||||
LOG.warn(_("Router remove for router_id: %s was incomplete. "
|
LOG.warning(_LW("Router remove for router_id: %s was incomplete. "
|
||||||
"Adding the router to removed_routers list"), router_id)
|
"Adding the router to removed_routers list"), router_id)
|
||||||
self.removed_routers.add(router_id)
|
self.removed_routers.add(router_id)
|
||||||
# remove this router from updated_routers if it is there. It might
|
# remove this router from updated_routers if it is there. It might
|
||||||
|
@ -634,6 +634,7 @@ class RoutingServiceHelper():
|
||||||
if not ips:
|
if not ips:
|
||||||
raise Exception(_("Router port %s has no IP address") % port['id'])
|
raise Exception(_("Router port %s has no IP address") % port['id'])
|
||||||
if len(ips) > 1:
|
if len(ips) > 1:
|
||||||
LOG.error(_("Ignoring multiple IPs on router port %s"), port['id'])
|
LOG.error(_LE("Ignoring multiple IPs on router port %s"),
|
||||||
|
port['id'])
|
||||||
prefixlen = netaddr.IPNetwork(port['subnet']['cidr']).prefixlen
|
prefixlen = netaddr.IPNetwork(port['subnet']['cidr']).prefixlen
|
||||||
port['ip_cidr'] = "%s/%s" % (ips[0]['ip_address'], prefixlen)
|
port['ip_cidr'] = "%s/%s" % (ips[0]['ip_address'], prefixlen)
|
||||||
|
|
|
@ -29,6 +29,7 @@ from neutron.openstack.common import importutils
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common import timeutils
|
from neutron.openstack.common import timeutils
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
|
from neutron.openstack.common.gettextutils import _LE, _LI, _LW
|
||||||
from neutron.plugins.cisco.common import cisco_constants as c_constants
|
from neutron.plugins.cisco.common import cisco_constants as c_constants
|
||||||
from neutron.plugins.cisco.db.l3 import l3_models
|
from neutron.plugins.cisco.db.l3 import l3_models
|
||||||
from neutron.plugins.cisco.l3 import service_vm_lib
|
from neutron.plugins.cisco.l3 import service_vm_lib
|
||||||
|
@ -119,10 +120,10 @@ class DeviceHandlingMixin(object):
|
||||||
name=cfg.CONF.general.l3_admin_tenant)
|
name=cfg.CONF.general.l3_admin_tenant)
|
||||||
cls._l3_tenant_uuid = tenant.id
|
cls._l3_tenant_uuid = tenant.id
|
||||||
except k_exceptions.NotFound:
|
except k_exceptions.NotFound:
|
||||||
LOG.error(_('No tenant with a name or ID of %s exists.'),
|
LOG.error(_LE('No tenant with a name or ID of %s exists.'),
|
||||||
cfg.CONF.general.l3_admin_tenant)
|
cfg.CONF.general.l3_admin_tenant)
|
||||||
except k_exceptions.NoUniqueMatch:
|
except k_exceptions.NoUniqueMatch:
|
||||||
LOG.error(_('Multiple tenants matches found for %s'),
|
LOG.error(_LE('Multiple tenants matches found for %s'),
|
||||||
cfg.CONF.general.l3_admin_tenant)
|
cfg.CONF.general.l3_admin_tenant)
|
||||||
return cls._l3_tenant_uuid
|
return cls._l3_tenant_uuid
|
||||||
|
|
||||||
|
@ -141,21 +142,21 @@ class DeviceHandlingMixin(object):
|
||||||
if len(net) == 1:
|
if len(net) == 1:
|
||||||
num_subnets = len(net[0]['subnets'])
|
num_subnets = len(net[0]['subnets'])
|
||||||
if num_subnets == 0:
|
if num_subnets == 0:
|
||||||
LOG.error(_('The virtual management network has no '
|
LOG.error(_LE('The virtual management network has no '
|
||||||
'subnet. Please assign one.'))
|
'subnet. Please assign one.'))
|
||||||
return
|
return
|
||||||
elif num_subnets > 1:
|
elif num_subnets > 1:
|
||||||
LOG.info(_('The virtual management network has %d '
|
LOG.info(_LI('The virtual management network has %d '
|
||||||
'subnets. The first one will be used.'),
|
'subnets. The first one will be used.'),
|
||||||
num_subnets)
|
num_subnets)
|
||||||
cls._mgmt_nw_uuid = net[0].get('id')
|
cls._mgmt_nw_uuid = net[0].get('id')
|
||||||
elif len(net) > 1:
|
elif len(net) > 1:
|
||||||
# Management network must have a unique name.
|
# Management network must have a unique name.
|
||||||
LOG.error(_('The virtual management network does not have '
|
LOG.error(_LE('The virtual management network does not have '
|
||||||
'unique name. Please ensure that it is.'))
|
'unique name. Please ensure that it is.'))
|
||||||
else:
|
else:
|
||||||
# Management network has not been created.
|
# Management network has not been created.
|
||||||
LOG.error(_('There is no virtual management network. Please '
|
LOG.error(_LE('There is no virtual management network. Please '
|
||||||
'create one.'))
|
'create one.'))
|
||||||
return cls._mgmt_nw_uuid
|
return cls._mgmt_nw_uuid
|
||||||
|
|
||||||
|
@ -177,12 +178,12 @@ class DeviceHandlingMixin(object):
|
||||||
cls._mgmt_sec_grp_id = res[0].get('id')
|
cls._mgmt_sec_grp_id = res[0].get('id')
|
||||||
elif len(res) > 1:
|
elif len(res) > 1:
|
||||||
# the mgmt sec group must be unique.
|
# the mgmt sec group must be unique.
|
||||||
LOG.error(_('The security group for the virtual management '
|
LOG.error(_LE('The security group for the virtual management '
|
||||||
'network does not have unique name. Please ensure '
|
'network does not have unique name. Please ensure '
|
||||||
'that it is.'))
|
'that it is.'))
|
||||||
else:
|
else:
|
||||||
# CSR Mgmt security group is not present.
|
# CSR Mgmt security group is not present.
|
||||||
LOG.error(_('There is no security group for the virtual '
|
LOG.error(_LE('There is no security group for the virtual '
|
||||||
'management network. Please create one.'))
|
'management network. Please create one.'))
|
||||||
return cls._mgmt_sec_grp_id
|
return cls._mgmt_sec_grp_id
|
||||||
|
|
||||||
|
@ -196,7 +197,7 @@ class DeviceHandlingMixin(object):
|
||||||
cls._hosting_device_driver = importutils.import_object(
|
cls._hosting_device_driver = importutils.import_object(
|
||||||
cfg.CONF.hosting_devices.csr1kv_device_driver)
|
cfg.CONF.hosting_devices.csr1kv_device_driver)
|
||||||
except (ImportError, TypeError, n_exc.NeutronException):
|
except (ImportError, TypeError, n_exc.NeutronException):
|
||||||
LOG.exception(_('Error loading hosting device driver'))
|
LOG.exception(_LE('Error loading hosting device driver'))
|
||||||
return cls._hosting_device_driver
|
return cls._hosting_device_driver
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -209,7 +210,7 @@ class DeviceHandlingMixin(object):
|
||||||
cls._plugging_driver = importutils.import_object(
|
cls._plugging_driver = importutils.import_object(
|
||||||
cfg.CONF.hosting_devices.csr1kv_plugging_driver)
|
cfg.CONF.hosting_devices.csr1kv_plugging_driver)
|
||||||
except (ImportError, TypeError, n_exc.NeutronException):
|
except (ImportError, TypeError, n_exc.NeutronException):
|
||||||
LOG.exception(_('Error loading plugging driver'))
|
LOG.exception(_LE('Error loading plugging driver'))
|
||||||
return cls._plugging_driver
|
return cls._plugging_driver
|
||||||
|
|
||||||
def get_hosting_devices_qry(self, context, hosting_device_ids,
|
def get_hosting_devices_qry(self, context, hosting_device_ids,
|
||||||
|
@ -325,7 +326,8 @@ class DeviceHandlingMixin(object):
|
||||||
return False
|
return False
|
||||||
if self.is_agent_down(
|
if self.is_agent_down(
|
||||||
cfg_agent.heartbeat_timestamp):
|
cfg_agent.heartbeat_timestamp):
|
||||||
LOG.warn(_('Cisco cfg agent %s is not alive'), cfg_agent.id)
|
LOG.warning(_LW('Cisco cfg agent %s is not alive'),
|
||||||
|
cfg_agent.id)
|
||||||
query = context.session.query(l3_models.HostingDevice)
|
query = context.session.query(l3_models.HostingDevice)
|
||||||
query = query.filter_by(cfg_agent_id=None)
|
query = query.filter_by(cfg_agent_id=None)
|
||||||
for hd in query:
|
for hd in query:
|
||||||
|
@ -362,7 +364,7 @@ class DeviceHandlingMixin(object):
|
||||||
if self._svc_vm_mgr.nova_services_up():
|
if self._svc_vm_mgr.nova_services_up():
|
||||||
self.__class__._nova_running = True
|
self.__class__._nova_running = True
|
||||||
else:
|
else:
|
||||||
LOG.info(_('Not all Nova services are up and running. '
|
LOG.info(_LI('Not all Nova services are up and running. '
|
||||||
'Skipping this CSR1kv vm create request.'))
|
'Skipping this CSR1kv vm create request.'))
|
||||||
return
|
return
|
||||||
plugging_drv = self.get_hosting_device_plugging_driver()
|
plugging_drv = self.get_hosting_device_plugging_driver()
|
||||||
|
@ -399,7 +401,7 @@ class DeviceHandlingMixin(object):
|
||||||
plugging_drv.delete_hosting_device_resources(
|
plugging_drv.delete_hosting_device_resources(
|
||||||
context, self.l3_tenant_id(), **res)
|
context, self.l3_tenant_id(), **res)
|
||||||
return
|
return
|
||||||
LOG.info(_('Created a CSR1kv hosting device VM'))
|
LOG.info(_LI('Created a CSR1kv hosting device VM'))
|
||||||
return hosting_device
|
return hosting_device
|
||||||
|
|
||||||
def _delete_service_vm_hosting_device(self, context, hosting_device):
|
def _delete_service_vm_hosting_device(self, context, hosting_device):
|
||||||
|
@ -417,7 +419,7 @@ class DeviceHandlingMixin(object):
|
||||||
self.l3_tenant_id(), self.mgmt_nw_id())
|
self.l3_tenant_id(), self.mgmt_nw_id())
|
||||||
if not self._svc_vm_mgr.delete_service_vm(context,
|
if not self._svc_vm_mgr.delete_service_vm(context,
|
||||||
hosting_device['id']):
|
hosting_device['id']):
|
||||||
LOG.error(_('Failed to delete hosting device %s service VM. '
|
LOG.error(_LE('Failed to delete hosting device %s service VM. '
|
||||||
'Will un-register it anyway.'),
|
'Will un-register it anyway.'),
|
||||||
hosting_device['id'])
|
hosting_device['id'])
|
||||||
plugging_drv.delete_hosting_device_resources(
|
plugging_drv.delete_hosting_device_resources(
|
||||||
|
@ -458,7 +460,7 @@ class DeviceHandlingMixin(object):
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
active_cfg_agents = self._get_cfg_agents(context, active=True)
|
active_cfg_agents = self._get_cfg_agents(context, active=True)
|
||||||
if not active_cfg_agents:
|
if not active_cfg_agents:
|
||||||
LOG.warn(_('There are no active Cisco cfg agents'))
|
LOG.warning(_LW('There are no active Cisco cfg agents'))
|
||||||
# No worries, once a Cisco cfg agent is started and
|
# No worries, once a Cisco cfg agent is started and
|
||||||
# announces itself any "dangling" hosting devices
|
# announces itself any "dangling" hosting devices
|
||||||
# will be scheduled to it.
|
# will be scheduled to it.
|
||||||
|
|
|
@ -30,6 +30,7 @@ from neutron.db import l3_db
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
from neutron.db import portbindings_db as p_binding
|
from neutron.db import portbindings_db as p_binding
|
||||||
from neutron.extensions import providernet as pr_net
|
from neutron.extensions import providernet as pr_net
|
||||||
|
from neutron.openstack.common.gettextutils import _LE, _LI
|
||||||
from neutron.openstack.common import lockutils
|
from neutron.openstack.common import lockutils
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common import loopingcall
|
from neutron.openstack.common import loopingcall
|
||||||
|
@ -178,7 +179,7 @@ class L3RouterApplianceDBMixin(extraroute_db.ExtraRoute_dbonly_mixin):
|
||||||
port_db = self._get_router_port_db_on_subnet(
|
port_db = self._get_router_port_db_on_subnet(
|
||||||
context, router_id, subnet_db)
|
context, router_id, subnet_db)
|
||||||
else:
|
else:
|
||||||
msg = "Either subnet_id or port_id must be specified"
|
msg = _("Either subnet_id or port_id must be specified")
|
||||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||||
routers = [self.get_router(context, router_id)]
|
routers = [self.get_router(context, router_id)]
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
|
@ -314,7 +315,7 @@ class L3RouterApplianceDBMixin(extraroute_db.ExtraRoute_dbonly_mixin):
|
||||||
return sync_data
|
return sync_data
|
||||||
|
|
||||||
def schedule_router_on_hosting_device(self, context, r_hd_binding):
|
def schedule_router_on_hosting_device(self, context, r_hd_binding):
|
||||||
LOG.info(_('Attempting to schedule router %s.'),
|
LOG.info(_LI('Attempting to schedule router %s.'),
|
||||||
r_hd_binding['router']['id'])
|
r_hd_binding['router']['id'])
|
||||||
result = self._create_csr1kv_vm_hosting_device(context.elevated())
|
result = self._create_csr1kv_vm_hosting_device(context.elevated())
|
||||||
if result is None:
|
if result is None:
|
||||||
|
@ -326,14 +327,14 @@ class L3RouterApplianceDBMixin(extraroute_db.ExtraRoute_dbonly_mixin):
|
||||||
router = r_hd_binding['router']
|
router = r_hd_binding['router']
|
||||||
r_hd_binding.hosting_device = result
|
r_hd_binding.hosting_device = result
|
||||||
self.remove_router_from_backlog(router['id'])
|
self.remove_router_from_backlog(router['id'])
|
||||||
LOG.info(_('Successfully scheduled router %(r_id)s to '
|
LOG.info(_LI('Successfully scheduled router %(r_id)s to '
|
||||||
'hosting device %(d_id)s'),
|
'hosting device %(d_id)s'),
|
||||||
{'r_id': r_hd_binding['router']['id'],
|
{'r_id': r_hd_binding['router']['id'],
|
||||||
'd_id': result['id']})
|
'd_id': result['id']})
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def unschedule_router_from_hosting_device(self, context, r_hd_binding):
|
def unschedule_router_from_hosting_device(self, context, r_hd_binding):
|
||||||
LOG.info(_('Un-schedule router %s.'),
|
LOG.info(_LI('Un-schedule router %s.'),
|
||||||
r_hd_binding['router']['id'])
|
r_hd_binding['router']['id'])
|
||||||
hosting_device = r_hd_binding['hosting_device']
|
hosting_device = r_hd_binding['hosting_device']
|
||||||
if r_hd_binding['hosting_device'] is None:
|
if r_hd_binding['hosting_device'] is None:
|
||||||
|
@ -346,14 +347,14 @@ class L3RouterApplianceDBMixin(extraroute_db.ExtraRoute_dbonly_mixin):
|
||||||
if ((router or {}).get('id') is None or
|
if ((router or {}).get('id') is None or
|
||||||
router['id'] in self._backlogged_routers):
|
router['id'] in self._backlogged_routers):
|
||||||
return
|
return
|
||||||
LOG.info(_('Backlogging router %s for renewed scheduling attempt '
|
LOG.info(_LI('Backlogging router %s for renewed scheduling attempt '
|
||||||
'later'), router['id'])
|
'later'), router['id'])
|
||||||
self._backlogged_routers[router['id']] = router
|
self._backlogged_routers[router['id']] = router
|
||||||
|
|
||||||
@lockutils.synchronized('routers', 'neutron-')
|
@lockutils.synchronized('routers', 'neutron-')
|
||||||
def remove_router_from_backlog(self, id):
|
def remove_router_from_backlog(self, id):
|
||||||
self._backlogged_routers.pop(id, None)
|
self._backlogged_routers.pop(id, None)
|
||||||
LOG.info(_('Router %s removed from backlog'), id)
|
LOG.info(_LI('Router %s removed from backlog'), id)
|
||||||
|
|
||||||
@lockutils.synchronized('routerbacklog', 'neutron-')
|
@lockutils.synchronized('routerbacklog', 'neutron-')
|
||||||
def _process_backlogged_routers(self):
|
def _process_backlogged_routers(self):
|
||||||
|
@ -363,7 +364,7 @@ class L3RouterApplianceDBMixin(extraroute_db.ExtraRoute_dbonly_mixin):
|
||||||
return
|
return
|
||||||
context = n_context.get_admin_context()
|
context = n_context.get_admin_context()
|
||||||
scheduled_routers = []
|
scheduled_routers = []
|
||||||
LOG.info(_('Processing router (scheduling) backlog'))
|
LOG.info(_LI('Processing router (scheduling) backlog'))
|
||||||
# try to reschedule
|
# try to reschedule
|
||||||
for r_id, router in self._backlogged_routers.items():
|
for r_id, router in self._backlogged_routers.items():
|
||||||
self._add_type_and_hosting_device_info(context, router)
|
self._add_type_and_hosting_device_info(context, router)
|
||||||
|
@ -383,7 +384,7 @@ class L3RouterApplianceDBMixin(extraroute_db.ExtraRoute_dbonly_mixin):
|
||||||
interval=cfg.CONF.general.backlog_processing_interval)
|
interval=cfg.CONF.general.backlog_processing_interval)
|
||||||
|
|
||||||
def _sync_router_backlog(self):
|
def _sync_router_backlog(self):
|
||||||
LOG.info(_('Synchronizing router (scheduling) backlog'))
|
LOG.info(_LI('Synchronizing router (scheduling) backlog'))
|
||||||
context = n_context.get_admin_context()
|
context = n_context.get_admin_context()
|
||||||
query = context.session.query(l3_models.RouterHostingDeviceBinding)
|
query = context.session.query(l3_models.RouterHostingDeviceBinding)
|
||||||
query = query.options(joinedload('router'))
|
query = query.options(joinedload('router'))
|
||||||
|
@ -406,12 +407,12 @@ class L3RouterApplianceDBMixin(extraroute_db.ExtraRoute_dbonly_mixin):
|
||||||
return query.one()
|
return query.one()
|
||||||
except exc.NoResultFound:
|
except exc.NoResultFound:
|
||||||
# This should not happen
|
# This should not happen
|
||||||
LOG.error(_('DB inconsistency: No type and hosting info associated'
|
LOG.error(_LE('DB inconsistency: No type and hosting info '
|
||||||
' with router %s'), id)
|
'associated with router %s'), id)
|
||||||
raise RouterBindingInfoError(router_id=id)
|
raise RouterBindingInfoError(router_id=id)
|
||||||
except exc.MultipleResultsFound:
|
except exc.MultipleResultsFound:
|
||||||
# This should not happen either
|
# This should not happen either
|
||||||
LOG.error(_('DB inconsistency: Multiple type and hosting info'
|
LOG.error(_LE('DB inconsistency: Multiple type and hosting info '
|
||||||
'associated with router %s'), id)
|
'associated with router %s'), id)
|
||||||
raise RouterBindingInfoError(router_id=id)
|
raise RouterBindingInfoError(router_id=id)
|
||||||
|
|
||||||
|
@ -434,7 +435,7 @@ class L3RouterApplianceDBMixin(extraroute_db.ExtraRoute_dbonly_mixin):
|
||||||
binding_info = self._get_router_binding_info(context,
|
binding_info = self._get_router_binding_info(context,
|
||||||
router['id'])
|
router['id'])
|
||||||
except RouterBindingInfoError:
|
except RouterBindingInfoError:
|
||||||
LOG.error(_('DB inconsistency: No hosting info associated with '
|
LOG.error(_LE('DB inconsistency: No hosting info associated with '
|
||||||
'router %s'), router['id'])
|
'router %s'), router['id'])
|
||||||
router['hosting_device'] = None
|
router['hosting_device'] = None
|
||||||
return
|
return
|
||||||
|
@ -511,7 +512,7 @@ class L3RouterApplianceDBMixin(extraroute_db.ExtraRoute_dbonly_mixin):
|
||||||
alloc = plugging_driver.allocate_hosting_port(
|
alloc = plugging_driver.allocate_hosting_port(
|
||||||
context, router_id, port_db, network_type, hosting_device_id)
|
context, router_id, port_db, network_type, hosting_device_id)
|
||||||
if alloc is None:
|
if alloc is None:
|
||||||
LOG.error(_('Failed to allocate hosting port for port %s'),
|
LOG.error(_LE('Failed to allocate hosting port for port %s'),
|
||||||
port_db['id'])
|
port_db['id'])
|
||||||
return
|
return
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
|
|
|
@ -22,6 +22,7 @@ from neutron.common import constants
|
||||||
from neutron.common import exceptions as n_exc
|
from neutron.common import exceptions as n_exc
|
||||||
import neutron.db.api as db
|
import neutron.db.api as db
|
||||||
from neutron.db import models_v2
|
from neutron.db import models_v2
|
||||||
|
from neutron.openstack.common.gettextutils import _LW
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.plugins.cisco.common import cisco_constants as c_const
|
from neutron.plugins.cisco.common import cisco_constants as c_const
|
||||||
from neutron.plugins.cisco.common import cisco_exceptions as c_exc
|
from neutron.plugins.cisco.common import cisco_exceptions as c_exc
|
||||||
|
@ -322,7 +323,7 @@ def get_segment_range(network_profile):
|
||||||
# Sort the range to ensure min, max is in order
|
# Sort the range to ensure min, max is in order
|
||||||
seg_min, seg_max = sorted(
|
seg_min, seg_max = sorted(
|
||||||
int(i) for i in network_profile.segment_range.split('-'))
|
int(i) for i in network_profile.segment_range.split('-'))
|
||||||
LOG.debug(_("seg_min %(seg_min)s, seg_max %(seg_max)s"),
|
LOG.debug("seg_min %(seg_min)s, seg_max %(seg_max)s",
|
||||||
{'seg_min': seg_min, 'seg_max': seg_max})
|
{'seg_min': seg_min, 'seg_max': seg_max})
|
||||||
return seg_min, seg_max
|
return seg_min, seg_max
|
||||||
|
|
||||||
|
@ -553,8 +554,8 @@ def reserve_specific_vlan(db_session, physical_network, vlan_id):
|
||||||
else:
|
else:
|
||||||
raise n_exc.VlanIdInUse(vlan_id=vlan_id,
|
raise n_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||||
physical_network=physical_network)
|
physical_network=physical_network)
|
||||||
LOG.debug(_("Reserving specific vlan %(vlan)s on physical "
|
LOG.debug("Reserving specific vlan %(vlan)s on physical network "
|
||||||
"network %(network)s from pool"),
|
"%(network)s from pool",
|
||||||
{"vlan": vlan_id, "network": physical_network})
|
{"vlan": vlan_id, "network": physical_network})
|
||||||
alloc.allocated = True
|
alloc.allocated = True
|
||||||
db_session.add(alloc)
|
db_session.add(alloc)
|
||||||
|
@ -578,7 +579,7 @@ def release_vlan(db_session, physical_network, vlan_id):
|
||||||
one())
|
one())
|
||||||
alloc.allocated = False
|
alloc.allocated = False
|
||||||
except exc.NoResultFound:
|
except exc.NoResultFound:
|
||||||
LOG.warning(_("vlan_id %(vlan)s on physical network %(network)s "
|
LOG.warning(_LW("vlan_id %(vlan)s on physical network %(network)s "
|
||||||
"not found"),
|
"not found"),
|
||||||
{"vlan": vlan_id, "network": physical_network})
|
{"vlan": vlan_id, "network": physical_network})
|
||||||
|
|
||||||
|
@ -634,7 +635,7 @@ def reserve_specific_vxlan(db_session, vxlan_id):
|
||||||
one())
|
one())
|
||||||
if alloc.allocated:
|
if alloc.allocated:
|
||||||
raise c_exc.VxlanIDInUse(vxlan_id=vxlan_id)
|
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)
|
||||||
alloc.allocated = True
|
alloc.allocated = True
|
||||||
db_session.add(alloc)
|
db_session.add(alloc)
|
||||||
except exc.NoResultFound:
|
except exc.NoResultFound:
|
||||||
|
@ -655,7 +656,7 @@ def release_vxlan(db_session, vxlan_id):
|
||||||
one())
|
one())
|
||||||
alloc.allocated = False
|
alloc.allocated = False
|
||||||
except exc.NoResultFound:
|
except exc.NoResultFound:
|
||||||
LOG.warning(_("vxlan_id %s not found"), vxlan_id)
|
LOG.warning(_LW("vxlan_id %s not found"), vxlan_id)
|
||||||
|
|
||||||
|
|
||||||
def set_port_status(port_id, status):
|
def set_port_status(port_id, status):
|
||||||
|
@ -764,7 +765,7 @@ def delete_vm_network(db_session, policy_profile_id, network_id):
|
||||||
|
|
||||||
def create_network_profile(db_session, network_profile):
|
def create_network_profile(db_session, network_profile):
|
||||||
"""Create a network profile."""
|
"""Create a network profile."""
|
||||||
LOG.debug(_("create_network_profile()"))
|
LOG.debug("create_network_profile()")
|
||||||
with db_session.begin(subtransactions=True):
|
with db_session.begin(subtransactions=True):
|
||||||
kwargs = {"name": network_profile["name"],
|
kwargs = {"name": network_profile["name"],
|
||||||
"segment_type": network_profile["segment_type"]}
|
"segment_type": network_profile["segment_type"]}
|
||||||
|
@ -786,7 +787,7 @@ def create_network_profile(db_session, network_profile):
|
||||||
|
|
||||||
def delete_network_profile(db_session, id):
|
def delete_network_profile(db_session, id):
|
||||||
"""Delete Network Profile."""
|
"""Delete Network Profile."""
|
||||||
LOG.debug(_("delete_network_profile()"))
|
LOG.debug("delete_network_profile()")
|
||||||
with db_session.begin(subtransactions=True):
|
with db_session.begin(subtransactions=True):
|
||||||
try:
|
try:
|
||||||
network_profile = get_network_profile(db_session, id)
|
network_profile = get_network_profile(db_session, id)
|
||||||
|
@ -800,7 +801,7 @@ def delete_network_profile(db_session, id):
|
||||||
|
|
||||||
def update_network_profile(db_session, id, network_profile):
|
def update_network_profile(db_session, id, network_profile):
|
||||||
"""Update Network Profile."""
|
"""Update Network Profile."""
|
||||||
LOG.debug(_("update_network_profile()"))
|
LOG.debug("update_network_profile()")
|
||||||
with db_session.begin(subtransactions=True):
|
with db_session.begin(subtransactions=True):
|
||||||
profile = get_network_profile(db_session, id)
|
profile = get_network_profile(db_session, id)
|
||||||
profile.update(network_profile)
|
profile.update(network_profile)
|
||||||
|
@ -809,7 +810,7 @@ def update_network_profile(db_session, id, network_profile):
|
||||||
|
|
||||||
def get_network_profile(db_session, id):
|
def get_network_profile(db_session, id):
|
||||||
"""Get Network Profile."""
|
"""Get Network Profile."""
|
||||||
LOG.debug(_("get_network_profile()"))
|
LOG.debug("get_network_profile()")
|
||||||
try:
|
try:
|
||||||
return db_session.query(
|
return db_session.query(
|
||||||
n1kv_models_v2.NetworkProfile).filter_by(id=id).one()
|
n1kv_models_v2.NetworkProfile).filter_by(id=id).one()
|
||||||
|
@ -834,7 +835,7 @@ def _get_network_profiles(db_session=None, physical_network=None):
|
||||||
|
|
||||||
def create_policy_profile(policy_profile):
|
def create_policy_profile(policy_profile):
|
||||||
"""Create Policy Profile."""
|
"""Create Policy Profile."""
|
||||||
LOG.debug(_("create_policy_profile()"))
|
LOG.debug("create_policy_profile()")
|
||||||
db_session = db.get_session()
|
db_session = db.get_session()
|
||||||
with db_session.begin(subtransactions=True):
|
with db_session.begin(subtransactions=True):
|
||||||
p_profile = n1kv_models_v2.PolicyProfile(id=policy_profile["id"],
|
p_profile = n1kv_models_v2.PolicyProfile(id=policy_profile["id"],
|
||||||
|
@ -845,7 +846,7 @@ def create_policy_profile(policy_profile):
|
||||||
|
|
||||||
def delete_policy_profile(id):
|
def delete_policy_profile(id):
|
||||||
"""Delete Policy Profile."""
|
"""Delete Policy Profile."""
|
||||||
LOG.debug(_("delete_policy_profile()"))
|
LOG.debug("delete_policy_profile()")
|
||||||
db_session = db.get_session()
|
db_session = db.get_session()
|
||||||
with db_session.begin(subtransactions=True):
|
with db_session.begin(subtransactions=True):
|
||||||
policy_profile = get_policy_profile(db_session, id)
|
policy_profile = get_policy_profile(db_session, id)
|
||||||
|
@ -854,7 +855,7 @@ def delete_policy_profile(id):
|
||||||
|
|
||||||
def update_policy_profile(db_session, id, policy_profile):
|
def update_policy_profile(db_session, id, policy_profile):
|
||||||
"""Update a policy profile."""
|
"""Update a policy profile."""
|
||||||
LOG.debug(_("update_policy_profile()"))
|
LOG.debug("update_policy_profile()")
|
||||||
with db_session.begin(subtransactions=True):
|
with db_session.begin(subtransactions=True):
|
||||||
_profile = get_policy_profile(db_session, id)
|
_profile = get_policy_profile(db_session, id)
|
||||||
_profile.update(policy_profile)
|
_profile.update(policy_profile)
|
||||||
|
@ -863,7 +864,7 @@ def update_policy_profile(db_session, id, policy_profile):
|
||||||
|
|
||||||
def get_policy_profile(db_session, id):
|
def get_policy_profile(db_session, id):
|
||||||
"""Get Policy Profile."""
|
"""Get Policy Profile."""
|
||||||
LOG.debug(_("get_policy_profile()"))
|
LOG.debug("get_policy_profile()")
|
||||||
try:
|
try:
|
||||||
return db_session.query(
|
return db_session.query(
|
||||||
n1kv_models_v2.PolicyProfile).filter_by(id=id).one()
|
n1kv_models_v2.PolicyProfile).filter_by(id=id).one()
|
||||||
|
@ -900,7 +901,7 @@ def create_profile_binding(db_session, tenant_id, profile_id, profile_type):
|
||||||
|
|
||||||
def _profile_binding_exists(db_session, tenant_id, profile_id, profile_type):
|
def _profile_binding_exists(db_session, tenant_id, profile_id, profile_type):
|
||||||
"""Check if the profile-tenant binding exists."""
|
"""Check if the profile-tenant binding exists."""
|
||||||
LOG.debug(_("_profile_binding_exists()"))
|
LOG.debug("_profile_binding_exists()")
|
||||||
db_session = db_session or db.get_session()
|
db_session = db_session or db.get_session()
|
||||||
return (db_session.query(n1kv_models_v2.ProfileBinding).
|
return (db_session.query(n1kv_models_v2.ProfileBinding).
|
||||||
filter_by(tenant_id=tenant_id, profile_id=profile_id,
|
filter_by(tenant_id=tenant_id, profile_id=profile_id,
|
||||||
|
@ -909,7 +910,7 @@ def _profile_binding_exists(db_session, tenant_id, profile_id, profile_type):
|
||||||
|
|
||||||
def get_profile_binding(db_session, tenant_id, profile_id):
|
def get_profile_binding(db_session, tenant_id, profile_id):
|
||||||
"""Get Network/Policy Profile - Tenant binding."""
|
"""Get Network/Policy Profile - Tenant binding."""
|
||||||
LOG.debug(_("get_profile_binding()"))
|
LOG.debug("get_profile_binding()")
|
||||||
try:
|
try:
|
||||||
return (db_session.query(n1kv_models_v2.ProfileBinding).filter_by(
|
return (db_session.query(n1kv_models_v2.ProfileBinding).filter_by(
|
||||||
tenant_id=tenant_id, profile_id=profile_id).one())
|
tenant_id=tenant_id, profile_id=profile_id).one())
|
||||||
|
@ -919,15 +920,15 @@ def get_profile_binding(db_session, tenant_id, profile_id):
|
||||||
|
|
||||||
def delete_profile_binding(db_session, tenant_id, profile_id):
|
def delete_profile_binding(db_session, tenant_id, profile_id):
|
||||||
"""Delete Policy Binding."""
|
"""Delete Policy Binding."""
|
||||||
LOG.debug(_("delete_profile_binding()"))
|
LOG.debug("delete_profile_binding()")
|
||||||
db_session = db_session or db.get_session()
|
db_session = db_session or db.get_session()
|
||||||
try:
|
try:
|
||||||
binding = get_profile_binding(db_session, tenant_id, profile_id)
|
binding = get_profile_binding(db_session, tenant_id, profile_id)
|
||||||
with db_session.begin(subtransactions=True):
|
with db_session.begin(subtransactions=True):
|
||||||
db_session.delete(binding)
|
db_session.delete(binding)
|
||||||
except c_exc.ProfileTenantBindingNotFound:
|
except c_exc.ProfileTenantBindingNotFound:
|
||||||
LOG.debug(_("Profile-Tenant binding missing for profile ID "
|
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})
|
{"profile_id": profile_id, "tenant_id": tenant_id})
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
def get_all_qoss(tenant_id):
|
def get_all_qoss(tenant_id):
|
||||||
"""Lists all the qos to tenant associations."""
|
"""Lists all the qos to tenant associations."""
|
||||||
LOG.debug(_("get_all_qoss() called"))
|
LOG.debug("get_all_qoss() called")
|
||||||
session = db.get_session()
|
session = db.get_session()
|
||||||
return (session.query(network_models_v2.QoS).
|
return (session.query(network_models_v2.QoS).
|
||||||
filter_by(tenant_id=tenant_id).all())
|
filter_by(tenant_id=tenant_id).all())
|
||||||
|
@ -35,7 +35,7 @@ def get_all_qoss(tenant_id):
|
||||||
|
|
||||||
def get_qos(tenant_id, qos_id):
|
def get_qos(tenant_id, qos_id):
|
||||||
"""Lists the qos given a tenant_id and qos_id."""
|
"""Lists the qos given a tenant_id and qos_id."""
|
||||||
LOG.debug(_("get_qos() called"))
|
LOG.debug("get_qos() called")
|
||||||
session = db.get_session()
|
session = db.get_session()
|
||||||
try:
|
try:
|
||||||
return (session.query(network_models_v2.QoS).
|
return (session.query(network_models_v2.QoS).
|
||||||
|
@ -48,7 +48,7 @@ def get_qos(tenant_id, qos_id):
|
||||||
|
|
||||||
def add_qos(tenant_id, qos_name, qos_desc):
|
def add_qos(tenant_id, qos_name, qos_desc):
|
||||||
"""Adds a qos to tenant association."""
|
"""Adds a qos to tenant association."""
|
||||||
LOG.debug(_("add_qos() called"))
|
LOG.debug("add_qos() called")
|
||||||
session = db.get_session()
|
session = db.get_session()
|
||||||
try:
|
try:
|
||||||
qos = (session.query(network_models_v2.QoS).
|
qos = (session.query(network_models_v2.QoS).
|
||||||
|
|
|
@ -17,6 +17,7 @@ import netaddr
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
|
from neutron.openstack.common.gettextutils import _LE
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.plugins.cisco.l3 import hosting_device_drivers
|
from neutron.plugins.cisco.l3 import hosting_device_drivers
|
||||||
|
|
||||||
|
@ -63,7 +64,7 @@ class CSR1kvHostingDeviceDriver(hosting_device_drivers.HostingDeviceDriver):
|
||||||
vm_cfg_data += line
|
vm_cfg_data += line
|
||||||
return {'iosxe_config.txt': vm_cfg_data}
|
return {'iosxe_config.txt': vm_cfg_data}
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
LOG.error(_('Failed to create config file: %s. Trying to'
|
LOG.error(_LE('Failed to create config file: %s. Trying to'
|
||||||
'clean up.'), str(e))
|
'clean up.'), str(e))
|
||||||
self.delete_configdrive_files(context, mgmtport)
|
self.delete_configdrive_files(context, mgmtport)
|
||||||
raise
|
raise
|
||||||
|
|
|
@ -25,6 +25,7 @@ from neutron.db import models_v2
|
||||||
from neutron.extensions import providernet as pr_net
|
from neutron.extensions import providernet as pr_net
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
|
from neutron.openstack.common.gettextutils import _LE, _LI, _LW
|
||||||
from neutron.plugins.cisco.db.l3 import l3_models
|
from neutron.plugins.cisco.db.l3 import l3_models
|
||||||
from neutron.plugins.cisco.extensions import n1kv
|
from neutron.plugins.cisco.extensions import n1kv
|
||||||
import neutron.plugins.cisco.l3.plugging_drivers as plug
|
import neutron.plugins.cisco.l3.plugging_drivers as plug
|
||||||
|
@ -104,12 +105,12 @@ class N1kvTrunkingPlugDriver(plug.PluginSidePluggingDriver):
|
||||||
return profiles[0]['id']
|
return profiles[0]['id']
|
||||||
elif len(profiles) > 1:
|
elif len(profiles) > 1:
|
||||||
# Profile must have a unique name.
|
# Profile must have a unique name.
|
||||||
LOG.error(_('The %(resource)s %(name)s does not have unique name. '
|
LOG.error(_LE('The %(resource)s %(name)s does not have unique '
|
||||||
'Please refer to admin guide and create one.'),
|
'name. Please refer to admin guide and create one.'),
|
||||||
{'resource': resource, 'name': name})
|
{'resource': resource, 'name': name})
|
||||||
else:
|
else:
|
||||||
# Profile has not been created.
|
# Profile has not been created.
|
||||||
LOG.error(_('There is no %(resource)s %(name)s. Please refer to '
|
LOG.error(_LE('There is no %(resource)s %(name)s. Please refer to '
|
||||||
'admin guide and create one.'),
|
'admin guide and create one.'),
|
||||||
{'resource': resource, 'name': name})
|
{'resource': resource, 'name': name})
|
||||||
|
|
||||||
|
@ -209,7 +210,7 @@ class N1kvTrunkingPlugDriver(plug.PluginSidePluggingDriver):
|
||||||
n1kv_const.T2_PORT_NAME, self.t2_port_profile_id(),
|
n1kv_const.T2_PORT_NAME, self.t2_port_profile_id(),
|
||||||
t_p)
|
t_p)
|
||||||
except n_exc.NeutronException as e:
|
except n_exc.NeutronException as e:
|
||||||
LOG.error(_('Error %s when creating service VM resources. '
|
LOG.error(_LE('Error %s when creating service VM resources. '
|
||||||
'Cleaning up.'), e)
|
'Cleaning up.'), e)
|
||||||
resources = {'ports': t_p, 'networks': t1_n + t2_n,
|
resources = {'ports': t_p, 'networks': t1_n + t2_n,
|
||||||
'subnets': t1_sn + t2_sn}
|
'subnets': t1_sn + t2_sn}
|
||||||
|
@ -280,13 +281,14 @@ class N1kvTrunkingPlugDriver(plug.PluginSidePluggingDriver):
|
||||||
|
|
||||||
while mgmt_port is not None or port_ids or subnet_ids or net_ids:
|
while mgmt_port is not None or port_ids or subnet_ids or net_ids:
|
||||||
if attempts == DELETION_ATTEMPTS:
|
if attempts == DELETION_ATTEMPTS:
|
||||||
LOG.warning(_('Aborting resource deletion after %d '
|
LOG.warning(_LW('Aborting resource deletion after %d '
|
||||||
'unsuccessful attempts'), DELETION_ATTEMPTS)
|
'unsuccessful attempts'), DELETION_ATTEMPTS)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
if attempts > 1:
|
if attempts > 1:
|
||||||
eventlet.sleep(SECONDS_BETWEEN_DELETION_ATTEMPTS)
|
eventlet.sleep(SECONDS_BETWEEN_DELETION_ATTEMPTS)
|
||||||
LOG.info(_('Resource deletion attempt %d starting'), attempts)
|
LOG.info(_LI('Resource deletion attempt %d starting'),
|
||||||
|
attempts)
|
||||||
# Remove anything created.
|
# Remove anything created.
|
||||||
if mgmt_port is not None:
|
if mgmt_port is not None:
|
||||||
ml = set([mgmt_port['id']])
|
ml = set([mgmt_port['id']])
|
||||||
|
@ -305,7 +307,7 @@ class N1kvTrunkingPlugDriver(plug.PluginSidePluggingDriver):
|
||||||
self._core_plugin.delete_network,
|
self._core_plugin.delete_network,
|
||||||
n_exc.NetworkNotFound, net_ids)
|
n_exc.NetworkNotFound, net_ids)
|
||||||
attempts += 1
|
attempts += 1
|
||||||
LOG.info(_('Resource deletion succeeded'))
|
LOG.info(_LI('Resource deletion succeeded'))
|
||||||
|
|
||||||
def _delete_resources(self, context, name, deleter, exception_type,
|
def _delete_resources(self, context, name, deleter, exception_type,
|
||||||
resource_ids):
|
resource_ids):
|
||||||
|
@ -316,7 +318,7 @@ class N1kvTrunkingPlugDriver(plug.PluginSidePluggingDriver):
|
||||||
except exception_type:
|
except exception_type:
|
||||||
resource_ids.remove(item_id)
|
resource_ids.remove(item_id)
|
||||||
except n_exc.NeutronException as e:
|
except n_exc.NeutronException as e:
|
||||||
LOG.error(_('Failed to delete %(resource_name)s %(net_id)s '
|
LOG.error(_LE('Failed to delete %(resource_name)s %(net_id)s '
|
||||||
'for service vm due to %(err)s'),
|
'for service vm due to %(err)s'),
|
||||||
{'resource_name': name, 'net_id': item_id, 'err': e})
|
{'resource_name': name, 'net_id': item_id, 'err': e})
|
||||||
|
|
||||||
|
@ -408,7 +410,7 @@ class N1kvTrunkingPlugDriver(plug.PluginSidePluggingDriver):
|
||||||
str(port_db.hosting_info.segmentation_id))
|
str(port_db.hosting_info.segmentation_id))
|
||||||
else:
|
else:
|
||||||
trunk_spec = port_db['network_id']
|
trunk_spec = port_db['network_id']
|
||||||
LOG.info(_('Updating trunk: %(action)s VLAN %(tag)d for network_id '
|
LOG.info(_LI('Updating trunk: %(action)s VLAN %(tag)d for network_id '
|
||||||
'%(id)s'), {'action': action,
|
'%(id)s'), {'action': action,
|
||||||
'tag': port_db.hosting_info.segmentation_id,
|
'tag': port_db.hosting_info.segmentation_id,
|
||||||
'id': port_db['network_id']})
|
'id': port_db['network_id']})
|
||||||
|
@ -448,14 +450,14 @@ class N1kvTrunkingPlugDriver(plug.PluginSidePluggingDriver):
|
||||||
if res is None:
|
if res is None:
|
||||||
if attempts >= MAX_HOSTING_PORT_LOOKUP_ATTEMPTS:
|
if attempts >= MAX_HOSTING_PORT_LOOKUP_ATTEMPTS:
|
||||||
# This should not happen ...
|
# This should not happen ...
|
||||||
LOG.error(_('Hosting port DB inconsistency for '
|
LOG.error(_LE('Hosting port DB inconsistency for '
|
||||||
'hosting device %s'), hd_id)
|
'hosting device %s'), hd_id)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
# The service VM may not have plugged its VIF into the
|
# The service VM may not have plugged its VIF into the
|
||||||
# Neutron Port yet so we wait and make another lookup.
|
# Neutron Port yet so we wait and make another lookup.
|
||||||
attempts += 1
|
attempts += 1
|
||||||
LOG.info(_('Attempt %(attempt)d to find trunk ports for '
|
LOG.info(_LI('Attempt %(attempt)d to find trunk ports for '
|
||||||
'hosting device %(hd_id)s failed. Trying '
|
'hosting device %(hd_id)s failed. Trying '
|
||||||
'again in %(time)d seconds.'),
|
'again in %(time)d seconds.'),
|
||||||
{'attempt': attempts, 'hd_id': hd_id,
|
{'attempt': attempts, 'hd_id': hd_id,
|
||||||
|
@ -501,6 +503,6 @@ class N1kvTrunkingPlugDriver(plug.PluginSidePluggingDriver):
|
||||||
return other_port['id']
|
return other_port['id']
|
||||||
except (exc.NoResultFound, exc.MultipleResultsFound):
|
except (exc.NoResultFound, exc.MultipleResultsFound):
|
||||||
# This should not happen ...
|
# This should not happen ...
|
||||||
LOG.error(_('Port trunk pair DB inconsistency for port %s'),
|
LOG.error(_LE('Port trunk pair DB inconsistency for port %s'),
|
||||||
port_id)
|
port_id)
|
||||||
return
|
return
|
||||||
|
|
|
@ -18,6 +18,7 @@ from novaclient.v1_1 import client
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
|
from neutron.openstack.common.gettextutils import _LE
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.plugins.cisco.common import cisco_constants as c_constants
|
from neutron.plugins.cisco.common import cisco_constants as c_constants
|
||||||
|
|
||||||
|
@ -64,7 +65,7 @@ class ServiceVMManager(object):
|
||||||
nova_exc.EndpointNotFound, nova_exc.AmbiguousEndpoints,
|
nova_exc.EndpointNotFound, nova_exc.AmbiguousEndpoints,
|
||||||
nova_exc.ConnectionRefused, nova_exc.ClientException,
|
nova_exc.ConnectionRefused, nova_exc.ClientException,
|
||||||
Exception) as e:
|
Exception) as e:
|
||||||
LOG.error(_('Failure determining running Nova services: %s'), e)
|
LOG.error(_LE('Failure determining running Nova services: %s'), e)
|
||||||
return False
|
return False
|
||||||
return not bool(required.difference(
|
return not bool(required.difference(
|
||||||
[service.binary for service in services
|
[service.binary for service in services
|
||||||
|
@ -81,8 +82,8 @@ class ServiceVMManager(object):
|
||||||
nova_exc.EndpointNotFound, nova_exc.AmbiguousEndpoints,
|
nova_exc.EndpointNotFound, nova_exc.AmbiguousEndpoints,
|
||||||
nova_exc.ConnectionRefused, nova_exc.ClientException,
|
nova_exc.ConnectionRefused, nova_exc.ClientException,
|
||||||
Exception) as e:
|
Exception) as e:
|
||||||
LOG.error(_('Failed to get status of service VM instance %(id)s, '
|
LOG.error(_LE('Failed to get status of service VM instance '
|
||||||
'due to %(err)s'), {'id': vm_id, 'err': e})
|
'%(id)s, due to %(err)s'), {'id': vm_id, 'err': e})
|
||||||
status = c_constants.SVM_ERROR
|
status = c_constants.SVM_ERROR
|
||||||
return status
|
return status
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ class ServiceVMManager(object):
|
||||||
image = n_utils.find_resource(self._nclient.images, vm_image)
|
image = n_utils.find_resource(self._nclient.images, vm_image)
|
||||||
flavor = n_utils.find_resource(self._nclient.flavors, vm_flavor)
|
flavor = n_utils.find_resource(self._nclient.flavors, vm_flavor)
|
||||||
except (nova_exc.CommandError, Exception) as e:
|
except (nova_exc.CommandError, Exception) as e:
|
||||||
LOG.error(_('Failure finding needed Nova resource: %s'), e)
|
LOG.error(_LE('Failure finding needed Nova resource: %s'), e)
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -119,7 +120,7 @@ class ServiceVMManager(object):
|
||||||
nova_exc.EndpointNotFound, nova_exc.AmbiguousEndpoints,
|
nova_exc.EndpointNotFound, nova_exc.AmbiguousEndpoints,
|
||||||
nova_exc.ConnectionRefused, nova_exc.ClientException,
|
nova_exc.ConnectionRefused, nova_exc.ClientException,
|
||||||
Exception) as e:
|
Exception) as e:
|
||||||
LOG.error(_('Failed to create service VM instance: %s'), e)
|
LOG.error(_LE('Failed to create service VM instance: %s'), e)
|
||||||
return
|
return
|
||||||
return {'id': server.id}
|
return {'id': server.id}
|
||||||
|
|
||||||
|
@ -135,6 +136,6 @@ class ServiceVMManager(object):
|
||||||
nova_exc.EndpointNotFound, nova_exc.AmbiguousEndpoints,
|
nova_exc.EndpointNotFound, nova_exc.AmbiguousEndpoints,
|
||||||
nova_exc.ConnectionRefused, nova_exc.ClientException,
|
nova_exc.ConnectionRefused, nova_exc.ClientException,
|
||||||
Exception) as e:
|
Exception) as e:
|
||||||
LOG.error(_('Failed to delete service VM instance %(id)s, '
|
LOG.error(_LE('Failed to delete service VM instance %(id)s, '
|
||||||
'due to %(err)s'), {'id': vm_id, 'err': e})
|
'due to %(err)s'), {'id': vm_id, 'err': e})
|
||||||
return False
|
return False
|
||||||
|
|
|
@ -20,7 +20,7 @@ from neutron.extensions import portbindings
|
||||||
from neutron.extensions import providernet as provider
|
from neutron.extensions import providernet as provider
|
||||||
from neutron import neutron_plugin_base_v2
|
from neutron import neutron_plugin_base_v2
|
||||||
from neutron.openstack.common import excutils
|
from neutron.openstack.common import excutils
|
||||||
from neutron.openstack.common.gettextutils import _LE
|
from neutron.openstack.common.gettextutils import _LE, _LI
|
||||||
from neutron.openstack.common import importutils
|
from neutron.openstack.common import importutils
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.plugins.cisco.common import cisco_constants as const
|
from neutron.plugins.cisco.common import cisco_constants as const
|
||||||
|
@ -72,7 +72,7 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
|
||||||
|
|
||||||
# Initialize credential store after database initialization
|
# Initialize credential store after database initialization
|
||||||
cred.Store.initialize()
|
cred.Store.initialize()
|
||||||
LOG.debug(_("%(module)s.%(name)s init done"),
|
LOG.debug("%(module)s.%(name)s init done",
|
||||||
{'module': __name__,
|
{'module': __name__,
|
||||||
'name': self.__class__.__name__})
|
'name': self.__class__.__name__})
|
||||||
|
|
||||||
|
@ -113,9 +113,9 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
|
||||||
plugin implementation) for completing this operation.
|
plugin implementation) for completing this operation.
|
||||||
"""
|
"""
|
||||||
if plugin_key not in self._plugins:
|
if plugin_key not in self._plugins:
|
||||||
LOG.info(_("No %s Plugin loaded"), plugin_key)
|
LOG.info(_LI("No %s Plugin loaded"), plugin_key)
|
||||||
LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
|
LOG.info(_LI("%(plugin_key)s: %(function_name)s with args "
|
||||||
"ignored"),
|
"%(args)s ignored"),
|
||||||
{'plugin_key': plugin_key,
|
{'plugin_key': plugin_key,
|
||||||
'function_name': function_name,
|
'function_name': function_name,
|
||||||
'args': args})
|
'args': args})
|
||||||
|
@ -138,7 +138,7 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("create_network() called"))
|
LOG.debug("create_network() called")
|
||||||
provider_vlan_id = self._get_provider_vlan_id(network[const.NETWORK])
|
provider_vlan_id = self._get_provider_vlan_id(network[const.NETWORK])
|
||||||
args = [context, network]
|
args = [context, network]
|
||||||
switch_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
|
switch_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
|
||||||
|
@ -151,8 +151,8 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
|
||||||
cdb.add_provider_network(network_id,
|
cdb.add_provider_network(network_id,
|
||||||
const.NETWORK_TYPE_VLAN,
|
const.NETWORK_TYPE_VLAN,
|
||||||
provider_vlan_id)
|
provider_vlan_id)
|
||||||
LOG.debug(_("Provider network added to DB: %(network_id)s, "
|
LOG.debug("Provider network added to DB: %(network_id)s, "
|
||||||
"%(vlan_id)s"),
|
"%(vlan_id)s",
|
||||||
{'network_id': network_id, 'vlan_id': provider_vlan_id})
|
{'network_id': network_id, 'vlan_id': provider_vlan_id})
|
||||||
return switch_output
|
return switch_output
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("update_network() called"))
|
LOG.debug("update_network() called")
|
||||||
|
|
||||||
# We can only support updating of provider attributes if all the
|
# We can only support updating of provider attributes if all the
|
||||||
# configured sub-plugins support it. Currently we have no method
|
# configured sub-plugins support it. Currently we have no method
|
||||||
|
@ -186,7 +186,7 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
|
||||||
self._func_name(),
|
self._func_name(),
|
||||||
args)
|
args)
|
||||||
if cdb.remove_provider_network(id):
|
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 switch_output
|
return switch_output
|
||||||
|
|
||||||
def get_network(self, context, id, fields=None):
|
def get_network(self, context, id, fields=None):
|
||||||
|
@ -228,7 +228,7 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("create_port() called"))
|
LOG.debug("create_port() called")
|
||||||
args = [context, port]
|
args = [context, port]
|
||||||
return self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
|
return self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
|
||||||
self._func_name(),
|
self._func_name(),
|
||||||
|
@ -254,7 +254,7 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("update_port() called"))
|
LOG.debug("update_port() called")
|
||||||
args = [context, id, port]
|
args = [context, id, port]
|
||||||
return self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
|
return self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
|
||||||
self._func_name(),
|
self._func_name(),
|
||||||
|
@ -266,7 +266,7 @@ class VirtualPhysicalSwitchModelV2(neutron_plugin_base_v2.NeutronPluginBaseV2):
|
||||||
Perform this operation in the context of the configured device
|
Perform this operation in the context of the configured device
|
||||||
plugins.
|
plugins.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("delete_port() called"))
|
LOG.debug("delete_port() called")
|
||||||
port = self.get_port(context, id)
|
port = self.get_port(context, id)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -221,7 +221,7 @@ class Client(object):
|
||||||
:param network_profile: network profile dict
|
:param network_profile: network profile dict
|
||||||
:param tenant_id: UUID representing the tenant
|
:param tenant_id: UUID representing the tenant
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Logical network"))
|
LOG.debug("Logical network")
|
||||||
body = {'description': network_profile['name'],
|
body = {'description': network_profile['name'],
|
||||||
'tenantId': tenant_id}
|
'tenantId': tenant_id}
|
||||||
logical_network_name = (network_profile['id'] +
|
logical_network_name = (network_profile['id'] +
|
||||||
|
@ -246,7 +246,7 @@ class Client(object):
|
||||||
:param network_profile: network profile dict
|
:param network_profile: network profile dict
|
||||||
:param tenant_id: UUID representing the tenant
|
:param tenant_id: UUID representing the tenant
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("network_segment_pool"))
|
LOG.debug("network_segment_pool")
|
||||||
logical_network_name = (network_profile['id'] +
|
logical_network_name = (network_profile['id'] +
|
||||||
c_const.LOGICAL_NETWORK_SUFFIX)
|
c_const.LOGICAL_NETWORK_SUFFIX)
|
||||||
body = {'name': network_profile['name'],
|
body = {'name': network_profile['name'],
|
||||||
|
@ -435,7 +435,7 @@ class Client(object):
|
||||||
headers['Accept'] = self._set_content_type('json')
|
headers['Accept'] = self._set_content_type('json')
|
||||||
if body:
|
if body:
|
||||||
body = jsonutils.dumps(body, indent=2)
|
body = jsonutils.dumps(body, indent=2)
|
||||||
LOG.debug(_("req: %s"), body)
|
LOG.debug("req: %s", body)
|
||||||
try:
|
try:
|
||||||
resp = self.pool.spawn(requests.request,
|
resp = self.pool.spawn(requests.request,
|
||||||
method,
|
method,
|
||||||
|
@ -445,7 +445,7 @@ class Client(object):
|
||||||
timeout=self.timeout).wait()
|
timeout=self.timeout).wait()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise c_exc.VSMConnectionFailed(reason=e)
|
raise c_exc.VSMConnectionFailed(reason=e)
|
||||||
LOG.debug(_("status_code %s"), resp.status_code)
|
LOG.debug("status_code %s", resp.status_code)
|
||||||
if resp.status_code == requests.codes.OK:
|
if resp.status_code == requests.codes.OK:
|
||||||
if 'application/json' in resp.headers['content-type']:
|
if 'application/json' in resp.headers['content-type']:
|
||||||
try:
|
try:
|
||||||
|
@ -453,7 +453,7 @@ class Client(object):
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return {}
|
return {}
|
||||||
elif 'text/plain' in resp.headers['content-type']:
|
elif 'text/plain' in resp.headers['content-type']:
|
||||||
LOG.debug(_("VSM: %s"), resp.text)
|
LOG.debug("VSM: %s", resp.text)
|
||||||
else:
|
else:
|
||||||
raise c_exc.VSMError(reason=resp.text)
|
raise c_exc.VSMError(reason=resp.text)
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ from neutron.extensions import portbindings
|
||||||
from neutron.extensions import providernet
|
from neutron.extensions import providernet
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
from neutron.openstack.common import excutils
|
from neutron.openstack.common import excutils
|
||||||
|
from neutron.openstack.common.gettextutils import _LW
|
||||||
from neutron.openstack.common import importutils
|
from neutron.openstack.common import importutils
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common import uuidutils as uuidutils
|
from neutron.openstack.common import uuidutils as uuidutils
|
||||||
|
@ -123,7 +124,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
is instantiated for the first time and then continue to poll for
|
is instantiated for the first time and then continue to poll for
|
||||||
policy profile updates.
|
policy profile updates.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_setup_vsm'))
|
LOG.debug('_setup_vsm')
|
||||||
self.agent_vsm = True
|
self.agent_vsm = True
|
||||||
# Poll VSM for create/delete of policy profile.
|
# Poll VSM for create/delete of policy profile.
|
||||||
eventlet.spawn(self._poll_policy_profiles)
|
eventlet.spawn(self._poll_policy_profiles)
|
||||||
|
@ -142,7 +143,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
from the VSM. Hence we associate the policy profiles with fake
|
from the VSM. Hence we associate the policy profiles with fake
|
||||||
tenant-ids.
|
tenant-ids.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_populate_policy_profiles'))
|
LOG.debug('_populate_policy_profiles')
|
||||||
try:
|
try:
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
policy_profiles = n1kvclient.list_port_profiles()
|
policy_profiles = n1kvclient.list_port_profiles()
|
||||||
|
@ -169,7 +170,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
self._remove_all_fake_policy_profiles()
|
self._remove_all_fake_policy_profiles()
|
||||||
except (cisco_exceptions.VSMError,
|
except (cisco_exceptions.VSMError,
|
||||||
cisco_exceptions.VSMConnectionFailed):
|
cisco_exceptions.VSMConnectionFailed):
|
||||||
LOG.warning(_('No policy profile populated from VSM'))
|
LOG.warning(_LW('No policy profile populated from VSM'))
|
||||||
|
|
||||||
def _extend_network_dict_provider(self, context, network):
|
def _extend_network_dict_provider(self, context, network):
|
||||||
"""Add extended network parameters."""
|
"""Add extended network parameters."""
|
||||||
|
@ -424,7 +425,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
that needs to be trunked
|
that needs to be trunked
|
||||||
:param oper: Operation to be performed
|
:param oper: Operation to be performed
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_populate_member_segments %s'), segment_pairs)
|
LOG.debug('_populate_member_segments %s', segment_pairs)
|
||||||
trunk_list = []
|
trunk_list = []
|
||||||
for (segment, dot1qtag) in segment_pairs:
|
for (segment, dot1qtag) in segment_pairs:
|
||||||
net = self.get_network(context, segment)
|
net = self.get_network(context, segment)
|
||||||
|
@ -468,7 +469,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
else:
|
else:
|
||||||
pair_list.append((segment1, segment2))
|
pair_list.append((segment1, segment2))
|
||||||
else:
|
else:
|
||||||
LOG.debug(_('Invalid UUID supplied in %s'), pair)
|
LOG.debug('Invalid UUID supplied in %s', pair)
|
||||||
msg = _("Invalid UUID supplied")
|
msg = _("Invalid UUID supplied")
|
||||||
raise n_exc.InvalidInput(error_message=msg)
|
raise n_exc.InvalidInput(error_message=msg)
|
||||||
return pair_list
|
return pair_list
|
||||||
|
@ -527,7 +528,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
raise n_exc.InvalidInput(error_message=msg)
|
raise n_exc.InvalidInput(error_message=msg)
|
||||||
pair_list.append((segment, dot1qtag))
|
pair_list.append((segment, dot1qtag))
|
||||||
else:
|
else:
|
||||||
LOG.debug(_('%s is not a valid uuid'), segment)
|
LOG.debug('%s is not a valid uuid', segment)
|
||||||
msg = _("'%s' is not a valid UUID") % segment
|
msg = _("'%s' is not a valid UUID") % segment
|
||||||
raise n_exc.InvalidInput(error_message=msg)
|
raise n_exc.InvalidInput(error_message=msg)
|
||||||
return pair_list
|
return pair_list
|
||||||
|
@ -589,7 +590,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param network_profile: network profile dictionary
|
:param network_profile: network profile dictionary
|
||||||
:param tenant_id: UUID representing the tenant
|
:param tenant_id: UUID representing the tenant
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_create_logical_network'))
|
LOG.debug('_send_create_logical_network')
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
n1kvclient.create_logical_network(network_profile, tenant_id)
|
n1kvclient.create_logical_network(network_profile, tenant_id)
|
||||||
|
|
||||||
|
@ -612,7 +613,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param context: neutron api request context
|
:param context: neutron api request context
|
||||||
:param profile: network profile dictionary
|
:param profile: network profile dictionary
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_create_network_profile_request: %s'), profile['id'])
|
LOG.debug('_send_create_network_profile_request: %s', profile['id'])
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
n1kvclient.create_network_segment_pool(profile, context.tenant_id)
|
n1kvclient.create_network_segment_pool(profile, context.tenant_id)
|
||||||
|
|
||||||
|
@ -622,7 +623,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
|
|
||||||
:param profile: network profile dictionary
|
:param profile: network profile dictionary
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_update_network_profile_request: %s'), profile['id'])
|
LOG.debug('_send_update_network_profile_request: %s', profile['id'])
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
n1kvclient.update_network_segment_pool(profile)
|
n1kvclient.update_network_segment_pool(profile)
|
||||||
|
|
||||||
|
@ -632,7 +633,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
|
|
||||||
:param profile: network profile dictionary
|
:param profile: network profile dictionary
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_delete_network_profile_request: %s'),
|
LOG.debug('_send_delete_network_profile_request: %s',
|
||||||
profile['name'])
|
profile['name'])
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
n1kvclient.delete_network_segment_pool(profile['id'])
|
n1kvclient.delete_network_segment_pool(profile['id'])
|
||||||
|
@ -647,7 +648,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param segment_pairs: List of segments in UUID pairs
|
:param segment_pairs: List of segments in UUID pairs
|
||||||
that need to be bridged
|
that need to be bridged
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_create_network_request: %s'), network['id'])
|
LOG.debug('_send_create_network_request: %s', network['id'])
|
||||||
profile = self.get_network_profile(context,
|
profile = self.get_network_profile(context,
|
||||||
network[n1kv.PROFILE_ID])
|
network[n1kv.PROFILE_ID])
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
|
@ -679,7 +680,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param del_segments: List of segments bindings
|
:param del_segments: List of segments bindings
|
||||||
that need to be deleted
|
that need to be deleted
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_update_network_request: %s'), network['id'])
|
LOG.debug('_send_update_network_request: %s', network['id'])
|
||||||
db_session = context.session
|
db_session = context.session
|
||||||
profile = n1kv_db_v2.get_network_profile(
|
profile = n1kv_db_v2.get_network_profile(
|
||||||
db_session, network[n1kv.PROFILE_ID])
|
db_session, network[n1kv.PROFILE_ID])
|
||||||
|
@ -701,8 +702,8 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
body['segmentType'] = profile['sub_type']
|
body['segmentType'] = profile['sub_type']
|
||||||
body['addSegments'] = network['add_segment_list']
|
body['addSegments'] = network['add_segment_list']
|
||||||
body['delSegments'] = network['del_segment_list']
|
body['delSegments'] = network['del_segment_list']
|
||||||
LOG.debug(_('add_segments=%s'), body['addSegments'])
|
LOG.debug('add_segments=%s', body['addSegments'])
|
||||||
LOG.debug(_('del_segments=%s'), body['delSegments'])
|
LOG.debug('del_segments=%s', body['delSegments'])
|
||||||
if profile['sub_type'] == c_const.NETWORK_TYPE_OVERLAY:
|
if profile['sub_type'] == c_const.NETWORK_TYPE_OVERLAY:
|
||||||
encap_profile = (network['id'] +
|
encap_profile = (network['id'] +
|
||||||
c_const.ENCAPSULATION_PROFILE_SUFFIX)
|
c_const.ENCAPSULATION_PROFILE_SUFFIX)
|
||||||
|
@ -726,7 +727,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param context: neutron api request context
|
:param context: neutron api request context
|
||||||
:param network: network dictionary
|
:param network: network dictionary
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_delete_network_request: %s'), network['id'])
|
LOG.debug('_send_delete_network_request: %s', network['id'])
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
session = context.session
|
session = context.session
|
||||||
if network[providernet.NETWORK_TYPE] == c_const.NETWORK_TYPE_OVERLAY:
|
if network[providernet.NETWORK_TYPE] == c_const.NETWORK_TYPE_OVERLAY:
|
||||||
|
@ -766,7 +767,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param context: neutron api request context
|
:param context: neutron api request context
|
||||||
:param subnet: subnet dictionary
|
:param subnet: subnet dictionary
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_create_subnet_request: %s'), subnet['id'])
|
LOG.debug('_send_create_subnet_request: %s', subnet['id'])
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
n1kvclient.create_ip_pool(subnet)
|
n1kvclient.create_ip_pool(subnet)
|
||||||
|
|
||||||
|
@ -776,7 +777,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
|
|
||||||
:param subnet: subnet dictionary
|
:param subnet: subnet dictionary
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_update_subnet_request: %s'), subnet['name'])
|
LOG.debug('_send_update_subnet_request: %s', subnet['name'])
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
n1kvclient.update_ip_pool(subnet)
|
n1kvclient.update_ip_pool(subnet)
|
||||||
|
|
||||||
|
@ -787,7 +788,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param context: neutron api request context
|
:param context: neutron api request context
|
||||||
:param subnet: subnet dictionary
|
:param subnet: subnet dictionary
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_delete_subnet_request: %s'), subnet['name'])
|
LOG.debug('_send_delete_subnet_request: %s', subnet['name'])
|
||||||
body = {'ipPool': subnet['id'], 'deleteSubnet': True}
|
body = {'ipPool': subnet['id'], 'deleteSubnet': True}
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
n1kvclient.update_network_segment(subnet['network_id'], body=body)
|
n1kvclient.update_network_segment(subnet['network_id'], body=body)
|
||||||
|
@ -813,7 +814,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param vm_network_name: string representing the name of the VM
|
:param vm_network_name: string representing the name of the VM
|
||||||
network
|
network
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_create_port_request: %s'), port)
|
LOG.debug('_send_create_port_request: %s', port)
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
if port_count == 1:
|
if port_count == 1:
|
||||||
n1kvclient.create_vm_network(port,
|
n1kvclient.create_vm_network(port,
|
||||||
|
@ -830,7 +831,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param mac_address: string representing the mac address
|
:param mac_address: string representing the mac address
|
||||||
:param vm_network_name: VM network name to which the port is bound
|
:param vm_network_name: VM network name to which the port is bound
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_update_port_request: %s'), port_id)
|
LOG.debug('_send_update_port_request: %s', port_id)
|
||||||
body = {'portId': port_id,
|
body = {'portId': port_id,
|
||||||
'macAddress': mac_address}
|
'macAddress': mac_address}
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
|
@ -845,7 +846,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param port: port object which is to be deleted
|
:param port: port object which is to be deleted
|
||||||
:param vm_network: VM network object with which the port is associated
|
:param vm_network: VM network object with which the port is associated
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('_send_delete_port_request: %s'), port['id'])
|
LOG.debug('_send_delete_port_request: %s', port['id'])
|
||||||
n1kvclient = n1kv_client.Client()
|
n1kvclient = n1kv_client.Client()
|
||||||
n1kvclient.delete_n1kv_port(vm_network['name'], port['id'])
|
n1kvclient.delete_n1kv_port(vm_network['name'], port['id'])
|
||||||
|
|
||||||
|
@ -874,7 +875,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
network['network'])
|
network['network'])
|
||||||
profile_id = self._process_network_profile(context, network['network'])
|
profile_id = self._process_network_profile(context, network['network'])
|
||||||
segment_pairs = None
|
segment_pairs = None
|
||||||
LOG.debug(_('Create network: profile_id=%s'), profile_id)
|
LOG.debug('Create network: profile_id=%s', profile_id)
|
||||||
session = context.session
|
session = context.session
|
||||||
with session.begin(subtransactions=True):
|
with session.begin(subtransactions=True):
|
||||||
if not network_type:
|
if not network_type:
|
||||||
|
@ -882,10 +883,10 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
(physical_network, network_type, segmentation_id,
|
(physical_network, network_type, segmentation_id,
|
||||||
multicast_ip) = n1kv_db_v2.alloc_network(session,
|
multicast_ip) = n1kv_db_v2.alloc_network(session,
|
||||||
profile_id)
|
profile_id)
|
||||||
LOG.debug(_('Physical_network %(phy_net)s, '
|
LOG.debug('Physical_network %(phy_net)s, '
|
||||||
'seg_type %(net_type)s, '
|
'seg_type %(net_type)s, '
|
||||||
'seg_id %(seg_id)s, '
|
'seg_id %(seg_id)s, '
|
||||||
'multicast_ip %(multicast_ip)s'),
|
'multicast_ip %(multicast_ip)s',
|
||||||
{'phy_net': physical_network,
|
{'phy_net': physical_network,
|
||||||
'net_type': network_type,
|
'net_type': network_type,
|
||||||
'seg_id': segmentation_id,
|
'seg_id': segmentation_id,
|
||||||
|
@ -894,7 +895,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
segment_pairs = (
|
segment_pairs = (
|
||||||
self._parse_multi_segments(context, network['network'],
|
self._parse_multi_segments(context, network['network'],
|
||||||
n1kv.SEGMENT_ADD))
|
n1kv.SEGMENT_ADD))
|
||||||
LOG.debug(_('Seg list %s '), segment_pairs)
|
LOG.debug('Seg list %s ', segment_pairs)
|
||||||
elif network_type == c_const.NETWORK_TYPE_TRUNK:
|
elif network_type == c_const.NETWORK_TYPE_TRUNK:
|
||||||
network_profile = self.get_network_profile(context,
|
network_profile = self.get_network_profile(context,
|
||||||
profile_id)
|
profile_id)
|
||||||
|
@ -904,7 +905,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
physical_network,
|
physical_network,
|
||||||
network_profile['sub_type']
|
network_profile['sub_type']
|
||||||
))
|
))
|
||||||
LOG.debug(_('Seg list %s '), segment_pairs)
|
LOG.debug('Seg list %s ', segment_pairs)
|
||||||
else:
|
else:
|
||||||
if not segmentation_id:
|
if not segmentation_id:
|
||||||
raise n_exc.TenantNetworksDisabled()
|
raise n_exc.TenantNetworksDisabled()
|
||||||
|
@ -945,7 +946,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
self._delete_network_db(context, net['id'])
|
self._delete_network_db(context, net['id'])
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Created network: %s"), net['id'])
|
LOG.debug("Created network: %s", net['id'])
|
||||||
return net
|
return net
|
||||||
|
|
||||||
def update_network(self, context, id, network):
|
def update_network(self, context, id, network):
|
||||||
|
@ -1003,7 +1004,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
if binding.network_type != c_const.NETWORK_TYPE_MULTI_SEGMENT:
|
if binding.network_type != c_const.NETWORK_TYPE_MULTI_SEGMENT:
|
||||||
self._send_update_network_request(context, net, add_segments,
|
self._send_update_network_request(context, net, add_segments,
|
||||||
del_segments)
|
del_segments)
|
||||||
LOG.debug(_("Updated network: %s"), net['id'])
|
LOG.debug("Updated network: %s", net['id'])
|
||||||
return net
|
return net
|
||||||
|
|
||||||
def delete_network(self, context, id):
|
def delete_network(self, context, id):
|
||||||
|
@ -1053,7 +1054,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param id: UUID representing the network to fetch
|
:param id: UUID representing the network to fetch
|
||||||
:returns: requested network dictionary
|
:returns: requested network dictionary
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Get network: %s"), id)
|
LOG.debug("Get network: %s", id)
|
||||||
net = super(N1kvNeutronPluginV2, self).get_network(context, id, None)
|
net = super(N1kvNeutronPluginV2, self).get_network(context, id, None)
|
||||||
self._extend_network_dict_provider(context, net)
|
self._extend_network_dict_provider(context, net)
|
||||||
self._extend_network_dict_profile(context, net)
|
self._extend_network_dict_profile(context, net)
|
||||||
|
@ -1075,7 +1076,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
dictionary. Only these fields will be returned.
|
dictionary. Only these fields will be returned.
|
||||||
:returns: list of network dictionaries.
|
:returns: list of network dictionaries.
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Get networks"))
|
LOG.debug("Get networks")
|
||||||
nets = super(N1kvNeutronPluginV2, self).get_networks(context, filters,
|
nets = super(N1kvNeutronPluginV2, self).get_networks(context, filters,
|
||||||
None)
|
None)
|
||||||
for net in nets:
|
for net in nets:
|
||||||
|
@ -1126,7 +1127,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
|
|
||||||
profile_id = self._process_policy_profile(context,
|
profile_id = self._process_policy_profile(context,
|
||||||
port['port'])
|
port['port'])
|
||||||
LOG.debug(_('Create port: profile_id=%s'), profile_id)
|
LOG.debug('Create port: profile_id=%s', profile_id)
|
||||||
session = context.session
|
session = context.session
|
||||||
with session.begin(subtransactions=True):
|
with session.begin(subtransactions=True):
|
||||||
pt = super(N1kvNeutronPluginV2, self).create_port(context,
|
pt = super(N1kvNeutronPluginV2, self).create_port(context,
|
||||||
|
@ -1173,7 +1174,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
with excutils.save_and_reraise_exception():
|
with excutils.save_and_reraise_exception():
|
||||||
self._delete_port_db(context, pt, vm_network)
|
self._delete_port_db(context, pt, vm_network)
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Created port: %s"), pt)
|
LOG.debug("Created port: %s", pt)
|
||||||
return pt
|
return pt
|
||||||
|
|
||||||
def update_port(self, context, id, port):
|
def update_port(self, context, id, port):
|
||||||
|
@ -1184,7 +1185,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param id: UUID representing the port to update
|
:param id: UUID representing the port to update
|
||||||
:returns: updated port object
|
:returns: updated port object
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Update port: %s"), id)
|
LOG.debug("Update port: %s", id)
|
||||||
with context.session.begin(subtransactions=True):
|
with context.session.begin(subtransactions=True):
|
||||||
updated_port = super(N1kvNeutronPluginV2,
|
updated_port = super(N1kvNeutronPluginV2,
|
||||||
self).update_port(context, id, port)
|
self).update_port(context, id, port)
|
||||||
|
@ -1247,7 +1248,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
dictionary. Only these fields will be returned.
|
dictionary. Only these fields will be returned.
|
||||||
:returns: port dictionary
|
:returns: port dictionary
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Get port: %s"), id)
|
LOG.debug("Get port: %s", id)
|
||||||
port = super(N1kvNeutronPluginV2, self).get_port(context, id, None)
|
port = super(N1kvNeutronPluginV2, self).get_port(context, id, None)
|
||||||
self._extend_port_dict_profile(context, port)
|
self._extend_port_dict_profile(context, port)
|
||||||
return self._fields(port, fields)
|
return self._fields(port, fields)
|
||||||
|
@ -1267,7 +1268,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
dictionary. Only these fields will be returned.
|
dictionary. Only these fields will be returned.
|
||||||
:returns: list of port dictionaries
|
:returns: list of port dictionaries
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Get ports"))
|
LOG.debug("Get ports")
|
||||||
ports = super(N1kvNeutronPluginV2, self).get_ports(context, filters,
|
ports = super(N1kvNeutronPluginV2, self).get_ports(context, filters,
|
||||||
None)
|
None)
|
||||||
for port in ports:
|
for port in ports:
|
||||||
|
@ -1283,7 +1284,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param subnet: subnet dictionary
|
:param subnet: subnet dictionary
|
||||||
:returns: subnet object
|
:returns: subnet object
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('Create subnet'))
|
LOG.debug('Create subnet')
|
||||||
sub = super(N1kvNeutronPluginV2, self).create_subnet(context, subnet)
|
sub = super(N1kvNeutronPluginV2, self).create_subnet(context, subnet)
|
||||||
try:
|
try:
|
||||||
self._send_create_subnet_request(context, sub)
|
self._send_create_subnet_request(context, sub)
|
||||||
|
@ -1293,7 +1294,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
super(N1kvNeutronPluginV2,
|
super(N1kvNeutronPluginV2,
|
||||||
self).delete_subnet(context, sub['id'])
|
self).delete_subnet(context, sub['id'])
|
||||||
else:
|
else:
|
||||||
LOG.debug(_("Created subnet: %s"), sub['id'])
|
LOG.debug("Created subnet: %s", sub['id'])
|
||||||
if not q_conf.CONF.network_auto_schedule:
|
if not q_conf.CONF.network_auto_schedule:
|
||||||
# Schedule network to a DHCP agent
|
# Schedule network to a DHCP agent
|
||||||
net = self.get_network(context, sub['network_id'])
|
net = self.get_network(context, sub['network_id'])
|
||||||
|
@ -1308,7 +1309,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param id: UUID representing subnet to update
|
:param id: UUID representing subnet to update
|
||||||
:returns: updated subnet object
|
:returns: updated subnet object
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('Update subnet'))
|
LOG.debug('Update subnet')
|
||||||
sub = super(N1kvNeutronPluginV2, self).update_subnet(context,
|
sub = super(N1kvNeutronPluginV2, self).update_subnet(context,
|
||||||
id,
|
id,
|
||||||
subnet)
|
subnet)
|
||||||
|
@ -1323,7 +1324,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
:param id: UUID representing subnet to delete
|
:param id: UUID representing subnet to delete
|
||||||
:returns: deleted subnet object
|
:returns: deleted subnet object
|
||||||
"""
|
"""
|
||||||
LOG.debug(_('Delete subnet: %s'), id)
|
LOG.debug('Delete subnet: %s', id)
|
||||||
subnet = self.get_subnet(context, id)
|
subnet = self.get_subnet(context, id)
|
||||||
self._send_delete_subnet_request(context, subnet)
|
self._send_delete_subnet_request(context, subnet)
|
||||||
return super(N1kvNeutronPluginV2, self).delete_subnet(context, id)
|
return super(N1kvNeutronPluginV2, self).delete_subnet(context, id)
|
||||||
|
@ -1338,7 +1339,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
dictionary. Only these fields will be returned.
|
dictionary. Only these fields will be returned.
|
||||||
:returns: subnet object
|
:returns: subnet object
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Get subnet: %s"), id)
|
LOG.debug("Get subnet: %s", id)
|
||||||
subnet = super(N1kvNeutronPluginV2, self).get_subnet(context, id,
|
subnet = super(N1kvNeutronPluginV2, self).get_subnet(context, id,
|
||||||
None)
|
None)
|
||||||
return self._fields(subnet, fields)
|
return self._fields(subnet, fields)
|
||||||
|
@ -1358,7 +1359,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||||
dictionary. Only these fields will be returned.
|
dictionary. Only these fields will be returned.
|
||||||
:returns: list of dictionaries of subnets
|
:returns: list of dictionaries of subnets
|
||||||
"""
|
"""
|
||||||
LOG.debug(_("Get subnets"))
|
LOG.debug("Get subnets")
|
||||||
subnets = super(N1kvNeutronPluginV2, self).get_subnets(context,
|
subnets = super(N1kvNeutronPluginV2, self).get_subnets(context,
|
||||||
filters,
|
filters,
|
||||||
None)
|
None)
|
||||||
|
|
|
@ -84,7 +84,7 @@ class PluginV2(db_base_plugin_v2.NeutronDbPluginV2):
|
||||||
# Extend the fault map
|
# Extend the fault map
|
||||||
self._extend_fault_map()
|
self._extend_fault_map()
|
||||||
|
|
||||||
LOG.debug(_("Plugin initialization complete"))
|
LOG.debug("Plugin initialization complete")
|
||||||
|
|
||||||
def __getattribute__(self, name):
|
def __getattribute__(self, name):
|
||||||
"""Delegate core API calls to the model class.
|
"""Delegate core API calls to the model class.
|
||||||
|
@ -129,44 +129,44 @@ class PluginV2(db_base_plugin_v2.NeutronDbPluginV2):
|
||||||
"""
|
"""
|
||||||
def get_all_qoss(self, tenant_id):
|
def get_all_qoss(self, tenant_id):
|
||||||
"""Get all QoS levels."""
|
"""Get all QoS levels."""
|
||||||
LOG.debug(_("get_all_qoss() called"))
|
LOG.debug("get_all_qoss() called")
|
||||||
qoslist = cdb.get_all_qoss(tenant_id)
|
qoslist = cdb.get_all_qoss(tenant_id)
|
||||||
return qoslist
|
return qoslist
|
||||||
|
|
||||||
def get_qos_details(self, tenant_id, qos_id):
|
def get_qos_details(self, tenant_id, qos_id):
|
||||||
"""Get QoS Details."""
|
"""Get QoS Details."""
|
||||||
LOG.debug(_("get_qos_details() called"))
|
LOG.debug("get_qos_details() called")
|
||||||
return cdb.get_qos(tenant_id, qos_id)
|
return cdb.get_qos(tenant_id, qos_id)
|
||||||
|
|
||||||
def create_qos(self, tenant_id, qos_name, qos_desc):
|
def create_qos(self, tenant_id, qos_name, qos_desc):
|
||||||
"""Create a QoS level."""
|
"""Create a QoS level."""
|
||||||
LOG.debug(_("create_qos() called"))
|
LOG.debug("create_qos() called")
|
||||||
qos = cdb.add_qos(tenant_id, qos_name, str(qos_desc))
|
qos = cdb.add_qos(tenant_id, qos_name, str(qos_desc))
|
||||||
return qos
|
return qos
|
||||||
|
|
||||||
def delete_qos(self, tenant_id, qos_id):
|
def delete_qos(self, tenant_id, qos_id):
|
||||||
"""Delete a QoS level."""
|
"""Delete a QoS level."""
|
||||||
LOG.debug(_("delete_qos() called"))
|
LOG.debug("delete_qos() called")
|
||||||
return cdb.remove_qos(tenant_id, qos_id)
|
return cdb.remove_qos(tenant_id, qos_id)
|
||||||
|
|
||||||
def rename_qos(self, tenant_id, qos_id, new_name):
|
def rename_qos(self, tenant_id, qos_id, new_name):
|
||||||
"""Rename QoS level."""
|
"""Rename QoS level."""
|
||||||
LOG.debug(_("rename_qos() called"))
|
LOG.debug("rename_qos() called")
|
||||||
return cdb.update_qos(tenant_id, qos_id, new_name)
|
return cdb.update_qos(tenant_id, qos_id, new_name)
|
||||||
|
|
||||||
def get_all_credentials(self):
|
def get_all_credentials(self):
|
||||||
"""Get all credentials."""
|
"""Get all credentials."""
|
||||||
LOG.debug(_("get_all_credentials() called"))
|
LOG.debug("get_all_credentials() called")
|
||||||
credential_list = cdb.get_all_credentials()
|
credential_list = cdb.get_all_credentials()
|
||||||
return credential_list
|
return credential_list
|
||||||
|
|
||||||
def get_credential_details(self, credential_id):
|
def get_credential_details(self, credential_id):
|
||||||
"""Get a particular credential."""
|
"""Get a particular credential."""
|
||||||
LOG.debug(_("get_credential_details() called"))
|
LOG.debug("get_credential_details() called")
|
||||||
return cdb.get_credential(credential_id)
|
return cdb.get_credential(credential_id)
|
||||||
|
|
||||||
def rename_credential(self, credential_id, new_name, new_password):
|
def rename_credential(self, credential_id, new_name, new_password):
|
||||||
"""Rename the particular credential resource."""
|
"""Rename the particular credential resource."""
|
||||||
LOG.debug(_("rename_credential() called"))
|
LOG.debug("rename_credential() called")
|
||||||
return cdb.update_credential(credential_id, new_name,
|
return cdb.update_credential(credential_id, new_name,
|
||||||
new_password=new_password)
|
new_password=new_password)
|
||||||
|
|
|
@ -19,7 +19,6 @@ import testtools
|
||||||
from neutron.agent.common import config
|
from neutron.agent.common import config
|
||||||
from neutron.common import config as base_config
|
from neutron.common import config as base_config
|
||||||
from neutron.common import constants as l3_constants
|
from neutron.common import constants as l3_constants
|
||||||
from neutron.openstack.common import log as logging
|
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
from neutron.plugins.cisco.cfg_agent import cfg_agent
|
from neutron.plugins.cisco.cfg_agent import cfg_agent
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
@ -28,8 +27,6 @@ _uuid = uuidutils.generate_uuid
|
||||||
HOSTNAME = 'myhost'
|
HOSTNAME = 'myhost'
|
||||||
FAKE_ID = _uuid()
|
FAKE_ID = _uuid()
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
def prepare_router_data(enable_snat=None, num_internal_ports=1):
|
def prepare_router_data(enable_snat=None, num_internal_ports=1):
|
||||||
router_id = _uuid()
|
router_id = _uuid()
|
||||||
|
|
|
@ -16,7 +16,6 @@ import sys
|
||||||
import datetime
|
import datetime
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from neutron.openstack.common import log as logging
|
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
|
|
||||||
sys.modules['ncclient'] = mock.MagicMock()
|
sys.modules['ncclient'] = mock.MagicMock()
|
||||||
|
@ -25,7 +24,6 @@ from neutron.plugins.cisco.cfg_agent import device_status
|
||||||
from neutron.tests import base
|
from neutron.tests import base
|
||||||
|
|
||||||
_uuid = uuidutils.generate_uuid
|
_uuid = uuidutils.generate_uuid
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
TYPE_STRING = 'string'
|
TYPE_STRING = 'string'
|
||||||
TYPE_DATETIME = 'datetime'
|
TYPE_DATETIME = 'datetime'
|
||||||
|
|
|
@ -19,7 +19,6 @@ from oslo import messaging
|
||||||
|
|
||||||
from neutron.common import config as base_config
|
from neutron.common import config as base_config
|
||||||
from neutron.common import constants as l3_constants
|
from neutron.common import constants as l3_constants
|
||||||
from neutron.openstack.common import log as logging
|
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
from neutron.plugins.cisco.cfg_agent import cfg_agent
|
from neutron.plugins.cisco.cfg_agent import cfg_agent
|
||||||
from neutron.plugins.cisco.cfg_agent import cfg_exceptions
|
from neutron.plugins.cisco.cfg_agent import cfg_exceptions
|
||||||
|
@ -36,8 +35,6 @@ _uuid = uuidutils.generate_uuid
|
||||||
HOST = 'myhost'
|
HOST = 'myhost'
|
||||||
FAKE_ID = _uuid()
|
FAKE_ID = _uuid()
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
def prepare_router_data(enable_snat=None, num_internal_ports=1):
|
def prepare_router_data(enable_snat=None, num_internal_ports=1):
|
||||||
router_id = _uuid()
|
router_id = _uuid()
|
||||||
|
|
|
@ -19,6 +19,7 @@ from oslo.config import cfg
|
||||||
from neutron import context as n_context
|
from neutron import context as n_context
|
||||||
from neutron import manager
|
from neutron import manager
|
||||||
from neutron.openstack.common import excutils
|
from neutron.openstack.common import excutils
|
||||||
|
from neutron.openstack.common.gettextutils import _LE
|
||||||
from neutron.openstack.common import log as logging
|
from neutron.openstack.common import log as logging
|
||||||
from neutron.openstack.common import uuidutils
|
from neutron.openstack.common import uuidutils
|
||||||
from neutron.plugins.common import constants
|
from neutron.plugins.common import constants
|
||||||
|
@ -95,8 +96,8 @@ class DeviceHandlingTestSupportMixin(object):
|
||||||
self._delete('ports', port['id'])
|
self._delete('ports', port['id'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
with excutils.save_and_reraise_exception(reraise=False):
|
with excutils.save_and_reraise_exception(reraise=False):
|
||||||
LOG.error('Failed to delete port %(p_id)s for vm instance '
|
LOG.error(_LE('Failed to delete port %(p_id)s for vm '
|
||||||
'%(v_id)s due to %(err)s',
|
'instance %(v_id)s due to %(err)s'),
|
||||||
{'p_id': port['id'], 'v_id': vm_id, 'err': e})
|
{'p_id': port['id'], 'v_id': vm_id, 'err': e})
|
||||||
raise nova_exc.InternalServerError()
|
raise nova_exc.InternalServerError()
|
||||||
|
|
||||||
|
|
|
@ -12,12 +12,9 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from neutron.openstack.common import log as logging
|
|
||||||
from neutron.plugins.cisco.common import cisco_exceptions as c_exc
|
from neutron.plugins.cisco.common import cisco_exceptions as c_exc
|
||||||
from neutron.plugins.cisco.n1kv import n1kv_client
|
from neutron.plugins.cisco.n1kv import n1kv_client
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
_resource_metadata = {'port': ['id', 'macAddress', 'ipAddress', 'subnetId'],
|
_resource_metadata = {'port': ['id', 'macAddress', 'ipAddress', 'subnetId'],
|
||||||
'vmnetwork': ['name', 'networkSegmentId',
|
'vmnetwork': ['name', 'networkSegmentId',
|
||||||
'networkSegment', 'portProfile',
|
'networkSegment', 'portProfile',
|
||||||
|
|
Loading…
Reference in New Issue