code: 450, title: Portprofile not Found
"""
code = 450
- title = 'Portprofile Not Found'
- explanation = ('Unable to find a Portprofile with'
- ' the specified identifier.')
+ title = _('Portprofile Not Found')
+ explanation = _('Unable to find a Portprofile with'
+ ' the specified identifier.')
class PortNotFound(webob.exc.HTTPClientError):
code: 430, title: Port not Found
"""
code = 430
- title = 'Port not Found'
- explanation = ('Unable to find a port with the specified identifier.')
+ title = _('Port not Found')
+ explanation = _('Unable to find a port with the specified identifier.')
class CredentialNotFound(webob.exc.HTTPClientError):
code: 451, title: Credential not Found
"""
code = 451
- title = 'Credential Not Found'
- explanation = ('Unable to find a Credential with'
- ' the specified identifier.')
+ title = _('Credential Not Found')
+ explanation = _('Unable to find a Credential with'
+ ' the specified identifier.')
class QosNotFound(webob.exc.HTTPClientError):
code: 452, title: QoS not Found
"""
code = 452
- title = 'QoS Not Found'
- explanation = ('Unable to find a QoS with'
- ' the specified identifier.')
+ title = _('QoS Not Found')
+ explanation = _('Unable to find a QoS with'
+ ' the specified identifier.')
class NovatenantNotFound(webob.exc.HTTPClientError):
code: 453, title: Nova tenant not Found
"""
code = 453
- title = 'Nova tenant Not Found'
- explanation = ('Unable to find a Novatenant with'
- ' the specified identifier.')
+ title = _('Nova tenant Not Found')
+ explanation = _('Unable to find a Novatenant with'
+ ' the specified identifier.')
class MultiportNotFound(webob.exc.HTTPClientError):
code: 454, title: Multiport not Found
"""
code = 454
- title = 'Multiport Not Found'
- explanation = ('Unable to find Multiport with'
- ' the specified identifier.')
+ title = _('Multiport Not Found')
+ explanation = _('Unable to find Multiport with'
+ ' the specified identifier.')
class RequestedStateInvalid(webob.exc.HTTPClientError):
code: 431, title: Requested State Invalid
"""
code = 431
- title = 'Requested State Invalid'
- explanation = ('Unable to update port state with specified value.')
+ title = _('Requested State Invalid')
+ explanation = _('Unable to update port state with specified value.')
def create_vlanids():
"""Prepopulates the vlan_bindings table"""
- LOG.debug("create_vlanids() called")
+ LOG.debug(_("create_vlanids() called"))
session = db.get_session()
try:
vlanid = session.query(l2network_models.VlanID).one()
def get_all_vlanids():
"""Gets all the vlanids"""
- LOG.debug("get_all_vlanids() called")
+ LOG.debug(_("get_all_vlanids() called"))
session = db.get_session()
try:
vlanids = session.query(l2network_models.VlanID).all()
def is_vlanid_used(vlan_id):
"""Checks if a vlanid is in use"""
- LOG.debug("is_vlanid_used() called")
+ LOG.debug(_("is_vlanid_used() called"))
session = db.get_session()
try:
vlanid = (session.query(l2network_models.VlanID).
def release_vlanid(vlan_id):
"""Sets the vlanid state to be unused"""
- LOG.debug("release_vlanid() called")
+ LOG.debug(_("release_vlanid() called"))
session = db.get_session()
try:
vlanid = (session.query(l2network_models.VlanID).
def delete_vlanid(vlan_id):
"""Deletes a vlanid entry from db"""
- LOG.debug("delete_vlanid() called")
+ LOG.debug(_("delete_vlanid() called"))
session = db.get_session()
try:
vlanid = (session.query(l2network_models.VlanID).
def reserve_vlanid():
"""Reserves the first unused vlanid"""
- LOG.debug("reserve_vlanid() called")
+ LOG.debug(_("reserve_vlanid() called"))
session = db.get_session()
try:
rvlan = (session.query(l2network_models.VlanID).
def get_all_vlanids_used():
"""Gets all the vlanids used"""
- LOG.debug("get_all_vlanids() called")
+ LOG.debug(_("get_all_vlanids() called"))
session = db.get_session()
try:
vlanids = (session.query(l2network_models.VlanID).
def get_all_vlan_bindings():
"""Lists all the vlan to network associations"""
- LOG.debug("get_all_vlan_bindings() called")
+ LOG.debug(_("get_all_vlan_bindings() called"))
session = db.get_session()
try:
bindings = session.query(l2network_models.VlanBinding).all()
def get_vlan_binding(netid):
"""Lists the vlan given a network_id"""
- LOG.debug("get_vlan_binding() called")
+ LOG.debug(_("get_vlan_binding() called"))
session = db.get_session()
try:
binding = (session.query(l2network_models.VlanBinding).
def add_vlan_binding(vlanid, vlanname, netid):
"""Adds a vlan to network association"""
- LOG.debug("add_vlan_binding() called")
+ LOG.debug(_("add_vlan_binding() called"))
session = db.get_session()
try:
binding = (session.query(l2network_models.VlanBinding).
def remove_vlan_binding(netid):
"""Removes a vlan to network association"""
- LOG.debug("remove_vlan_binding() called")
+ LOG.debug(_("remove_vlan_binding() called"))
session = db.get_session()
try:
binding = (session.query(l2network_models.VlanBinding).
def update_vlan_binding(netid, newvlanid=None, newvlanname=None):
"""Updates a vlan to network association"""
- LOG.debug("update_vlan_binding() called")
+ LOG.debug(_("update_vlan_binding() called"))
session = db.get_session()
try:
binding = (session.query(l2network_models.VlanBinding).
def get_all_portprofiles():
"""Lists all the port profiles"""
- LOG.debug("get_all_portprofiles() called")
+ LOG.debug(_("get_all_portprofiles() called"))
session = db.get_session()
try:
pps = session.query(l2network_models.PortProfile).all()
def get_portprofile(tenantid, ppid):
"""Lists a port profile"""
- LOG.debug("get_portprofile() called")
+ LOG.debug(_("get_portprofile() called"))
session = db.get_session()
try:
pp = (session.query(l2network_models.PortProfile).
def add_portprofile(tenantid, ppname, vlanid, qos):
"""Adds a port profile"""
- LOG.debug("add_portprofile() called")
+ LOG.debug(_("add_portprofile() called"))
session = db.get_session()
try:
pp = (session.query(l2network_models.PortProfile).
def remove_portprofile(tenantid, ppid):
"""Removes a port profile"""
- LOG.debug("remove_portprofile() called")
+ LOG.debug(_("remove_portprofile() called"))
session = db.get_session()
try:
pp = (session.query(l2network_models.PortProfile).
def update_portprofile(tenantid, ppid, newppname=None, newvlanid=None,
newqos=None):
"""Updates port profile"""
- LOG.debug("update_portprofile() called")
+ LOG.debug(_("update_portprofile() called"))
session = db.get_session()
try:
pp = (session.query(l2network_models.PortProfile).
def get_all_pp_bindings():
"""Lists all the port profiles"""
- LOG.debug("get_all_pp_bindings() called")
+ LOG.debug(_("get_all_pp_bindings() called"))
session = db.get_session()
try:
bindings = session.query(l2network_models.PortProfileBinding).all()
def get_pp_binding(tenantid, ppid):
"""Lists a port profile binding"""
- LOG.debug("get_pp_binding() called")
+ LOG.debug(_("get_pp_binding() called"))
session = db.get_session()
try:
binding = (session.query(l2network_models.PortProfileBinding).
def add_pp_binding(tenantid, portid, ppid, default):
"""Adds a port profile binding"""
- LOG.debug("add_pp_binding() called")
+ LOG.debug(_("add_pp_binding() called"))
session = db.get_session()
try:
binding = (session.query(l2network_models.PortProfileBinding).
def remove_pp_binding(tenantid, portid, ppid):
"""Removes a port profile binding"""
- LOG.debug("remove_pp_binding() called")
+ LOG.debug(_("remove_pp_binding() called"))
session = db.get_session()
try:
binding = (session.query(l2network_models.PortProfileBinding).
def update_pp_binding(tenantid, ppid, newtenantid=None,
newportid=None, newdefault=None):
"""Updates port profile binding"""
- LOG.debug("update_pp_binding() called")
+ LOG.debug(_("update_pp_binding() called"))
session = db.get_session()
try:
binding = (session.query(l2network_models.PortProfileBinding).
def get_all_qoss(tenant_id):
"""Lists all the qos to tenant associations"""
- LOG.debug("get_all_qoss() called")
+ LOG.debug(_("get_all_qoss() called"))
session = db.get_session()
try:
qoss = (session.query(l2network_models.QoS).
def get_qos(tenant_id, 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()
try:
qos = (session.query(l2network_models.QoS).
def add_qos(tenant_id, qos_name, qos_desc):
"""Adds a qos to tenant association"""
- LOG.debug("add_qos() called")
+ LOG.debug(_("add_qos() called"))
session = db.get_session()
try:
qos = (session.query(l2network_models.QoS).
def create_vlanids():
"""Prepopulates the vlan_bindings table"""
- LOG.debug("create_vlanids() called")
+ LOG.debug(_("create_vlanids() called"))
session = db.get_session()
try:
vlanid = session.query(network_models_v2.VlanID).one()
def get_all_vlanids():
"""Gets all the vlanids"""
- LOG.debug("get_all_vlanids() called")
+ LOG.debug(_("get_all_vlanids() called"))
session = db.get_session()
try:
vlanids = session.query(network_models_v2.VlanID).all()
def is_vlanid_used(vlan_id):
"""Checks if a vlanid is in use"""
- LOG.debug("is_vlanid_used() called")
+ LOG.debug(_("is_vlanid_used() called"))
session = db.get_session()
try:
vlanid = (session.query(network_models_v2.VlanID).
def release_vlanid(vlan_id):
"""Sets the vlanid state to be unused"""
- LOG.debug("release_vlanid() called")
+ LOG.debug(_("release_vlanid() called"))
session = db.get_session()
try:
vlanid = (session.query(network_models_v2.VlanID).
def delete_vlanid(vlan_id):
"""Deletes a vlanid entry from db"""
- LOG.debug("delete_vlanid() called")
+ LOG.debug(_("delete_vlanid() called"))
session = db.get_session()
try:
vlanid = (session.query(network_models_v2.VlanID).
def reserve_vlanid():
"""Reserves the first unused vlanid"""
- LOG.debug("reserve_vlanid() called")
+ LOG.debug(_("reserve_vlanid() called"))
session = db.get_session()
try:
rvlan = (session.query(network_models_v2.VlanID).
def get_all_vlanids_used():
"""Gets all the vlanids used"""
- LOG.debug("get_all_vlanids() called")
+ LOG.debug(_("get_all_vlanids() called"))
session = db.get_session()
try:
vlanids = (session.query(network_models_v2.VlanID).
def get_all_vlan_bindings():
"""Lists all the vlan to network associations"""
- LOG.debug("get_all_vlan_bindings() called")
+ LOG.debug(_("get_all_vlan_bindings() called"))
session = db.get_session()
try:
bindings = session.query(network_models_v2.Vlan_Binding).all()
def get_vlan_binding(netid):
"""Lists the vlan given a network_id"""
- LOG.debug("get_vlan_binding() called")
+ LOG.debug(_("get_vlan_binding() called"))
session = db.get_session()
try:
binding = (session.query(network_models_v2.Vlan_Binding).
def add_vlan_binding(vlanid, vlanname, netid):
"""Adds a vlan to network association"""
- LOG.debug("add_vlan_binding() called")
+ LOG.debug(_("add_vlan_binding() called"))
session = db.get_session()
try:
binding = (session.query(network_models_v2.Vlan_Binding).
def remove_vlan_binding(netid):
"""Removes a vlan to network association"""
- LOG.debug("remove_vlan_binding() called")
+ LOG.debug(_("remove_vlan_binding() called"))
session = db.get_session()
try:
binding = (session.query(network_models_v2.Vlan_Binding).
def update_vlan_binding(netid, newvlanid=None, newvlanname=None):
"""Updates a vlan to network association"""
- LOG.debug("update_vlan_binding() called")
+ LOG.debug(_("update_vlan_binding() called"))
session = db.get_session()
try:
binding = (session.query(network_models_v2.Vlan_Binding).
def get_all_portprofiles():
"""Lists all the port profiles"""
- LOG.debug("get_all_portprofiles() called")
+ LOG.debug(_("get_all_portprofiles() called"))
session = db.get_session()
try:
pps = session.query(network_models_v2.PortProfile).all()
def get_portprofile(tenantid, ppid):
"""Lists a port profile"""
- LOG.debug("get_portprofile() called")
+ LOG.debug(_("get_portprofile() called"))
session = db.get_session()
try:
pp = (session.query(network_models_v2.PortProfile).
def add_portprofile(tenantid, ppname, vlanid, qos):
"""Adds a port profile"""
- LOG.debug("add_portprofile() called")
+ LOG.debug(_("add_portprofile() called"))
session = db.get_session()
try:
pp = (session.query(network_models_v2.PortProfile).
def update_portprofile(tenantid, ppid, newppname=None, newvlanid=None,
newqos=None):
"""Updates port profile"""
- LOG.debug("update_portprofile() called")
+ LOG.debug(_("update_portprofile() called"))
session = db.get_session()
try:
pp = (session.query(network_models_v2.PortProfile).
def get_all_pp_bindings():
"""Lists all the port profiles"""
- LOG.debug("get_all_pp_bindings() called")
+ LOG.debug(_("get_all_pp_bindings() called"))
session = db.get_session()
try:
bindings = session.query(network_models_v2.PortProfileBinding).all()
def get_pp_binding(tenantid, ppid):
"""Lists a port profile binding"""
- LOG.debug("get_pp_binding() called")
+ LOG.debug(_("get_pp_binding() called"))
session = db.get_session()
try:
binding = (session.query(network_models_v2.PortProfileBinding).
def add_pp_binding(tenantid, portid, ppid, default):
"""Adds a port profile binding"""
- LOG.debug("add_pp_binding() called")
+ LOG.debug(_("add_pp_binding() called"))
session = db.get_session()
try:
binding = (session.query(network_models_v2.PortProfileBinding).
def remove_pp_binding(tenantid, portid, ppid):
"""Removes a port profile binding"""
- LOG.debug("remove_pp_binding() called")
+ LOG.debug(_("remove_pp_binding() called"))
session = db.get_session()
try:
binding = (session.query(network_models_v2.PortProfileBinding).
def update_pp_binding(tenantid, ppid, newtenantid=None,
newportid=None, newdefault=None):
"""Updates port profile binding"""
- LOG.debug("update_pp_binding() called")
+ LOG.debug(_("update_pp_binding() called"))
session = db.get_session()
try:
binding = (session.query(network_models_v2.PortProfileBinding).
def get_all_qoss(tenant_id):
"""Lists all the qos to tenant associations"""
- LOG.debug("get_all_qoss() called")
+ LOG.debug(_("get_all_qoss() called"))
session = db.get_session()
try:
qoss = (session.query(network_models_v2.QoS).
def get_qos(tenant_id, 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()
try:
qos = (session.query(network_models_v2.QoS).
def add_qos(tenant_id, qos_name, qos_desc):
"""Adds a qos to tenant association"""
- LOG.debug("add_qos() called")
+ LOG.debug(_("add_qos() called"))
session = db.get_session()
try:
qos = (session.query(network_models_v2.QoS).
def get_all_nexusport_bindings():
"""Lists all the nexusport bindings"""
- LOG.debug("get_all_nexusport_bindings() called")
+ LOG.debug(_("get_all_nexusport_bindings() called"))
session = db.get_session()
try:
bindings = session.query(nexus_models_v2.NexusPortBinding).all()
def get_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
"""Lists a nexusport binding"""
- LOG.debug("get_nexusport_binding() called")
+ LOG.debug(_("get_nexusport_binding() called"))
session = db.get_session()
try:
binding = (session.query(nexus_models_v2.NexusPortBinding).
def get_nexusvlan_binding(vlan_id, switch_ip):
"""Lists a vlan and switch binding"""
- LOG.debug("get_nexusvlan_binding() called")
+ LOG.debug(_("get_nexusvlan_binding() called"))
session = db.get_session()
try:
binding = (session.query(nexus_models_v2.NexusPortBinding).
def add_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
"""Adds a nexusport binding"""
- LOG.debug("add_nexusport_binding() called")
+ LOG.debug(_("add_nexusport_binding() called"))
session = db.get_session()
binding = nexus_models_v2.NexusPortBinding(
port_id, vlan_id, switch_ip, instance_id)
def remove_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
"""Removes a nexusport binding"""
- LOG.debug("remove_nexusport_binding() called")
+ LOG.debug(_("remove_nexusport_binding() called"))
session = db.get_session()
try:
binding = (session.query(nexus_models_v2.NexusPortBinding).
def update_nexusport_binding(port_id, new_vlan_id):
"""Updates nexusport binding"""
- LOG.debug("update_nexusport_binding called")
+ LOG.debug(_("update_nexusport_binding called"))
session = db.get_session()
try:
binding = (session.query(nexus_models_v2.NexusPortBinding).
def get_nexusvm_binding(vlan_id, instance_id):
"""Lists nexusvm bindings"""
- LOG.debug("get_nexusvm_binding() called")
+ LOG.debug(_("get_nexusvm_binding() called"))
session = db.get_session()
try:
binding = (session.query(nexus_models_v2.NexusPortBinding).
def get_port_vlan_switch_binding(port_id, vlan_id, switch_ip):
"""Lists nexusvm bindings"""
- LOG.debug("get_port_vlan_switch_binding() called")
+ LOG.debug(_("get_port_vlan_switch_binding() called"))
session = db.get_session()
try:
binding = (session.query(nexus_models_v2.NexusPortBinding).
def get_all_services_bindings():
"""Lists all the services bindings"""
- LOG.debug("get_all_services_bindings() called")
+ LOG.debug(_("get_all_services_bindings() called"))
session = db.get_session()
try:
bindings = session.query(services_models.ServicesBinding).all()
def get_service_bindings(service_id):
"""Lists services bindings for a service_id"""
- LOG.debug("get_service_bindings() called")
+ LOG.debug(_("get_service_bindings() called"))
session = db.get_session()
try:
bindings = (session.query(services_models.ServicesBinding).
def add_services_binding(service_id, mngnet_id, nbnet_id, sbnet_id):
"""Adds a services binding"""
- LOG.debug("add_services_binding() called")
+ LOG.debug(_("add_services_binding() called"))
session = db.get_session()
binding = services_models.ServicesBinding(service_id, mngnet_id,
nbnet_id, sbnet_id)
def remove_services_binding(service_id):
"""Removes a services binding"""
- LOG.debug("remove_services_binding() called")
+ LOG.debug(_("remove_services_binding() called"))
session = db.get_session()
try:
binding = (session.query(services_models.ServicesBinding).
def get_all_portbindings():
"""Lists all the port bindings"""
- LOG.debug("db get_all_portbindings() called")
+ LOG.debug(_("DB get_all_portbindings() called"))
session = db.get_session()
try:
port_bindings = session.query(ucs_models.PortBinding).all()
def get_portbinding(port_id):
"""Lists a port binding"""
- LOG.debug("get_portbinding() called")
+ LOG.debug(_("get_portbinding() called"))
session = db.get_session()
try:
port_binding = (session.query(ucs_models.PortBinding).
def add_portbinding(port_id, blade_intf_dn, portprofile_name,
vlan_name, vlan_id, qos):
"""Adds a port binding"""
- LOG.debug("add_portbinding() called")
+ LOG.debug(_("add_portbinding() called"))
session = db.get_session()
try:
port_binding = (session.query(ucs_models.PortBinding).
def remove_portbinding(port_id):
"""Removes a port binding"""
- LOG.debug("db remove_portbinding() called")
+ LOG.debug(_("DB remove_portbinding() called"))
session = db.get_session()
try:
port_binding = (session.query(ucs_models.PortBinding).
tenant_id=None, instance_id=None,
vif_id=None):
"""Updates port binding"""
- LOG.debug("db update_portbinding() called")
+ LOG.debug(_("DB update_portbinding() called"))
session = db.get_session()
try:
port_binding = (session.query(ucs_models.PortBinding).
def update_portbinding_instance_id(port_id, instance_id):
"""Updates port binding for the instance ID"""
- LOG.debug("db update_portbinding_instance_id() called")
+ LOG.debug(_("DB update_portbinding_instance_id() called"))
session = db.get_session()
try:
port_binding = (session.query(ucs_models.PortBinding).
def update_portbinding_vif_id(port_id, vif_id):
"""Updates port binding for the VIF ID"""
- LOG.debug("db update_portbinding_vif_id() called")
+ LOG.debug(_("DB update_portbinding_vif_id() called"))
session = db.get_session()
try:
port_binding = (session.query(ucs_models.PortBinding).
def get_portbinding_dn(blade_intf_dn):
"""Lists a port binding"""
- LOG.debug("get_portbinding_dn() called")
+ LOG.debug(_("get_portbinding_dn() called"))
session = db.get_session()
try:
port_binding = (session.query(ucs_models.PortBinding).
for key in conf.PLUGINS[const.PLUGINS].keys():
plugin_obj = conf.PLUGINS[const.PLUGINS][key]
self._plugins[key] = importutils.import_object(plugin_obj)
- LOG.debug("Loaded device plugin %s\n" %
+ LOG.debug(_("Loaded device plugin %s"),
conf.PLUGINS[const.PLUGINS][key])
if key in conf.PLUGINS[const.INVENTORY].keys():
inventory_obj = conf.PLUGINS[const.INVENTORY][key]
self._inventory[key] = importutils.import_object(inventory_obj)
- LOG.debug("Loaded device inventory %s\n" %
+ LOG.debug(_("Loaded device inventory %s"),
conf.PLUGINS[const.INVENTORY][key])
- LOG.debug("%s.%s init done" % (__name__, self.__class__.__name__))
+ LOG.debug(_("%(module)s.%(name)s init done"),
+ {'module': __name__,
+ 'name': self.__class__.__name__})
def _func_name(self, offset=0):
"""Get the name of the calling function"""
inventory and plugin implementation) for completing this operation.
"""
if not plugin_key in self._plugins.keys():
- LOG.info("No %s Plugin loaded" % plugin_key)
- LOG.info("%s: %s with args %s ignored" %
- (plugin_key, function_name, args))
+ LOG.info(_("No %s Plugin loaded"), plugin_key)
+ LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
+ "ignored"), locals())
return
device_params = self._invoke_inventory(plugin_key, function_name,
args)
inventory for completing this operation.
"""
if not plugin_key in self._inventory.keys():
- LOG.info("No %s inventory loaded" % plugin_key)
- LOG.info("%s: %s with args %s ignored" %
- (plugin_key, function_name, args))
+ LOG.info(_("No %s inventory loaded"), plugin_key)
+ LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
+ "ignored"), locals())
return {const.DEVICE_IP: []}
else:
return getattr(self._inventory[plugin_key], function_name)(args)
for key in conf.PLUGINS[const.PLUGINS].keys():
plugin_obj = conf.PLUGINS[const.PLUGINS][key]
self._plugins[key] = importutils.import_object(plugin_obj)
- LOG.debug("Loaded device plugin %s\n" %
+ LOG.debug(_("Loaded device plugin %s\n"),
conf.PLUGINS[const.PLUGINS][key])
if key in conf.PLUGINS[const.INVENTORY].keys():
inventory_obj = conf.PLUGINS[const.INVENTORY][key]
self._inventory[key] = importutils.import_object(inventory_obj)
- LOG.debug("Loaded device inventory %s\n" %
+ LOG.debug(_("Loaded device inventory %s\n"),
conf.PLUGINS[const.INVENTORY][key])
if hasattr(self._plugins[const.VSWITCH_PLUGIN],
self._plugins[const.VSWITCH_PLUGIN].
supported_extension_aliases)
- LOG.debug("%s.%s init done" % (__name__, self.__class__.__name__))
+ LOG.debug(_("%(module)s.%(name)s init done"),
+ {'module': __name__,
+ 'name': self.__class__.__name__})
def __getattribute__(self, name):
"""
inventory and plugin implementation) for completing this operation.
"""
if not plugin_key in self._plugins.keys():
- LOG.info("No %s Plugin loaded" % plugin_key)
- LOG.info("%s: %s with args %s ignored" %
- (plugin_key, function_name, args))
+ LOG.info(_("No %s Plugin loaded"), plugin_key)
+ LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
+ "ignored"), locals())
return
device_params = self._invoke_inventory(plugin_key, function_name,
args)
inventory for completing this operation.
"""
if not plugin_key in self._inventory.keys():
- LOG.info("No %s inventory loaded" % plugin_key)
- LOG.info("%s: %s with args %s ignored" %
- (plugin_key, function_name, args))
+ LOG.info(_("No %s inventory loaded"), plugin_key)
+ LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
+ "ignored"), locals())
return {const.DEVICE_IP: []}
else:
return getattr(self._inventory[plugin_key], function_name)(args)
Perform this operation in the context of the configured device
plugins.
"""
- LOG.debug("create_network() called\n")
+ LOG.debug(_("create_network() called"))
try:
args = [context, network]
ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
Perform this operation in the context of the configured device
plugins.
"""
- LOG.debug("create_network_bulk() called\n")
+ LOG.debug(_("create_network_bulk() called"))
try:
args = [context, networks]
ovs_output = self._plugins[
const.VSWITCH_PLUGIN].create_network_bulk(context, networks)
- LOG.debug("ovs_output: %s\n " % ovs_output)
+ LOG.debug(_("ovs_output: %s"), ovs_output)
vlanids = self._get_all_segmentation_ids()
ovs_networks = ovs_output
return ovs_output
Perform this operation in the context of the configured device
plugins.
"""
- LOG.debug("update_network() called\n")
+ LOG.debug(_("update_network() called"))
args = [context, id, network]
ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
self._func_name(),
Perform this operation in the context of the configured device
plugins.
"""
- LOG.debug("create_port() called\n")
+ LOG.debug(_("create_port() called"))
try:
args = [context, port]
ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
Perform this operation in the context of the configured device
plugins.
"""
- LOG.debug("delete_port() called\n")
+ LOG.debug(_("delete_port() called"))
try:
args = [context, id]
port = self.get_port(context, id)
self._model = importutils.import_object(conf.MODEL_CLASS)
if hasattr(self._model, "MANAGE_STATE") and self._model.MANAGE_STATE:
self._master = False
- LOG.debug("Model %s manages state" % conf.MODEL_CLASS)
+ LOG.debug(_("Model %s manages state"), conf.MODEL_CLASS)
native_bulk_attr_name = ("_%s__native_bulk_support"
% self._model.__class__.__name__)
self.__native_bulk_support = getattr(self._model,
self._model.supported_extension_aliases)
super(PluginV2, self).__init__()
- LOG.debug("Plugin initialization complete")
+ LOG.debug(_("Plugin initialization complete"))
def __getattribute__(self, name):
"""
Creates a new Virtual Network, and assigns it
a symbolic name.
"""
- LOG.debug("create_network() called\n")
+ LOG.debug(_("create_network() called"))
new_network = super(PluginV2, self).create_network(context,
network)
try:
Updates the symbolic name belonging to a particular
Virtual Network.
"""
- LOG.debug("update_network() called\n")
+ LOG.debug(_("update_network() called"))
upd_net_dict = super(PluginV2, self).update_network(context, id,
network)
self._invoke_device_plugins(self._func_name(), [context, id,
Deletes the network with the specified network identifier
belonging to the specified tenant.
"""
- LOG.debug("delete_network() called\n")
+ LOG.debug(_("delete_network() called"))
#We first need to check if there are any ports on this network
with context.session.begin():
network = self._get_network(context, id)
"""
Gets a particular network
"""
- LOG.debug("get_network() called\n")
+ LOG.debug(_("get_network() called"))
return super(PluginV2, self).get_network(context, id, fields)
def get_networks(self, context, filters=None, fields=None):
"""
Gets all networks
"""
- LOG.debug("get_networks() called\n")
+ LOG.debug(_("get_networks() called"))
return super(PluginV2, self).get_networks(context, filters, fields)
def create_port(self, context, port):
"""
Creates a port on the specified Virtual Network.
"""
- LOG.debug("create_port() called\n")
+ LOG.debug(_("create_port() called"))
new_port = super(PluginV2, self).create_port(context, port)
try:
self._invoke_device_plugins(self._func_name(), [context, new_port])
"""
Deletes a port
"""
- LOG.debug("delete_port() called\n")
+ LOG.debug(_("delete_port() called"))
port = self._get_port(context, id)
"""
TODO (Sumit): Disabling this check for now, check later
"""
Updates the state of a port and returns the updated port
"""
- LOG.debug("update_port() called\n")
+ LOG.debug(_("update_port() called"))
try:
self._invoke_device_plugins(self._func_name(), [context, id,
port])
Create a subnet, which represents a range of IP addresses
that can be allocated to devices.
"""
- LOG.debug("create_subnet() called\n")
+ LOG.debug(_("create_subnet() called"))
new_subnet = super(PluginV2, self).create_subnet(context, subnet)
try:
self._invoke_device_plugins(self._func_name(), [context,
"""
Updates the state of a subnet and returns the updated subnet
"""
- LOG.debug("update_subnet() called\n")
+ LOG.debug(_("update_subnet() called"))
try:
self._invoke_device_plugins(self._func_name(), [context, id,
subnet])
"""
Deletes a subnet
"""
- LOG.debug("delete_subnet() called\n")
+ LOG.debug(_("delete_subnet() called"))
with context.session.begin():
subnet = self._get_subnet(context, id)
# Check if ports are using this subnet
"""
def get_all_portprofiles(self, tenant_id):
"""Get all port profiles"""
- LOG.debug("get_all_portprofiles() called\n")
+ LOG.debug(_("get_all_portprofiles() called"))
pplist = cdb.get_all_portprofiles()
new_pplist = []
for portprofile in pplist:
def get_portprofile_details(self, tenant_id, profile_id):
"""Get port profile details"""
- LOG.debug("get_portprofile_details() called\n")
+ LOG.debug(_("get_portprofile_details() called"))
try:
portprofile = cdb.get_portprofile(tenant_id, profile_id)
except Exception:
def create_portprofile(self, tenant_id, profile_name, qos):
"""Create port profile"""
- LOG.debug("create_portprofile() called\n")
+ LOG.debug(_("create_portprofile() called"))
portprofile = cdb.add_portprofile(tenant_id, profile_name,
const.NO_VLAN_ID, qos)
new_pp = cutil.make_portprofile_dict(tenant_id,
def delete_portprofile(self, tenant_id, profile_id):
"""Delete portprofile"""
- LOG.debug("delete_portprofile() called\n")
+ LOG.debug(_("delete_portprofile() called"))
try:
portprofile = cdb.get_portprofile(tenant_id, profile_id)
except Exception:
def rename_portprofile(self, tenant_id, profile_id, new_name):
"""Rename port profile"""
- LOG.debug("rename_portprofile() called\n")
+ LOG.debug(_("rename_portprofile() called"))
try:
portprofile = cdb.get_portprofile(tenant_id, profile_id)
except Exception:
def associate_portprofile(self, tenant_id, net_id,
port_id, portprofile_id):
"""Associate port profile"""
- LOG.debug("associate_portprofile() called\n")
+ LOG.debug(_("associate_portprofile() called"))
try:
portprofile = cdb.get_portprofile(tenant_id, portprofile_id)
except Exception:
def disassociate_portprofile(self, tenant_id, net_id,
port_id, portprofile_id):
"""Disassociate port profile"""
- LOG.debug("disassociate_portprofile() called\n")
+ LOG.debug(_("disassociate_portprofile() called"))
try:
portprofile = cdb.get_portprofile(tenant_id, portprofile_id)
except Exception:
def get_all_qoss(self, tenant_id):
"""Get all QoS levels"""
- LOG.debug("get_all_qoss() called\n")
+ LOG.debug(_("get_all_qoss() called"))
qoslist = cdb.get_all_qoss(tenant_id)
return qoslist
def get_qos_details(self, tenant_id, qos_id):
"""Get QoS Details"""
- LOG.debug("get_qos_details() called\n")
+ LOG.debug(_("get_qos_details() called"))
try:
qos_level = cdb.get_qos(tenant_id, qos_id)
except Exception:
def create_qos(self, tenant_id, qos_name, qos_desc):
"""Create a QoS level"""
- LOG.debug("create_qos() called\n")
+ LOG.debug(_("create_qos() called"))
qos = cdb.add_qos(tenant_id, qos_name, str(qos_desc))
return qos
def delete_qos(self, tenant_id, qos_id):
"""Delete a QoS level"""
- LOG.debug("delete_qos() called\n")
+ LOG.debug(_("delete_qos() called"))
try:
qos_level = cdb.get_qos(tenant_id, qos_id)
except Exception:
def rename_qos(self, tenant_id, qos_id, new_name):
"""Rename QoS level"""
- LOG.debug("rename_qos() called\n")
+ LOG.debug(_("rename_qos() called"))
try:
qos_level = cdb.get_qos(tenant_id, qos_id)
except Exception:
def get_all_credentials(self, tenant_id):
"""Get all credentials"""
- LOG.debug("get_all_credentials() called\n")
+ LOG.debug(_("get_all_credentials() called"))
credential_list = cdb.get_all_credentials(tenant_id)
return credential_list
def get_credential_details(self, tenant_id, credential_id):
"""Get a particular credential"""
- LOG.debug("get_credential_details() called\n")
+ LOG.debug(_("get_credential_details() called"))
try:
credential = cdb.get_credential(tenant_id, credential_id)
except Exception:
def create_credential(self, tenant_id, credential_name, user_name,
password):
"""Create a new credential"""
- LOG.debug("create_credential() called\n")
+ LOG.debug(_("create_credential() called"))
credential = cdb.add_credential(tenant_id, credential_name,
user_name, password)
return credential
def delete_credential(self, tenant_id, credential_id):
"""Delete a credential"""
- LOG.debug("delete_credential() called\n")
+ LOG.debug(_("delete_credential() called"))
try:
credential = cdb.get_credential(tenant_id, credential_id)
except Exception:
def rename_credential(self, tenant_id, credential_id, new_name):
"""Rename the particular credential resource"""
- LOG.debug("rename_credential() called\n")
+ LOG.debug(_("rename_credential() called"))
try:
credential = cdb.get_credential(tenant_id, credential_id)
except Exception:
def schedule_host(self, tenant_id, instance_id, instance_desc):
"""Provides the hostname on which a dynamic vnic is reserved"""
- LOG.debug("schedule_host() called\n")
+ LOG.debug(_("schedule_host() called"))
host_list = self._invoke_device_plugins(self._func_name(),
[tenant_id,
instance_id,
"""
Get the portprofile name and the device name for the dynamic vnic
"""
- LOG.debug("associate_port() called\n")
+ LOG.debug(_("associate_port() called"))
return self._invoke_device_plugins(self._func_name(), [tenant_id,
instance_id,
instance_desc])
"""
Remove the association of the VIF with the dynamic vnic
"""
- LOG.debug("detach_port() called\n")
+ LOG.debug(_("detach_port() called"))
return self._invoke_device_plugins(self._func_name(), [tenant_id,
instance_id,
instance_desc])
"""
Creates multiple ports on the specified Virtual Network.
"""
- LOG.debug("create_ports() called\n")
+ LOG.debug(_("create_ports() called"))
ports_num = len(net_id_list)
ports_id_list = []
ports_dict_list = []
"""
confstr = snipp.CMD_PORT_TRUNK % (interface)
confstr = self.create_xml_snippet(confstr)
- LOG.debug("NexusDriver: %s" % confstr)
+ LOG.debug(_("NexusDriver: %s"), confstr)
mgr.edit_config(target='running', config=confstr)
def disable_switch_port(self, mgr, interface):
"""
confstr = snipp.CMD_NO_SWITCHPORT % (interface)
confstr = self.create_xml_snippet(confstr)
- LOG.debug("NexusDriver: %s" % confstr)
+ LOG.debug(_("NexusDriver: %s"), confstr)
mgr.edit_config(target='running', config=confstr)
def enable_vlan_on_trunk_int(self, mgr, interface, vlanid):
"""
confstr = snipp.CMD_VLAN_INT_SNIPPET % (interface, vlanid)
confstr = self.create_xml_snippet(confstr)
- LOG.debug("NexusDriver: %s" % confstr)
+ LOG.debug(_("NexusDriver: %s"), confstr)
mgr.edit_config(target='running', config=confstr)
def disable_vlan_on_trunk_int(self, mgr, interface, vlanid):
"""
confstr = snipp.CMD_NO_VLAN_INT_SNIPPET % (interface, vlanid)
confstr = self.create_xml_snippet(confstr)
- LOG.debug("NexusDriver: %s" % confstr)
+ LOG.debug(_("NexusDriver: %s"), confstr)
mgr.edit_config(target='running', config=confstr)
def create_vlan(self, vlan_name, vlan_id, nexus_host, nexus_user,
self.enable_vlan(man, vlan_id, vlan_name)
if vlan_ids is '':
vlan_ids = self.build_vlans_cmd()
- LOG.debug("NexusDriver VLAN IDs: %s" % vlan_ids)
+ LOG.debug(_("NexusDriver VLAN IDs: %s"), vlan_ids)
for ports in nexus_ports:
self.enable_vlan_on_trunk_int(man, ports, vlan_ids)
Extracts the configuration parameters from the configuration file
"""
self._client = importutils.import_object(conf.NEXUS_DRIVER)
- LOG.debug("Loaded driver %s\n" % conf.NEXUS_DRIVER)
+ LOG.debug(_("Loaded driver %s"), conf.NEXUS_DRIVER)
self._nexus_switches = conf.NEXUS_DETAILS
self.credentials = {}
<network_uuid, network_name> for
the specified tenant.
"""
- LOG.debug("NexusPlugin:get_all_networks() called\n")
+ LOG.debug(_("NexusPlugin:get_all_networks() called"))
return self._networks.values()
def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id,
and configure the appropriate interfaces
for this VLAN
"""
- LOG.debug("NexusPlugin:create_network() called\n")
+ LOG.debug(_("NexusPlugin:create_network() called"))
# Grab the switch IP and port for this host
switch_ip = ''
port_id = ''
Deletes the VLAN in all switches, and removes the VLAN configuration
from the relevant interfaces
"""
- LOG.debug("NexusPlugin:delete_network() called\n")
+ LOG.debug(_("NexusPlugin:delete_network() called"))
def get_network_details(self, tenant_id, net_id, **kwargs):
"""
Returns the details of a particular network
"""
- LOG.debug("NexusPlugin:get_network_details() called\n")
+ LOG.debug(_("NexusPlugin:get_network_details() called"))
network = self._get_network(tenant_id, net_id)
return network
Updates the properties of a particular
Virtual Network.
"""
- LOG.debug("NexusPlugin:update_network() called\n")
+ LOG.debug(_("NexusPlugin:update_network() called"))
def get_all_ports(self, tenant_id, net_id, **kwargs):
"""
This is probably not applicable to the Nexus plugin.
Delete if not required.
"""
- LOG.debug("NexusPlugin:get_all_ports() called\n")
+ LOG.debug(_("NexusPlugin:get_all_ports() called"))
def create_port(self, tenant_id, net_id, port_state, port_id, **kwargs):
"""
This is probably not applicable to the Nexus plugin.
Delete if not required.
"""
- LOG.debug("NexusPlugin:create_port() called\n")
+ LOG.debug(_("NexusPlugin:create_port() called"))
def delete_port(self, device_id, vlan_id):
"""
whether the network is still required on
the interfaces trunked
"""
- LOG.debug("NexusPlugin:delete_port() called\n")
+ LOG.debug(_("NexusPlugin:delete_port() called"))
# Delete DB row for this port
row = nxos_db.get_nexusvm_binding(vlan_id, device_id)
if row:
This is probably not applicable to the Nexus plugin.
Delete if not required.
"""
- LOG.debug("NexusPlugin:update_port() called\n")
+ LOG.debug(_("NexusPlugin:update_port() called"))
def get_port_details(self, tenant_id, net_id, port_id, **kwargs):
"""
This is probably not applicable to the Nexus plugin.
Delete if not required.
"""
- LOG.debug("NexusPlugin:get_port_details() called\n")
+ LOG.debug(_("NexusPlugin:get_port_details() called"))
def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id,
**kwargs):
This is probably not applicable to the Nexus plugin.
Delete if not required.
"""
- LOG.debug("NexusPlugin:plug_interface() called\n")
+ LOG.debug(_("NexusPlugin:plug_interface() called"))
def unplug_interface(self, tenant_id, net_id, port_id, **kwargs):
"""
This is probably not applicable to the Nexus plugin.
Delete if not required.
"""
- LOG.debug("NexusPlugin:unplug_interface() called\n")
+ LOG.debug(_("NexusPlugin:unplug_interface() called"))
def _get_vlan_id_for_network(self, tenant_id, network_id, context,
base_plugin_ref):
management_net_name, northbound_net_name,
southbound_net_name, *args):
"""Inserting a network service between two networks"""
- print ("Creating Network for Services and Servers")
+ print _("Creating Network for Services and Servers")
service_logic = servlogcs.ServicesLogistics()
net_list = {}
multiport_net_list = []
data = {servconts.NETWORK: {servconts.NAME: net}}
net_list[net] = client.create_network(data)
net_list[net][servconts.PORTS] = []
- LOG.debug("Network %s Created with ID: %s " % (
- net, net_list[net][servconts.NETWORK][servconts.ID]))
- print "Completed"
- print ("Creating Ports on Services and Server Networks")
- LOG.debug("Operation 'create_port' executed.")
+ LOG.debug(_("Network %(net)s Created with ID: %(id)s "),
+ {'net': net,
+ 'id': net_list[net][servconts.NETWORK][servconts.ID]})
+ print _("Completed")
+ print _("Creating Ports on Services and Server Networks")
+ LOG.debug(_("Operation 'create_port' executed."))
if not service_logic.verify_plugin(const.UCS_PLUGIN):
for net in networks_name_list:
net_list[net][servconts.PORTS].append
(client.create_port
(net_list[net][servconts.NETWORK][servconts.ID]))
- LOG.debug("Operation 'create_port' executed.")
+ LOG.debug(_("Operation 'create_port' executed."))
else:
for net in networks_name_list:
nets = net_list[net][servconts.NETWORK][servconts.ID]
for net in networks_name_list:
port_id = data[servconts.PORTS][net_idx][servconts.ID]
net_list[net][servconts.PORTS].append(port_id)
- LOG.debug("Port UUID: %s on network: %s" %
- (data[servconts.PORTS][net_idx][servconts.ID], net))
+ LOG.debug(_("Port UUID: %(id)s on network: %(net)s"),
+ {'id': data[servconts.PORTS][net_idx][servconts.ID],
+ 'net': net})
net_idx = net_idx + 1
- print "Completed"
+ print _("Completed")
try:
create_vm_args = []
create_vm_args.append(servconts.CREATE_VM_CMD)
create_vm_args.append(service_image_id)
- print ("Creating VM with image: %s" % (service_image_id))
+ print _("Creating VM with image: %s") % (service_image_id)
process = utils.subprocess_popen(create_vm_args,
stdout=subprocess.PIPE)
result = process.stdout.readlines()
tokens = re.search("i-[a-f0-9]*", str(result[1]))
service_vm_name = tokens.group(0)
- print ("Image: %s instantiated successfully" % (service_vm_name))
+ print _("Image: %s instantiated successfully") % (service_vm_name)
except Exception as exc:
print exc
service_logic.image_status(service_vm_name)
- print "Completed"
- print "Attaching Ports To VM Service interfaces"
+ print _("Completed")
+ print _("Attaching Ports To VM Service interfaces")
try:
idx = 0
for net in networks_name_list:
port_id = net_list[net][servconts.PORTS][idx]
attachment = client.show_port_attachment(network_id, port_id)
attachment = attachment[servconts.ATTACHMENT][servconts.ID][:36]
- LOG.debug(("Plugging virtual interface: %s of VM %s"
- "into port: %s on network: %s") %
- (attachment, service_vm_name, port_id, net))
+ LOG.debug(_("Plugging virtual interface: %(attachment)s of VM "
+ "%(service_vm_name)s into port: %(port_id)s on "
+ "network: %(net)s"), locals())
attach_data = {servconts.ATTACHMENT: {servconts.ID: '%s' %
attachment}}
client.attach_resource(network_id, port_id, attach_data)
except Exception as exc:
print exc
- print "Completed"
+ print _("Completed")
try:
- LOG.debug("Registering Service in DB")
+ LOG.debug(_("Registering Service in DB"))
l2db.initialize()
for uuid_net in db.network_id(networks_name_list[0]):
mngnet_id = str(uuid_net.uuid)
Removes a service and all the network configuration
"""
l2db.initialize()
- print ("Terminating Service VM")
+ print _("Terminating Service VM")
service_logic = servlogcs.ServicesLogistics()
vms_list = []
vms_list.append(servconts.DELETE_VM_CMD)
vms_list.append(service_instance_id)
if not service_logic.image_exist(service_instance_id):
- print ("Service VM does not exist")
+ print _("Service VM does not exist")
sys.exit()
result = subprocess.call(vms_list)
client = Client(HOST, PORT, USE_SSL, format='json', tenant=tenant_id)
service_nets = sdb.get_service_bindings(service_instance_id)
- print ("Terminating Ports and Networks")
+ print _("Terminating Ports and Networks")
network_name = db.network_get(service_nets.mngnet_id)
port_id_net = db.port_list(service_nets.mngnet_id)
for ports_uuid in port_id_net:
client.delete_port(service_nets.sbnet_id, ports_uuid.uuid)
client.delete_network(service_nets.sbnet_id)
service_list = sdb.remove_services_binding(service_instance_id)
- print ("Configuration Removed Successfully")
+ print _("Configuration Removed Successfully")
def disconnect_vm(vm_instance_id, *args):
Deletes VMs and Port connection
"""
l2db.initialize()
- print ("Terminating Service VM")
+ print _("Terminating Service VM")
service_logic = servlogcs.ServicesLogistics()
vms_list = []
vms_list.append(servconts.DELETE_VM_CMD)
vms_list.append(vm_instance_id)
result = subprocess.call(vms_list)
service_logic.image_shutdown_verification(vm_instance_id)
- print ("VM Server Off")
+ print _("VM Server Off")
def connect_vm(tenant_id, vm_image_id, service_instance_id, *args):
"""
l2db.initialize()
client = Client(HOST, PORT, USE_SSL, format='json', tenant=tenant_id)
- print ("Connecting %s to Service %s " % (vm_image_id, service_instance_id))
+ print (_("Connecting %(vm_image_id)s to Service "
+ "%(service_instance_id)s") % locals())
service_logic = servlogcs.ServicesLogistics()
service_nets = sdb.get_service_bindings(service_instance_id)
client.create_port(service_nets.mngnet_id)
client.create_port(service_nets.nbnet_id)
sb_port_id = client.create_port(service_nets.sbnet_id)
- LOG.debug("Operation 'create_port' executed.")
+ LOG.debug(_("Operation 'create_port' executed."))
new_port_id = sb_port_id[servconts.PORT][servconts.ID]
try:
create_vm_args = []
create_vm_args.append(servconts.CREATE_VM_CMD)
create_vm_args.append(vm_image_id)
- print ("Creating VM with image: %s" % (vm_image_id))
+ print _("Creating VM with image: %s") % (vm_image_id)
process = utils.subprocess_popen(create_vm_args,
stdout=subprocess.PIPE)
result = process.stdout.readlines()
tokens = re.search("i-[a-f0-9]*", str(result[1]))
vm_name = tokens.group(0)
- print ("Image: %s instantiated successfully" % (vm_name))
+ print _("Image: %s instantiated successfully") % (vm_name)
except Exception as exc:
print exc
service_logic.image_status(vm_name)
- print "Completed"
- print "Attaching Ports To VM Service interfaces"
+ print _("Completed")
+ print _("Attaching Ports To VM Service interfaces")
south_net = service_nets.sbnet_id
attachment = client.show_port_attachment(south_net, new_port_id)
attachment = attachment[servconts.ATTACHMENT][servconts.ID][:36]
- LOG.debug(("Plugging virtual interface: %s of VM %s "
- "into port: %s on network: %s") %
- (attachment, vm_name, new_port_id, service_nets.sbnet_id))
+ LOG.debug(_("Plugging virtual interface: %(attachment)s of VM "
+ "%(vm_name)s into port: %(new_port_id)s on network: "
+ "%(sbnet_id)s"), {'attachment': attachment,
+ 'vm_name': vm_name,
+ 'new_port_id': new_port_id,
+ 'sbnet_id': service_nets.sbnet_id})
attach_data = {servconts.ATTACHMENT: {servconts.ID: '%s' % attachment}}
client.attach_resource(service_nets.sbnet_id, new_port_id, attach_data)
- print ("Connect VM Ended")
+ print _("Connect VM Ended")
def create_multiport(tenant_id, networks_list, *args):
args.append(arglist[0])
del arglist[0]
except:
- LOG.debug("Not enough arguments for \"%s\" (expected: %d, got: %d)" %
- (cmd, len(cmdargs), len(orig_arglist)))
- print "Service Insertion Usage:\n %s %s" % (
- cmd, " ".join(["<%s>" % y for y in SERVICE_COMMANDS[cmd]["args"]]))
+ LOG.debug(_("Not enough arguments for '%(cmd)s' "
+ "(expected: %(len_cmd)d, got: %(len_args)d)",
+ {'cmd': cmd, 'len_cmd': len(cmdargs),
+ 'len_args': len(orig_arglist)}))
+ print (_("Service Insertion Usage:\n %(cmd)s %(usage)s") %
+ {'cmd': cmd,
+ 'usage': " ".join(["<%s>" % y
+ for y in SERVICE_COMMANDS[cmd]["args"]])})
sys.exit()
if len(arglist) > 0:
- LOG.debug("Too many arguments for \"%s\" (expected: %d, got: %d)"
- % (cmd, len(cmdargs), len(orig_arglist)))
- print "Service Insertion Usage:\n %s %s" % (
- cmd, " ".join(["<%s>" % y for y in SERVICE_COMMANDS[cmd]["args"]]))
+ LOG.debug(_("Too many arguments for '%(cmd)s' (expected: %(len)d, "
+ "got: %(len_args)d)"),
+ {'cmd': cmd, 'len_cmd': len(cmdargs),
+ 'len_args': len(orig_arglist)})
+ print (_("Service Insertion Usage:\n %(cmd)s %(usage)s") %
+ {'cmd': cmd,
+ 'usage': " ".join(["<%s>" % y
+ for y in SERVICE_COMMANDS[cmd]["args"]])})
sys.exit()
return args
if __name__ == "__main__":
os.system("clear")
- usagestr = "Usage: %prog [OPTIONS] <command> [args]"
+ usagestr = _("Usage: %prog [OPTIONS] <command> [args]")
PARSER = OptionParser(usage=usagestr)
PARSER.add_option("-H", "--host", dest="host",
type="string", default="127.0.0.1",
- help="ip address of api host")
+ help=_("IP address of api host"))
PARSER.add_option("-p", "--port", dest="port",
- type="int", default=9696, help="api port")
+ type="int", default=9696, help=_("Api port"))
PARSER.add_option("-s", "--ssl", dest="ssl",
- action="store_true", default=False, help="use ssl")
+ action="store_true", default=False, help=_("Use ssl"))
PARSER.add_option("-v", "--verbose", dest="verbose",
action="store_true", default=False,
- help="turn on verbose logging")
+ help=_("Turn on verbose logging"))
PARSER.add_option("-f", "--logfile", dest="logfile",
- type="string", default="syslog", help="log file path")
+ type="string", default="syslog",
+ help=_("Log file path"))
options, args = PARSER.parse_args()
if options.verbose:
LOG.setLevel(logging.DEBUG)
plugin_obj = conf.PLUGINS[const.PLUGINS][key]
_plugins[key] = importutils.import_object(plugin_obj)
if not plugin_key in _plugins.keys():
- LOG.debug("No %s Plugin loaded" % plugin_key)
+ LOG.debug(_("No %s Plugin loaded"), plugin_key)
return False
else:
- LOG.debug("Plugin %s founded" % const.UCS_PLUGIN)
+ LOG.debug(_("Plugin %s founded"), const.UCS_PLUGIN)
return True
def press_key(self):
"""
Waits for en external input
"""
- key = raw_input("Press any key to continue")
+ key = raw_input(_("Press any key to continue"))
return key
def _load_inventory(self):
"""Load the inventory from a config file"""
inventory = deepcopy(conf.INVENTORY)
- LOG.info("Loaded UCS inventory: %s\n" % inventory)
- LOG.info("Building UCS inventory state (this may take a while)...")
+ LOG.info(_("Loaded UCS inventory: %s"), inventory)
+ LOG.info(_("Building UCS inventory state (this may take a while)..."))
for ucsm in inventory.keys():
ucsm_ip = inventory[ucsm][const.IP_ADDRESS]
ucsm_password)
blades_dict[blade_id] = blade_data
- LOG.debug("UCS Inventory state is: %s\n" % self._inventory_state)
+ LOG.debug(_("UCS Inventory state is: %s"), self._inventory_state)
return True
def _get_host_name(self, ucsm_ip, chassis_id, blade_id):
udb.update_portbinding(port_id,
instance_id=instance_id)
return host_name
- LOG.warn("Could not find a reserved dynamic nic for tenant: %s" %
+ LOG.warn(_("Could not find a reserved dynamic nic for tenant: %s"),
tenant_id)
return None
intf_data[const.TENANTID] == tenant_id and
intf_data[const.INSTANCE_ID] == instance_id):
found_blade_intf_data = blade_intf_data
- LOG.debug(("Found blade %s associated with this"
- " instance: %s") % (blade_id,
- instance_id))
+ LOG.debug(_("Found blade %(blade_id)s "
+ "associated with this"
+ " instance: %(instance_id)s"),
+ locals())
break
if found_blade_intf_data:
const.DEVICENAME: device_name,
const.UCSPROFILE: profile_name,
}
- LOG.debug(("Found reserved dynamic nic: %s"
- "associated with port %s") %
- (intf_data, port_id))
- LOG.debug("Returning dynamic nic details: %s" %
+ LOG.debug(_("Found reserved dynamic nic: %(intf_data)s"
+ "associated with port %(port_id)s"), locals())
+ LOG.debug(_("Returning dynamic nic details: %s"),
dynamicnic_details)
return dynamicnic_details
- LOG.warn("Could not find a reserved dynamic nic for tenant: %s" %
+ LOG.warn(_("Could not find a reserved dynamic nic for tenant: %s"),
tenant_id)
return None
udb.update_portbinding(port_id, instance_id=None,
vif_id=None)
LOG.debug(
- ("Disassociated VIF-ID: %s "
- "from port: %s"
- "in UCS inventory state for blade: %s") %
- (vif_id, port_id, intf_data))
+ _("Disassociated VIF-ID: %(vif_id)s "
+ "from port: %(port_id)s"
+ "in UCS inventory state for blade: "
+ "%(intf_data)s"), locals())
device_params = {const.DEVICE_IP: [ucsm_ip],
const.PORTID: port_id}
return device_params
- LOG.warn(("Disassociating VIF-ID in UCS inventory failed. "
- "Could not find a reserved dynamic nic for tenant: %s") %
+ LOG.warn(_("Disassociating VIF-ID in UCS inventory failed. "
+ "Could not find a reserved dynamic nic for tenant: %s"),
tenant_id)
return None
const.BLADE_INTF_DN:
interface_dn}
return blade_intf_info
- LOG.warn("Could not find a reserved nic for tenant: %s port: %s" %
- (tenant_id, port_id))
+ LOG.warn(_("Could not find a reserved nic for tenant: %(tenant_id)s "
+ "port: %(port_id)s"), locals())
return None
def _get_least_reserved_blade(self, intf_count=1):
least_reserved_blade_data = blade_data
if unreserved_interface_count < intf_count:
- LOG.warn(("Not enough dynamic nics available on a single host."
- " Requested: %s, Maximum available: %s") %
- (intf_count, unreserved_interface_count))
+ LOG.warn(_("Not enough dynamic nics available on a single host."
+ " Requested: %(intf_count)s, Maximum available: "
+ "%(unreserved_interface_count)s"), locals())
return False
least_reserved_blade_dict = {
const.LEAST_RSVD_BLADE_ID: least_reserved_blade_id,
const.LEAST_RSVD_BLADE_DATA: least_reserved_blade_data,
}
- LOG.debug("Found dynamic nic %s available for reservation",
+ LOG.debug(_("Found dynamic nic %s available for reservation"),
least_reserved_blade_dict)
return least_reserved_blade_dict
None, None, None)
udb.update_portbinding(port_id,
tenant_id=intf_data[const.TENANTID])
- LOG.debug("Reserved blade interface: %s\n" % reserved_nic_dict)
+ LOG.debug(_("Reserved blade interface: %s"),
+ reserved_nic_dict)
return reserved_nic_dict
- LOG.warn("Dynamic nic %s could not be reserved for port-id: %s" %
- (blade_data, port_id))
+ LOG.warn(_("Dynamic nic %(blade_data)s could not be reserved for "
+ "port-id: %(port_id)s"), locals())
return False
def unreserve_blade_interface(self, ucsm_ip, chassis_id, blade_id,
blade_intf[const.PROFILE_ID] = None
blade_intf[const.INSTANCE_ID] = None
blade_intf[const.VIF_ID] = None
- LOG.debug("Unreserved blade interface %s\n" % interface_dn)
+ LOG.debug(_("Unreserved blade interface %s"), interface_dn)
def add_blade(self, ucsm_ip, chassis_id, blade_id):
"""Add a blade to the inventory"""
def get_all_networks(self, args):
"""Return all UCSM IPs"""
- LOG.debug("get_all_networks() called\n")
+ LOG.debug(_("get_all_networks() called"))
return self._get_all_ucsms()
def create_network(self, args):
"""Return all UCSM IPs"""
- LOG.debug("create_network() called\n")
+ LOG.debug(_("create_network() called"))
return self._get_all_ucsms()
def delete_network(self, args):
"""Return all UCSM IPs"""
- LOG.debug("delete_network() called\n")
+ LOG.debug(_("delete_network() called"))
return self._get_all_ucsms()
def get_network_details(self, args):
"""Return all UCSM IPs"""
- LOG.debug("get_network_details() called\n")
+ LOG.debug(_("get_network_details() called"))
return self._get_all_ucsms()
def update_network(self, args):
"""Return all UCSM IPs"""
- LOG.debug("update_network() called\n")
+ LOG.debug(_("update_network() called"))
return self._get_all_ucsms()
def get_all_ports(self, args):
"""Return all UCSM IPs"""
- LOG.debug("get_all_ports() called\n")
+ LOG.debug(_("get_all_ports() called"))
return self._get_all_ucsms()
def create_port(self, args):
Return the a dict with information of the blade
on which a dynamic vnic is available
"""
- LOG.debug("create_port() called\n")
+ LOG.debug(_("create_port() called"))
least_reserved_blade_dict = self._get_least_reserved_blade()
if not least_reserved_blade_dict:
raise cexc.NoMoreNics()
Return the a dict with information of the blade
on which a dynamic vnic was reserved for this port
"""
- LOG.debug("delete_port() called\n")
+ LOG.debug(_("delete_port() called"))
tenant_id = args[0]
net_id = args[1]
port_id = args[2]
rsvd_info = self._get_rsvd_blade_intf_by_port(tenant_id, port_id)
if not rsvd_info:
- LOG.warn("UCSInventory: Port not found: net_id: %s, port_id: %s" %
- (net_id, port_id))
+ LOG.warn(_("UCSInventory: Port not found: net_id: %(net_id)s, "
+ "port_id: %(port_id)s"), locals())
return {const.DEVICE_IP: []}
device_params = {
const.DEVICE_IP: [rsvd_info[const.UCSM_IP]],
Return the a dict with IP address of the blade
on which a dynamic vnic was reserved for this port
"""
- LOG.debug("update_port() called\n")
+ LOG.debug(_("update_port() called"))
return self._get_blade_for_port(args)
def get_port_details(self, args):
Return the a dict with IP address of the blade
on which a dynamic vnic was reserved for this port
"""
- LOG.debug("get_port_details() called\n")
+ LOG.debug(_("get_port_details() called"))
return self._get_blade_for_port(args)
def plug_interface(self, args):
Return the a dict with IP address of the blade
on which a dynamic vnic was reserved for this port
"""
- LOG.debug("plug_interface() called\n")
+ LOG.debug(_("plug_interface() called"))
return self._get_blade_for_port(args)
def unplug_interface(self, args):
Return the a dict with IP address of the blade
on which a dynamic vnic was reserved for this port
"""
- LOG.debug("unplug_interface() called\n")
+ LOG.debug(_("unplug_interface() called"))
return self._get_blade_for_port(args)
def schedule_host(self, args):
"""Provides the hostname on which a dynamic vnic is reserved"""
- LOG.debug("schedule_host() called\n")
+ LOG.debug(_("schedule_host() called"))
instance_id = args[1]
tenant_id = args[2][const.PROJECT_ID]
host_name = self._get_host_name_for_rsvd_intf(tenant_id, instance_id)
host_list = {const.HOST_LIST: {const.HOST_1: host_name}}
- LOG.debug("host_list is: %s" % host_list)
+ LOG.debug(_("host_list is: %s"), host_list)
return host_list
def associate_port(self, args):
"""
Get the portprofile name and the device name for the dynamic vnic
"""
- LOG.debug("associate_port() called\n")
+ LOG.debug(_("associate_port() called"))
instance_id = args[1]
tenant_id = args[2][const.PROJECT_ID]
vif_id = args[2][const.VIF_ID]
vif_info = self._get_instance_port(tenant_id, instance_id, vif_id)
vif_desc = {const.VIF_DESC: vif_info}
- LOG.debug("vif_desc is: %s" % vif_desc)
+ LOG.debug(_("vif_desc is: %s"), vif_desc)
return vif_desc
def detach_port(self, args):
Remove the VIF-ID and instance name association
with the port
"""
- LOG.debug("detach_port() called\n")
+ LOG.debug(_("detach_port() called"))
instance_id = args[1]
tenant_id = args[2][const.PROJECT_ID]
vif_id = args[2][const.VIF_ID]
"""
Create multiple ports for a VM
"""
- LOG.debug("create_ports() called\n")
+ LOG.debug(_("create_ports() called"))
tenant_id = args[0]
ports_num = args[2]
least_reserved_blade_dict = self._get_least_reserved_blade(ports_num)
def __init__(self):
self._driver = importutils.import_object(conf.UCSM_DRIVER)
- LOG.debug("Loaded driver %s\n" % conf.UCSM_DRIVER)
+ LOG.debug(_("Loaded driver %s"), conf.UCSM_DRIVER)
# TODO (Sumit) Make the counter per UCSM
self._port_profile_counter = 0
<network_uuid, network_name> for
the specified tenant.
"""
- LOG.debug("UCSVICPlugin:get_all_networks() called\n")
+ LOG.debug(_("UCSVICPlugin:get_all_networks() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
networks_list = db.network_list(tenant_id)
new_networks_list = []
Creates a new Virtual Network, and assigns it
a symbolic name.
"""
- LOG.debug("UCSVICPlugin:create_network() called\n")
+ LOG.debug(_("UCSVICPlugin:create_network() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
self._driver.create_vlan(vlan_name, str(vlan_id), self._ucsm_ip,
self._ucsm_username, self._ucsm_password)
Deletes the network with the specified network identifier
belonging to the specified tenant.
"""
- LOG.debug("UCSVICPlugin:delete_network() called\n")
+ LOG.debug(_("UCSVICPlugin:delete_network() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
vlan_binding = cdb.get_vlan_binding(net_id)
vlan_name = vlan_binding[const.VLANNAME]
Deletes the Virtual Network belonging to a the
spec
"""
- LOG.debug("UCSVICPlugin:get_network_details() called\n")
+ LOG.debug(_("UCSVICPlugin:get_network_details() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
network = db.network_get(net_id)
ports_list = network[const.NETWORKPORTS]
Updates the symbolic name belonging to a particular
Virtual Network.
"""
- LOG.debug("UCSVICPlugin:update_network() called\n")
+ LOG.debug(_("UCSVICPlugin:update_network() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
network = db.network_get(net_id)
net_dict = cutil.make_net_dict(network[const.UUID],
Retrieves all port identifiers belonging to the
specified Virtual Network.
"""
- LOG.debug("UCSVICPlugin:get_all_ports() called\n")
+ LOG.debug(_("UCSVICPlugin:get_all_ports() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
network = db.network_get(net_id)
ports_list = network[const.NETWORKPORTS]
"""
Creates a port on the specified Virtual Network.
"""
- LOG.debug("UCSVICPlugin:create_port() called\n")
+ LOG.debug(_("UCSVICPlugin:create_port() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
qos = None
ucs_inventory = kwargs[const.UCS_INVENTORY]
the remote interface should first be un-plugged and
then the port can be deleted.
"""
- LOG.debug("UCSVICPlugin:delete_port() called\n")
+ LOG.debug(_("UCSVICPlugin:delete_port() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
ucs_inventory = kwargs[const.UCS_INVENTORY]
chassis_id = kwargs[const.CHASSIS_ID]
"""
Updates the state of a port on the specified Virtual Network.
"""
- LOG.debug("UCSVICPlugin:update_port() called\n")
+ LOG.debug(_("UCSVICPlugin:update_port() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
pass
This method allows the user to retrieve a remote interface
that is attached to this particular port.
"""
- LOG.debug("UCSVICPlugin:get_port_details() called\n")
+ LOG.debug(_("UCSVICPlugin:get_port_details() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
port_binding = udb.get_portbinding(port_id)
return port_binding
Attaches a remote interface to the specified port on the
specified Virtual Network.
"""
- LOG.debug("UCSVICPlugin:plug_interface() called\n")
+ LOG.debug(_("UCSVICPlugin:plug_interface() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
port_binding = udb.get_portbinding(port_id)
profile_name = port_binding[const.PORTPROFILENAME]
Detaches a remote interface from the specified port on the
specified Virtual Network.
"""
- LOG.debug("UCSVICPlugin:unplug_interface() called\n")
+ LOG.debug(_("UCSVICPlugin:unplug_interface() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
port_binding = udb.get_portbinding(port_id)
profile_name = port_binding[const.PORTPROFILENAME]
"""
Creates a port on the specified Virtual Network.
"""
- LOG.debug("UCSVICPlugin:create_multiport() called\n")
+ LOG.debug(_("UCSVICPlugin:create_multiport() called"))
self._set_ucsm(kwargs[const.DEVICE_IP])
qos = None
ucs_inventory = kwargs[const.UCS_INVENTORY]
"""
Remove the association of the VIF with the dynamic vnic
"""
- LOG.debug("detach_port() called\n")
+ LOG.debug(_("detach_port() called"))
port_id = kwargs[const.PORTID]
kwargs.pop(const.PORTID)
return self.unplug_interface(tenant_id, None, port_id, **kwargs)