Fix i18n messages for cisco plugin

fix bug 1101676

Change-Id: I671092b4c47b77bc42474b5bf2f6b8d9791acce6
This commit is contained in:
He Jie Xu 2013-01-19 12:23:04 +08:00
parent 823b639513
commit 316dfbc29a
15 changed files with 299 additions and 279 deletions

View File

@ -70,9 +70,9 @@ class PortprofileNotFound(webob.exc.HTTPClientError):
code: 450, title: Portprofile not Found code: 450, title: Portprofile not Found
""" """
code = 450 code = 450
title = 'Portprofile Not Found' title = _('Portprofile Not Found')
explanation = ('Unable to find a Portprofile with' explanation = _('Unable to find a Portprofile with'
' the specified identifier.') ' the specified identifier.')
class PortNotFound(webob.exc.HTTPClientError): class PortNotFound(webob.exc.HTTPClientError):
@ -85,8 +85,8 @@ class PortNotFound(webob.exc.HTTPClientError):
code: 430, title: Port not Found code: 430, title: Port not Found
""" """
code = 430 code = 430
title = 'Port not Found' title = _('Port not Found')
explanation = ('Unable to find a port with the specified identifier.') explanation = _('Unable to find a port with the specified identifier.')
class CredentialNotFound(webob.exc.HTTPClientError): class CredentialNotFound(webob.exc.HTTPClientError):
@ -99,9 +99,9 @@ class CredentialNotFound(webob.exc.HTTPClientError):
code: 451, title: Credential not Found code: 451, title: Credential not Found
""" """
code = 451 code = 451
title = 'Credential Not Found' title = _('Credential Not Found')
explanation = ('Unable to find a Credential with' explanation = _('Unable to find a Credential with'
' the specified identifier.') ' the specified identifier.')
class QosNotFound(webob.exc.HTTPClientError): class QosNotFound(webob.exc.HTTPClientError):
@ -114,9 +114,9 @@ class QosNotFound(webob.exc.HTTPClientError):
code: 452, title: QoS not Found code: 452, title: QoS not Found
""" """
code = 452 code = 452
title = 'QoS Not Found' title = _('QoS Not Found')
explanation = ('Unable to find a QoS with' explanation = _('Unable to find a QoS with'
' the specified identifier.') ' the specified identifier.')
class NovatenantNotFound(webob.exc.HTTPClientError): class NovatenantNotFound(webob.exc.HTTPClientError):
@ -129,9 +129,9 @@ class NovatenantNotFound(webob.exc.HTTPClientError):
code: 453, title: Nova tenant not Found code: 453, title: Nova tenant not Found
""" """
code = 453 code = 453
title = 'Nova tenant Not Found' title = _('Nova tenant Not Found')
explanation = ('Unable to find a Novatenant with' explanation = _('Unable to find a Novatenant with'
' the specified identifier.') ' the specified identifier.')
class MultiportNotFound(webob.exc.HTTPClientError): class MultiportNotFound(webob.exc.HTTPClientError):
@ -144,9 +144,9 @@ class MultiportNotFound(webob.exc.HTTPClientError):
code: 454, title: Multiport not Found code: 454, title: Multiport not Found
""" """
code = 454 code = 454
title = 'Multiport Not Found' title = _('Multiport Not Found')
explanation = ('Unable to find Multiport with' explanation = _('Unable to find Multiport with'
' the specified identifier.') ' the specified identifier.')
class RequestedStateInvalid(webob.exc.HTTPClientError): class RequestedStateInvalid(webob.exc.HTTPClientError):
@ -159,5 +159,5 @@ class RequestedStateInvalid(webob.exc.HTTPClientError):
code: 431, title: Requested State Invalid code: 431, title: Requested State Invalid
""" """
code = 431 code = 431
title = 'Requested State Invalid' title = _('Requested State Invalid')
explanation = ('Unable to update port state with specified value.') explanation = _('Unable to update port state with specified value.')

View File

@ -35,7 +35,7 @@ def initialize():
def create_vlanids(): def create_vlanids():
"""Prepopulates the vlan_bindings table""" """Prepopulates the vlan_bindings table"""
LOG.debug("create_vlanids() called") LOG.debug(_("create_vlanids() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanid = session.query(l2network_models.VlanID).one() vlanid = session.query(l2network_models.VlanID).one()
@ -54,7 +54,7 @@ def create_vlanids():
def get_all_vlanids(): def get_all_vlanids():
"""Gets all the vlanids""" """Gets all the vlanids"""
LOG.debug("get_all_vlanids() called") LOG.debug(_("get_all_vlanids() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanids = session.query(l2network_models.VlanID).all() vlanids = session.query(l2network_models.VlanID).all()
@ -65,7 +65,7 @@ def get_all_vlanids():
def is_vlanid_used(vlan_id): def is_vlanid_used(vlan_id):
"""Checks if a vlanid is in use""" """Checks if a vlanid is in use"""
LOG.debug("is_vlanid_used() called") LOG.debug(_("is_vlanid_used() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanid = (session.query(l2network_models.VlanID). vlanid = (session.query(l2network_models.VlanID).
@ -77,7 +77,7 @@ def is_vlanid_used(vlan_id):
def release_vlanid(vlan_id): def release_vlanid(vlan_id):
"""Sets the vlanid state to be unused""" """Sets the vlanid state to be unused"""
LOG.debug("release_vlanid() called") LOG.debug(_("release_vlanid() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanid = (session.query(l2network_models.VlanID). vlanid = (session.query(l2network_models.VlanID).
@ -93,7 +93,7 @@ def release_vlanid(vlan_id):
def delete_vlanid(vlan_id): def delete_vlanid(vlan_id):
"""Deletes a vlanid entry from db""" """Deletes a vlanid entry from db"""
LOG.debug("delete_vlanid() called") LOG.debug(_("delete_vlanid() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanid = (session.query(l2network_models.VlanID). vlanid = (session.query(l2network_models.VlanID).
@ -107,7 +107,7 @@ def delete_vlanid(vlan_id):
def reserve_vlanid(): def reserve_vlanid():
"""Reserves the first unused vlanid""" """Reserves the first unused vlanid"""
LOG.debug("reserve_vlanid() called") LOG.debug(_("reserve_vlanid() called"))
session = db.get_session() session = db.get_session()
try: try:
rvlan = (session.query(l2network_models.VlanID). rvlan = (session.query(l2network_models.VlanID).
@ -126,7 +126,7 @@ def reserve_vlanid():
def get_all_vlanids_used(): def get_all_vlanids_used():
"""Gets all the vlanids used""" """Gets all the vlanids used"""
LOG.debug("get_all_vlanids() called") LOG.debug(_("get_all_vlanids() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanids = (session.query(l2network_models.VlanID). vlanids = (session.query(l2network_models.VlanID).
@ -138,7 +138,7 @@ def get_all_vlanids_used():
def get_all_vlan_bindings(): def get_all_vlan_bindings():
"""Lists all the vlan to network associations""" """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() session = db.get_session()
try: try:
bindings = session.query(l2network_models.VlanBinding).all() bindings = session.query(l2network_models.VlanBinding).all()
@ -149,7 +149,7 @@ def get_all_vlan_bindings():
def get_vlan_binding(netid): def get_vlan_binding(netid):
"""Lists the vlan given a network_id""" """Lists the vlan given a network_id"""
LOG.debug("get_vlan_binding() called") LOG.debug(_("get_vlan_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(l2network_models.VlanBinding). binding = (session.query(l2network_models.VlanBinding).
@ -161,7 +161,7 @@ def get_vlan_binding(netid):
def add_vlan_binding(vlanid, vlanname, netid): def add_vlan_binding(vlanid, vlanname, netid):
"""Adds a vlan to network association""" """Adds a vlan to network association"""
LOG.debug("add_vlan_binding() called") LOG.debug(_("add_vlan_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(l2network_models.VlanBinding). binding = (session.query(l2network_models.VlanBinding).
@ -177,7 +177,7 @@ def add_vlan_binding(vlanid, vlanname, netid):
def remove_vlan_binding(netid): def remove_vlan_binding(netid):
"""Removes a vlan to network association""" """Removes a vlan to network association"""
LOG.debug("remove_vlan_binding() called") LOG.debug(_("remove_vlan_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(l2network_models.VlanBinding). binding = (session.query(l2network_models.VlanBinding).
@ -191,7 +191,7 @@ def remove_vlan_binding(netid):
def update_vlan_binding(netid, newvlanid=None, newvlanname=None): def update_vlan_binding(netid, newvlanid=None, newvlanname=None):
"""Updates a vlan to network association""" """Updates a vlan to network association"""
LOG.debug("update_vlan_binding() called") LOG.debug(_("update_vlan_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(l2network_models.VlanBinding). binding = (session.query(l2network_models.VlanBinding).
@ -209,7 +209,7 @@ def update_vlan_binding(netid, newvlanid=None, newvlanname=None):
def get_all_portprofiles(): def get_all_portprofiles():
"""Lists all the port profiles""" """Lists all the port profiles"""
LOG.debug("get_all_portprofiles() called") LOG.debug(_("get_all_portprofiles() called"))
session = db.get_session() session = db.get_session()
try: try:
pps = session.query(l2network_models.PortProfile).all() pps = session.query(l2network_models.PortProfile).all()
@ -220,7 +220,7 @@ def get_all_portprofiles():
def get_portprofile(tenantid, ppid): def get_portprofile(tenantid, ppid):
"""Lists a port profile""" """Lists a port profile"""
LOG.debug("get_portprofile() called") LOG.debug(_("get_portprofile() called"))
session = db.get_session() session = db.get_session()
try: try:
pp = (session.query(l2network_models.PortProfile). pp = (session.query(l2network_models.PortProfile).
@ -233,7 +233,7 @@ def get_portprofile(tenantid, ppid):
def add_portprofile(tenantid, ppname, vlanid, qos): def add_portprofile(tenantid, ppname, vlanid, qos):
"""Adds a port profile""" """Adds a port profile"""
LOG.debug("add_portprofile() called") LOG.debug(_("add_portprofile() called"))
session = db.get_session() session = db.get_session()
try: try:
pp = (session.query(l2network_models.PortProfile). pp = (session.query(l2network_models.PortProfile).
@ -249,7 +249,7 @@ def add_portprofile(tenantid, ppname, vlanid, qos):
def remove_portprofile(tenantid, ppid): def remove_portprofile(tenantid, ppid):
"""Removes a port profile""" """Removes a port profile"""
LOG.debug("remove_portprofile() called") LOG.debug(_("remove_portprofile() called"))
session = db.get_session() session = db.get_session()
try: try:
pp = (session.query(l2network_models.PortProfile). pp = (session.query(l2network_models.PortProfile).
@ -264,7 +264,7 @@ def remove_portprofile(tenantid, ppid):
def update_portprofile(tenantid, ppid, newppname=None, newvlanid=None, def update_portprofile(tenantid, ppid, newppname=None, newvlanid=None,
newqos=None): newqos=None):
"""Updates port profile""" """Updates port profile"""
LOG.debug("update_portprofile() called") LOG.debug(_("update_portprofile() called"))
session = db.get_session() session = db.get_session()
try: try:
pp = (session.query(l2network_models.PortProfile). pp = (session.query(l2network_models.PortProfile).
@ -285,7 +285,7 @@ def update_portprofile(tenantid, ppid, newppname=None, newvlanid=None,
def get_all_pp_bindings(): def get_all_pp_bindings():
"""Lists all the port profiles""" """Lists all the port profiles"""
LOG.debug("get_all_pp_bindings() called") LOG.debug(_("get_all_pp_bindings() called"))
session = db.get_session() session = db.get_session()
try: try:
bindings = session.query(l2network_models.PortProfileBinding).all() bindings = session.query(l2network_models.PortProfileBinding).all()
@ -296,7 +296,7 @@ def get_all_pp_bindings():
def get_pp_binding(tenantid, ppid): def get_pp_binding(tenantid, ppid):
"""Lists a port profile binding""" """Lists a port profile binding"""
LOG.debug("get_pp_binding() called") LOG.debug(_("get_pp_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(l2network_models.PortProfileBinding). binding = (session.query(l2network_models.PortProfileBinding).
@ -308,7 +308,7 @@ def get_pp_binding(tenantid, ppid):
def add_pp_binding(tenantid, portid, ppid, default): def add_pp_binding(tenantid, portid, ppid, default):
"""Adds a port profile binding""" """Adds a port profile binding"""
LOG.debug("add_pp_binding() called") LOG.debug(_("add_pp_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(l2network_models.PortProfileBinding). binding = (session.query(l2network_models.PortProfileBinding).
@ -325,7 +325,7 @@ def add_pp_binding(tenantid, portid, ppid, default):
def remove_pp_binding(tenantid, portid, ppid): def remove_pp_binding(tenantid, portid, ppid):
"""Removes a port profile binding""" """Removes a port profile binding"""
LOG.debug("remove_pp_binding() called") LOG.debug(_("remove_pp_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(l2network_models.PortProfileBinding). binding = (session.query(l2network_models.PortProfileBinding).
@ -341,7 +341,7 @@ def remove_pp_binding(tenantid, portid, ppid):
def update_pp_binding(tenantid, ppid, newtenantid=None, def update_pp_binding(tenantid, ppid, newtenantid=None,
newportid=None, newdefault=None): newportid=None, newdefault=None):
"""Updates port profile binding""" """Updates port profile binding"""
LOG.debug("update_pp_binding() called") LOG.debug(_("update_pp_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(l2network_models.PortProfileBinding). binding = (session.query(l2network_models.PortProfileBinding).
@ -362,7 +362,7 @@ def update_pp_binding(tenantid, ppid, newtenantid=None,
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()
try: try:
qoss = (session.query(l2network_models.QoS). qoss = (session.query(l2network_models.QoS).
@ -374,7 +374,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:
qos = (session.query(l2network_models.QoS). qos = (session.query(l2network_models.QoS).
@ -388,7 +388,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(l2network_models.QoS). qos = (session.query(l2network_models.QoS).

View File

@ -38,7 +38,7 @@ def initialize():
def create_vlanids(): def create_vlanids():
"""Prepopulates the vlan_bindings table""" """Prepopulates the vlan_bindings table"""
LOG.debug("create_vlanids() called") LOG.debug(_("create_vlanids() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanid = session.query(network_models_v2.VlanID).one() vlanid = session.query(network_models_v2.VlanID).one()
@ -57,7 +57,7 @@ def create_vlanids():
def get_all_vlanids(): def get_all_vlanids():
"""Gets all the vlanids""" """Gets all the vlanids"""
LOG.debug("get_all_vlanids() called") LOG.debug(_("get_all_vlanids() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanids = session.query(network_models_v2.VlanID).all() vlanids = session.query(network_models_v2.VlanID).all()
@ -68,7 +68,7 @@ def get_all_vlanids():
def is_vlanid_used(vlan_id): def is_vlanid_used(vlan_id):
"""Checks if a vlanid is in use""" """Checks if a vlanid is in use"""
LOG.debug("is_vlanid_used() called") LOG.debug(_("is_vlanid_used() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanid = (session.query(network_models_v2.VlanID). vlanid = (session.query(network_models_v2.VlanID).
@ -80,7 +80,7 @@ def is_vlanid_used(vlan_id):
def release_vlanid(vlan_id): def release_vlanid(vlan_id):
"""Sets the vlanid state to be unused""" """Sets the vlanid state to be unused"""
LOG.debug("release_vlanid() called") LOG.debug(_("release_vlanid() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanid = (session.query(network_models_v2.VlanID). vlanid = (session.query(network_models_v2.VlanID).
@ -96,7 +96,7 @@ def release_vlanid(vlan_id):
def delete_vlanid(vlan_id): def delete_vlanid(vlan_id):
"""Deletes a vlanid entry from db""" """Deletes a vlanid entry from db"""
LOG.debug("delete_vlanid() called") LOG.debug(_("delete_vlanid() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanid = (session.query(network_models_v2.VlanID). vlanid = (session.query(network_models_v2.VlanID).
@ -110,7 +110,7 @@ def delete_vlanid(vlan_id):
def reserve_vlanid(): def reserve_vlanid():
"""Reserves the first unused vlanid""" """Reserves the first unused vlanid"""
LOG.debug("reserve_vlanid() called") LOG.debug(_("reserve_vlanid() called"))
session = db.get_session() session = db.get_session()
try: try:
rvlan = (session.query(network_models_v2.VlanID). rvlan = (session.query(network_models_v2.VlanID).
@ -129,7 +129,7 @@ def reserve_vlanid():
def get_all_vlanids_used(): def get_all_vlanids_used():
"""Gets all the vlanids used""" """Gets all the vlanids used"""
LOG.debug("get_all_vlanids() called") LOG.debug(_("get_all_vlanids() called"))
session = db.get_session() session = db.get_session()
try: try:
vlanids = (session.query(network_models_v2.VlanID). vlanids = (session.query(network_models_v2.VlanID).
@ -141,7 +141,7 @@ def get_all_vlanids_used():
def get_all_vlan_bindings(): def get_all_vlan_bindings():
"""Lists all the vlan to network associations""" """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() session = db.get_session()
try: try:
bindings = session.query(network_models_v2.Vlan_Binding).all() bindings = session.query(network_models_v2.Vlan_Binding).all()
@ -152,7 +152,7 @@ def get_all_vlan_bindings():
def get_vlan_binding(netid): def get_vlan_binding(netid):
"""Lists the vlan given a network_id""" """Lists the vlan given a network_id"""
LOG.debug("get_vlan_binding() called") LOG.debug(_("get_vlan_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(network_models_v2.Vlan_Binding). binding = (session.query(network_models_v2.Vlan_Binding).
@ -164,7 +164,7 @@ def get_vlan_binding(netid):
def add_vlan_binding(vlanid, vlanname, netid): def add_vlan_binding(vlanid, vlanname, netid):
"""Adds a vlan to network association""" """Adds a vlan to network association"""
LOG.debug("add_vlan_binding() called") LOG.debug(_("add_vlan_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(network_models_v2.Vlan_Binding). binding = (session.query(network_models_v2.Vlan_Binding).
@ -180,7 +180,7 @@ def add_vlan_binding(vlanid, vlanname, netid):
def remove_vlan_binding(netid): def remove_vlan_binding(netid):
"""Removes a vlan to network association""" """Removes a vlan to network association"""
LOG.debug("remove_vlan_binding() called") LOG.debug(_("remove_vlan_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(network_models_v2.Vlan_Binding). binding = (session.query(network_models_v2.Vlan_Binding).
@ -194,7 +194,7 @@ def remove_vlan_binding(netid):
def update_vlan_binding(netid, newvlanid=None, newvlanname=None): def update_vlan_binding(netid, newvlanid=None, newvlanname=None):
"""Updates a vlan to network association""" """Updates a vlan to network association"""
LOG.debug("update_vlan_binding() called") LOG.debug(_("update_vlan_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(network_models_v2.Vlan_Binding). binding = (session.query(network_models_v2.Vlan_Binding).
@ -212,7 +212,7 @@ def update_vlan_binding(netid, newvlanid=None, newvlanname=None):
def get_all_portprofiles(): def get_all_portprofiles():
"""Lists all the port profiles""" """Lists all the port profiles"""
LOG.debug("get_all_portprofiles() called") LOG.debug(_("get_all_portprofiles() called"))
session = db.get_session() session = db.get_session()
try: try:
pps = session.query(network_models_v2.PortProfile).all() pps = session.query(network_models_v2.PortProfile).all()
@ -223,7 +223,7 @@ def get_all_portprofiles():
def get_portprofile(tenantid, ppid): def get_portprofile(tenantid, ppid):
"""Lists a port profile""" """Lists a port profile"""
LOG.debug("get_portprofile() called") LOG.debug(_("get_portprofile() called"))
session = db.get_session() session = db.get_session()
try: try:
pp = (session.query(network_models_v2.PortProfile). pp = (session.query(network_models_v2.PortProfile).
@ -236,7 +236,7 @@ def get_portprofile(tenantid, ppid):
def add_portprofile(tenantid, ppname, vlanid, qos): def add_portprofile(tenantid, ppname, vlanid, qos):
"""Adds a port profile""" """Adds a port profile"""
LOG.debug("add_portprofile() called") LOG.debug(_("add_portprofile() called"))
session = db.get_session() session = db.get_session()
try: try:
pp = (session.query(network_models_v2.PortProfile). pp = (session.query(network_models_v2.PortProfile).
@ -267,7 +267,7 @@ def remove_portprofile(tenantid, ppid):
def update_portprofile(tenantid, ppid, newppname=None, newvlanid=None, def update_portprofile(tenantid, ppid, newppname=None, newvlanid=None,
newqos=None): newqos=None):
"""Updates port profile""" """Updates port profile"""
LOG.debug("update_portprofile() called") LOG.debug(_("update_portprofile() called"))
session = db.get_session() session = db.get_session()
try: try:
pp = (session.query(network_models_v2.PortProfile). pp = (session.query(network_models_v2.PortProfile).
@ -288,7 +288,7 @@ def update_portprofile(tenantid, ppid, newppname=None, newvlanid=None,
def get_all_pp_bindings(): def get_all_pp_bindings():
"""Lists all the port profiles""" """Lists all the port profiles"""
LOG.debug("get_all_pp_bindings() called") LOG.debug(_("get_all_pp_bindings() called"))
session = db.get_session() session = db.get_session()
try: try:
bindings = session.query(network_models_v2.PortProfileBinding).all() bindings = session.query(network_models_v2.PortProfileBinding).all()
@ -299,7 +299,7 @@ def get_all_pp_bindings():
def get_pp_binding(tenantid, ppid): def get_pp_binding(tenantid, ppid):
"""Lists a port profile binding""" """Lists a port profile binding"""
LOG.debug("get_pp_binding() called") LOG.debug(_("get_pp_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(network_models_v2.PortProfileBinding). binding = (session.query(network_models_v2.PortProfileBinding).
@ -311,7 +311,7 @@ def get_pp_binding(tenantid, ppid):
def add_pp_binding(tenantid, portid, ppid, default): def add_pp_binding(tenantid, portid, ppid, default):
"""Adds a port profile binding""" """Adds a port profile binding"""
LOG.debug("add_pp_binding() called") LOG.debug(_("add_pp_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(network_models_v2.PortProfileBinding). binding = (session.query(network_models_v2.PortProfileBinding).
@ -328,7 +328,7 @@ def add_pp_binding(tenantid, portid, ppid, default):
def remove_pp_binding(tenantid, portid, ppid): def remove_pp_binding(tenantid, portid, ppid):
"""Removes a port profile binding""" """Removes a port profile binding"""
LOG.debug("remove_pp_binding() called") LOG.debug(_("remove_pp_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(network_models_v2.PortProfileBinding). binding = (session.query(network_models_v2.PortProfileBinding).
@ -344,7 +344,7 @@ def remove_pp_binding(tenantid, portid, ppid):
def update_pp_binding(tenantid, ppid, newtenantid=None, def update_pp_binding(tenantid, ppid, newtenantid=None,
newportid=None, newdefault=None): newportid=None, newdefault=None):
"""Updates port profile binding""" """Updates port profile binding"""
LOG.debug("update_pp_binding() called") LOG.debug(_("update_pp_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(network_models_v2.PortProfileBinding). binding = (session.query(network_models_v2.PortProfileBinding).
@ -365,7 +365,7 @@ def update_pp_binding(tenantid, ppid, newtenantid=None,
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()
try: try:
qoss = (session.query(network_models_v2.QoS). qoss = (session.query(network_models_v2.QoS).
@ -377,7 +377,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:
qos = (session.query(network_models_v2.QoS). qos = (session.query(network_models_v2.QoS).
@ -391,7 +391,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).

View File

@ -31,7 +31,7 @@ LOG = logging.getLogger(__name__)
def get_all_nexusport_bindings(): def get_all_nexusport_bindings():
"""Lists all the 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() session = db.get_session()
try: try:
bindings = session.query(nexus_models_v2.NexusPortBinding).all() bindings = session.query(nexus_models_v2.NexusPortBinding).all()
@ -42,7 +42,7 @@ def get_all_nexusport_bindings():
def get_nexusport_binding(port_id, vlan_id, switch_ip, instance_id): def get_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
"""Lists a nexusport binding""" """Lists a nexusport binding"""
LOG.debug("get_nexusport_binding() called") LOG.debug(_("get_nexusport_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(nexus_models_v2.NexusPortBinding). binding = (session.query(nexus_models_v2.NexusPortBinding).
@ -56,7 +56,7 @@ def get_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
def get_nexusvlan_binding(vlan_id, switch_ip): def get_nexusvlan_binding(vlan_id, switch_ip):
"""Lists a vlan and switch binding""" """Lists a vlan and switch binding"""
LOG.debug("get_nexusvlan_binding() called") LOG.debug(_("get_nexusvlan_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(nexus_models_v2.NexusPortBinding). binding = (session.query(nexus_models_v2.NexusPortBinding).
@ -69,7 +69,7 @@ def get_nexusvlan_binding(vlan_id, switch_ip):
def add_nexusport_binding(port_id, vlan_id, switch_ip, instance_id): def add_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
"""Adds a nexusport binding""" """Adds a nexusport binding"""
LOG.debug("add_nexusport_binding() called") LOG.debug(_("add_nexusport_binding() called"))
session = db.get_session() session = db.get_session()
binding = nexus_models_v2.NexusPortBinding( binding = nexus_models_v2.NexusPortBinding(
port_id, vlan_id, switch_ip, instance_id) port_id, vlan_id, switch_ip, instance_id)
@ -80,7 +80,7 @@ def add_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
def remove_nexusport_binding(port_id, vlan_id, switch_ip, instance_id): def remove_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
"""Removes a nexusport binding""" """Removes a nexusport binding"""
LOG.debug("remove_nexusport_binding() called") LOG.debug(_("remove_nexusport_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(nexus_models_v2.NexusPortBinding). binding = (session.query(nexus_models_v2.NexusPortBinding).
@ -98,7 +98,7 @@ def remove_nexusport_binding(port_id, vlan_id, switch_ip, instance_id):
def update_nexusport_binding(port_id, new_vlan_id): def update_nexusport_binding(port_id, new_vlan_id):
"""Updates nexusport binding""" """Updates nexusport binding"""
LOG.debug("update_nexusport_binding called") LOG.debug(_("update_nexusport_binding called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(nexus_models_v2.NexusPortBinding). binding = (session.query(nexus_models_v2.NexusPortBinding).
@ -114,7 +114,7 @@ def update_nexusport_binding(port_id, new_vlan_id):
def get_nexusvm_binding(vlan_id, instance_id): def get_nexusvm_binding(vlan_id, instance_id):
"""Lists nexusvm bindings""" """Lists nexusvm bindings"""
LOG.debug("get_nexusvm_binding() called") LOG.debug(_("get_nexusvm_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(nexus_models_v2.NexusPortBinding). binding = (session.query(nexus_models_v2.NexusPortBinding).
@ -127,7 +127,7 @@ def get_nexusvm_binding(vlan_id, instance_id):
def get_port_vlan_switch_binding(port_id, vlan_id, switch_ip): def get_port_vlan_switch_binding(port_id, vlan_id, switch_ip):
"""Lists nexusvm bindings""" """Lists nexusvm bindings"""
LOG.debug("get_port_vlan_switch_binding() called") LOG.debug(_("get_port_vlan_switch_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(nexus_models_v2.NexusPortBinding). binding = (session.query(nexus_models_v2.NexusPortBinding).

View File

@ -27,7 +27,7 @@ from quantum.plugins.cisco.db import services_models
def get_all_services_bindings(): def get_all_services_bindings():
"""Lists all the 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() session = db.get_session()
try: try:
bindings = session.query(services_models.ServicesBinding).all() bindings = session.query(services_models.ServicesBinding).all()
@ -38,7 +38,7 @@ def get_all_services_bindings():
def get_service_bindings(service_id): def get_service_bindings(service_id):
"""Lists services bindings for a 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() session = db.get_session()
try: try:
bindings = (session.query(services_models.ServicesBinding). bindings = (session.query(services_models.ServicesBinding).
@ -50,7 +50,7 @@ def get_service_bindings(service_id):
def add_services_binding(service_id, mngnet_id, nbnet_id, sbnet_id): def add_services_binding(service_id, mngnet_id, nbnet_id, sbnet_id):
"""Adds a services binding""" """Adds a services binding"""
LOG.debug("add_services_binding() called") LOG.debug(_("add_services_binding() called"))
session = db.get_session() session = db.get_session()
binding = services_models.ServicesBinding(service_id, mngnet_id, binding = services_models.ServicesBinding(service_id, mngnet_id,
nbnet_id, sbnet_id) nbnet_id, sbnet_id)
@ -61,7 +61,7 @@ def add_services_binding(service_id, mngnet_id, nbnet_id, sbnet_id):
def remove_services_binding(service_id): def remove_services_binding(service_id):
"""Removes a services binding""" """Removes a services binding"""
LOG.debug("remove_services_binding() called") LOG.debug(_("remove_services_binding() called"))
session = db.get_session() session = db.get_session()
try: try:
binding = (session.query(services_models.ServicesBinding). binding = (session.query(services_models.ServicesBinding).

View File

@ -27,7 +27,7 @@ from quantum.plugins.cisco.db import ucs_models_v2 as ucs_models
def get_all_portbindings(): def get_all_portbindings():
"""Lists all the port bindings""" """Lists all the port bindings"""
LOG.debug("db get_all_portbindings() called") LOG.debug(_("DB get_all_portbindings() called"))
session = db.get_session() session = db.get_session()
try: try:
port_bindings = session.query(ucs_models.PortBinding).all() port_bindings = session.query(ucs_models.PortBinding).all()
@ -38,7 +38,7 @@ def get_all_portbindings():
def get_portbinding(port_id): def get_portbinding(port_id):
"""Lists a port binding""" """Lists a port binding"""
LOG.debug("get_portbinding() called") LOG.debug(_("get_portbinding() called"))
session = db.get_session() session = db.get_session()
try: try:
port_binding = (session.query(ucs_models.PortBinding). port_binding = (session.query(ucs_models.PortBinding).
@ -51,7 +51,7 @@ def get_portbinding(port_id):
def add_portbinding(port_id, blade_intf_dn, portprofile_name, def add_portbinding(port_id, blade_intf_dn, portprofile_name,
vlan_name, vlan_id, qos): vlan_name, vlan_id, qos):
"""Adds a port binding""" """Adds a port binding"""
LOG.debug("add_portbinding() called") LOG.debug(_("add_portbinding() called"))
session = db.get_session() session = db.get_session()
try: try:
port_binding = (session.query(ucs_models.PortBinding). port_binding = (session.query(ucs_models.PortBinding).
@ -68,7 +68,7 @@ def add_portbinding(port_id, blade_intf_dn, portprofile_name,
def remove_portbinding(port_id): def remove_portbinding(port_id):
"""Removes a port binding""" """Removes a port binding"""
LOG.debug("db remove_portbinding() called") LOG.debug(_("DB remove_portbinding() called"))
session = db.get_session() session = db.get_session()
try: try:
port_binding = (session.query(ucs_models.PortBinding). port_binding = (session.query(ucs_models.PortBinding).
@ -85,7 +85,7 @@ def update_portbinding(port_id, blade_intf_dn=None, portprofile_name=None,
tenant_id=None, instance_id=None, tenant_id=None, instance_id=None,
vif_id=None): vif_id=None):
"""Updates port binding""" """Updates port binding"""
LOG.debug("db update_portbinding() called") LOG.debug(_("DB update_portbinding() called"))
session = db.get_session() session = db.get_session()
try: try:
port_binding = (session.query(ucs_models.PortBinding). port_binding = (session.query(ucs_models.PortBinding).
@ -115,7 +115,7 @@ def update_portbinding(port_id, blade_intf_dn=None, portprofile_name=None,
def update_portbinding_instance_id(port_id, instance_id): def update_portbinding_instance_id(port_id, instance_id):
"""Updates port binding for the 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() session = db.get_session()
try: try:
port_binding = (session.query(ucs_models.PortBinding). port_binding = (session.query(ucs_models.PortBinding).
@ -130,7 +130,7 @@ def update_portbinding_instance_id(port_id, instance_id):
def update_portbinding_vif_id(port_id, vif_id): def update_portbinding_vif_id(port_id, vif_id):
"""Updates port binding for the 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() session = db.get_session()
try: try:
port_binding = (session.query(ucs_models.PortBinding). port_binding = (session.query(ucs_models.PortBinding).
@ -145,7 +145,7 @@ def update_portbinding_vif_id(port_id, vif_id):
def get_portbinding_dn(blade_intf_dn): def get_portbinding_dn(blade_intf_dn):
"""Lists a port binding""" """Lists a port binding"""
LOG.debug("get_portbinding_dn() called") LOG.debug(_("get_portbinding_dn() called"))
session = db.get_session() session = db.get_session()
try: try:
port_binding = (session.query(ucs_models.PortBinding). port_binding = (session.query(ucs_models.PortBinding).

View File

@ -53,15 +53,17 @@ class NetworkMultiBladeV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
for key in conf.PLUGINS[const.PLUGINS].keys(): for key in conf.PLUGINS[const.PLUGINS].keys():
plugin_obj = conf.PLUGINS[const.PLUGINS][key] plugin_obj = conf.PLUGINS[const.PLUGINS][key]
self._plugins[key] = importutils.import_object(plugin_obj) 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]) conf.PLUGINS[const.PLUGINS][key])
if key in conf.PLUGINS[const.INVENTORY].keys(): if key in conf.PLUGINS[const.INVENTORY].keys():
inventory_obj = conf.PLUGINS[const.INVENTORY][key] inventory_obj = conf.PLUGINS[const.INVENTORY][key]
self._inventory[key] = importutils.import_object(inventory_obj) 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]) 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): def _func_name(self, offset=0):
"""Get the name of the calling function""" """Get the name of the calling function"""
@ -73,9 +75,9 @@ class NetworkMultiBladeV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
inventory and plugin implementation) for completing this operation. inventory and plugin implementation) for completing this operation.
""" """
if not plugin_key in self._plugins.keys(): if not plugin_key in self._plugins.keys():
LOG.info("No %s Plugin loaded" % plugin_key) LOG.info(_("No %s Plugin loaded"), plugin_key)
LOG.info("%s: %s with args %s ignored" % LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
(plugin_key, function_name, args)) "ignored"), locals())
return return
device_params = self._invoke_inventory(plugin_key, function_name, device_params = self._invoke_inventory(plugin_key, function_name,
args) args)
@ -98,9 +100,9 @@ class NetworkMultiBladeV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
inventory for completing this operation. inventory for completing this operation.
""" """
if not plugin_key in self._inventory.keys(): if not plugin_key in self._inventory.keys():
LOG.info("No %s inventory loaded" % plugin_key) LOG.info(_("No %s inventory loaded"), plugin_key)
LOG.info("%s: %s with args %s ignored" % LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
(plugin_key, function_name, args)) "ignored"), locals())
return {const.DEVICE_IP: []} return {const.DEVICE_IP: []}
else: else:
return getattr(self._inventory[plugin_key], function_name)(args) return getattr(self._inventory[plugin_key], function_name)(args)

View File

@ -66,12 +66,12 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
for key in conf.PLUGINS[const.PLUGINS].keys(): for key in conf.PLUGINS[const.PLUGINS].keys():
plugin_obj = conf.PLUGINS[const.PLUGINS][key] plugin_obj = conf.PLUGINS[const.PLUGINS][key]
self._plugins[key] = importutils.import_object(plugin_obj) 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]) conf.PLUGINS[const.PLUGINS][key])
if key in conf.PLUGINS[const.INVENTORY].keys(): if key in conf.PLUGINS[const.INVENTORY].keys():
inventory_obj = conf.PLUGINS[const.INVENTORY][key] inventory_obj = conf.PLUGINS[const.INVENTORY][key]
self._inventory[key] = importutils.import_object(inventory_obj) 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]) conf.PLUGINS[const.INVENTORY][key])
if hasattr(self._plugins[const.VSWITCH_PLUGIN], if hasattr(self._plugins[const.VSWITCH_PLUGIN],
@ -80,7 +80,9 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
self._plugins[const.VSWITCH_PLUGIN]. self._plugins[const.VSWITCH_PLUGIN].
supported_extension_aliases) 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): def __getattribute__(self, name):
""" """
@ -113,9 +115,9 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
inventory and plugin implementation) for completing this operation. inventory and plugin implementation) for completing this operation.
""" """
if not plugin_key in self._plugins.keys(): if not plugin_key in self._plugins.keys():
LOG.info("No %s Plugin loaded" % plugin_key) LOG.info(_("No %s Plugin loaded"), plugin_key)
LOG.info("%s: %s with args %s ignored" % LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
(plugin_key, function_name, args)) "ignored"), locals())
return return
device_params = self._invoke_inventory(plugin_key, function_name, device_params = self._invoke_inventory(plugin_key, function_name,
args) args)
@ -138,9 +140,9 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
inventory for completing this operation. inventory for completing this operation.
""" """
if not plugin_key in self._inventory.keys(): if not plugin_key in self._inventory.keys():
LOG.info("No %s inventory loaded" % plugin_key) LOG.info(_("No %s inventory loaded"), plugin_key)
LOG.info("%s: %s with args %s ignored" % LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
(plugin_key, function_name, args)) "ignored"), locals())
return {const.DEVICE_IP: []} return {const.DEVICE_IP: []}
else: else:
return getattr(self._inventory[plugin_key], function_name)(args) return getattr(self._inventory[plugin_key], function_name)(args)
@ -208,7 +210,7 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
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\n") LOG.debug(_("create_network() called"))
try: try:
args = [context, network] args = [context, network]
ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN, ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
@ -232,12 +234,12 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
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_bulk() called\n") LOG.debug(_("create_network_bulk() called"))
try: try:
args = [context, networks] args = [context, networks]
ovs_output = self._plugins[ ovs_output = self._plugins[
const.VSWITCH_PLUGIN].create_network_bulk(context, networks) 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() vlanids = self._get_all_segmentation_ids()
ovs_networks = ovs_output ovs_networks = ovs_output
return ovs_output return ovs_output
@ -250,7 +252,7 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
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\n") LOG.debug(_("update_network() called"))
args = [context, id, network] args = [context, id, network]
ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN, ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
self._func_name(), self._func_name(),
@ -304,7 +306,7 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
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\n") LOG.debug(_("create_port() called"))
try: try:
args = [context, port] args = [context, port]
ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN, ovs_output = self._invoke_plugin_per_device(const.VSWITCH_PLUGIN,
@ -353,7 +355,7 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
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\n") LOG.debug(_("delete_port() called"))
try: try:
args = [context, id] args = [context, id]
port = self.get_port(context, id) port = self.get_port(context, id)

View File

@ -58,7 +58,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
self._model = importutils.import_object(conf.MODEL_CLASS) self._model = importutils.import_object(conf.MODEL_CLASS)
if hasattr(self._model, "MANAGE_STATE") and self._model.MANAGE_STATE: if hasattr(self._model, "MANAGE_STATE") and self._model.MANAGE_STATE:
self._master = False 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" native_bulk_attr_name = ("_%s__native_bulk_support"
% self._model.__class__.__name__) % self._model.__class__.__name__)
self.__native_bulk_support = getattr(self._model, self.__native_bulk_support = getattr(self._model,
@ -69,7 +69,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
self._model.supported_extension_aliases) self._model.supported_extension_aliases)
super(PluginV2, self).__init__() super(PluginV2, self).__init__()
LOG.debug("Plugin initialization complete") LOG.debug(_("Plugin initialization complete"))
def __getattribute__(self, name): def __getattribute__(self, name):
""" """
@ -105,7 +105,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
Creates a new Virtual Network, and assigns it Creates a new Virtual Network, and assigns it
a symbolic name. a symbolic name.
""" """
LOG.debug("create_network() called\n") LOG.debug(_("create_network() called"))
new_network = super(PluginV2, self).create_network(context, new_network = super(PluginV2, self).create_network(context,
network) network)
try: try:
@ -122,7 +122,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
Updates the symbolic name belonging to a particular Updates the symbolic name belonging to a particular
Virtual Network. Virtual Network.
""" """
LOG.debug("update_network() called\n") LOG.debug(_("update_network() called"))
upd_net_dict = super(PluginV2, self).update_network(context, id, upd_net_dict = super(PluginV2, self).update_network(context, id,
network) network)
self._invoke_device_plugins(self._func_name(), [context, id, self._invoke_device_plugins(self._func_name(), [context, id,
@ -134,7 +134,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
Deletes the network with the specified network identifier Deletes the network with the specified network identifier
belonging to the specified tenant. 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 #We first need to check if there are any ports on this network
with context.session.begin(): with context.session.begin():
network = self._get_network(context, id) network = self._get_network(context, id)
@ -162,21 +162,21 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
""" """
Gets a particular network Gets a particular network
""" """
LOG.debug("get_network() called\n") LOG.debug(_("get_network() called"))
return super(PluginV2, self).get_network(context, id, fields) return super(PluginV2, self).get_network(context, id, fields)
def get_networks(self, context, filters=None, fields=None): def get_networks(self, context, filters=None, fields=None):
""" """
Gets all networks Gets all networks
""" """
LOG.debug("get_networks() called\n") LOG.debug(_("get_networks() called"))
return super(PluginV2, self).get_networks(context, filters, fields) return super(PluginV2, self).get_networks(context, filters, fields)
def create_port(self, context, port): def create_port(self, context, port):
""" """
Creates a port on the specified Virtual Network. 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) new_port = super(PluginV2, self).create_port(context, port)
try: try:
self._invoke_device_plugins(self._func_name(), [context, new_port]) self._invoke_device_plugins(self._func_name(), [context, new_port])
@ -189,7 +189,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
""" """
Deletes a port Deletes a port
""" """
LOG.debug("delete_port() called\n") LOG.debug(_("delete_port() called"))
port = self._get_port(context, id) port = self._get_port(context, id)
""" """
TODO (Sumit): Disabling this check for now, check later TODO (Sumit): Disabling this check for now, check later
@ -212,7 +212,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
""" """
Updates the state of a port and returns the updated port Updates the state of a port and returns the updated port
""" """
LOG.debug("update_port() called\n") LOG.debug(_("update_port() called"))
try: try:
self._invoke_device_plugins(self._func_name(), [context, id, self._invoke_device_plugins(self._func_name(), [context, id,
port]) port])
@ -225,7 +225,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
Create a subnet, which represents a range of IP addresses Create a subnet, which represents a range of IP addresses
that can be allocated to devices. 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) new_subnet = super(PluginV2, self).create_subnet(context, subnet)
try: try:
self._invoke_device_plugins(self._func_name(), [context, self._invoke_device_plugins(self._func_name(), [context,
@ -239,7 +239,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
""" """
Updates the state of a subnet and returns the updated subnet Updates the state of a subnet and returns the updated subnet
""" """
LOG.debug("update_subnet() called\n") LOG.debug(_("update_subnet() called"))
try: try:
self._invoke_device_plugins(self._func_name(), [context, id, self._invoke_device_plugins(self._func_name(), [context, id,
subnet]) subnet])
@ -251,7 +251,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
""" """
Deletes a subnet Deletes a subnet
""" """
LOG.debug("delete_subnet() called\n") LOG.debug(_("delete_subnet() called"))
with context.session.begin(): with context.session.begin():
subnet = self._get_subnet(context, id) subnet = self._get_subnet(context, id)
# Check if ports are using this subnet # Check if ports are using this subnet
@ -277,7 +277,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
""" """
def get_all_portprofiles(self, tenant_id): def get_all_portprofiles(self, tenant_id):
"""Get all port profiles""" """Get all port profiles"""
LOG.debug("get_all_portprofiles() called\n") LOG.debug(_("get_all_portprofiles() called"))
pplist = cdb.get_all_portprofiles() pplist = cdb.get_all_portprofiles()
new_pplist = [] new_pplist = []
for portprofile in pplist: for portprofile in pplist:
@ -291,7 +291,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def get_portprofile_details(self, tenant_id, profile_id): def get_portprofile_details(self, tenant_id, profile_id):
"""Get port profile details""" """Get port profile details"""
LOG.debug("get_portprofile_details() called\n") LOG.debug(_("get_portprofile_details() called"))
try: try:
portprofile = cdb.get_portprofile(tenant_id, profile_id) portprofile = cdb.get_portprofile(tenant_id, profile_id)
except Exception: except Exception:
@ -306,7 +306,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def create_portprofile(self, tenant_id, profile_name, qos): def create_portprofile(self, tenant_id, profile_name, qos):
"""Create port profile""" """Create port profile"""
LOG.debug("create_portprofile() called\n") LOG.debug(_("create_portprofile() called"))
portprofile = cdb.add_portprofile(tenant_id, profile_name, portprofile = cdb.add_portprofile(tenant_id, profile_name,
const.NO_VLAN_ID, qos) const.NO_VLAN_ID, qos)
new_pp = cutil.make_portprofile_dict(tenant_id, new_pp = cutil.make_portprofile_dict(tenant_id,
@ -317,7 +317,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def delete_portprofile(self, tenant_id, profile_id): def delete_portprofile(self, tenant_id, profile_id):
"""Delete portprofile""" """Delete portprofile"""
LOG.debug("delete_portprofile() called\n") LOG.debug(_("delete_portprofile() called"))
try: try:
portprofile = cdb.get_portprofile(tenant_id, profile_id) portprofile = cdb.get_portprofile(tenant_id, profile_id)
except Exception: except Exception:
@ -333,7 +333,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def rename_portprofile(self, tenant_id, profile_id, new_name): def rename_portprofile(self, tenant_id, profile_id, new_name):
"""Rename port profile""" """Rename port profile"""
LOG.debug("rename_portprofile() called\n") LOG.debug(_("rename_portprofile() called"))
try: try:
portprofile = cdb.get_portprofile(tenant_id, profile_id) portprofile = cdb.get_portprofile(tenant_id, profile_id)
except Exception: except Exception:
@ -349,7 +349,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def associate_portprofile(self, tenant_id, net_id, def associate_portprofile(self, tenant_id, net_id,
port_id, portprofile_id): port_id, portprofile_id):
"""Associate port profile""" """Associate port profile"""
LOG.debug("associate_portprofile() called\n") LOG.debug(_("associate_portprofile() called"))
try: try:
portprofile = cdb.get_portprofile(tenant_id, portprofile_id) portprofile = cdb.get_portprofile(tenant_id, portprofile_id)
except Exception: except Exception:
@ -361,7 +361,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def disassociate_portprofile(self, tenant_id, net_id, def disassociate_portprofile(self, tenant_id, net_id,
port_id, portprofile_id): port_id, portprofile_id):
"""Disassociate port profile""" """Disassociate port profile"""
LOG.debug("disassociate_portprofile() called\n") LOG.debug(_("disassociate_portprofile() called"))
try: try:
portprofile = cdb.get_portprofile(tenant_id, portprofile_id) portprofile = cdb.get_portprofile(tenant_id, portprofile_id)
except Exception: except Exception:
@ -372,13 +372,13 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
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\n") 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\n") LOG.debug(_("get_qos_details() called"))
try: try:
qos_level = cdb.get_qos(tenant_id, qos_id) qos_level = cdb.get_qos(tenant_id, qos_id)
except Exception: except Exception:
@ -388,13 +388,13 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
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\n") 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\n") LOG.debug(_("delete_qos() called"))
try: try:
qos_level = cdb.get_qos(tenant_id, qos_id) qos_level = cdb.get_qos(tenant_id, qos_id)
except Exception: except Exception:
@ -404,7 +404,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
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\n") LOG.debug(_("rename_qos() called"))
try: try:
qos_level = cdb.get_qos(tenant_id, qos_id) qos_level = cdb.get_qos(tenant_id, qos_id)
except Exception: except Exception:
@ -415,13 +415,13 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def get_all_credentials(self, tenant_id): def get_all_credentials(self, tenant_id):
"""Get all credentials""" """Get all credentials"""
LOG.debug("get_all_credentials() called\n") LOG.debug(_("get_all_credentials() called"))
credential_list = cdb.get_all_credentials(tenant_id) credential_list = cdb.get_all_credentials(tenant_id)
return credential_list return credential_list
def get_credential_details(self, tenant_id, credential_id): def get_credential_details(self, tenant_id, credential_id):
"""Get a particular credential""" """Get a particular credential"""
LOG.debug("get_credential_details() called\n") LOG.debug(_("get_credential_details() called"))
try: try:
credential = cdb.get_credential(tenant_id, credential_id) credential = cdb.get_credential(tenant_id, credential_id)
except Exception: except Exception:
@ -432,14 +432,14 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def create_credential(self, tenant_id, credential_name, user_name, def create_credential(self, tenant_id, credential_name, user_name,
password): password):
"""Create a new credential""" """Create a new credential"""
LOG.debug("create_credential() called\n") LOG.debug(_("create_credential() called"))
credential = cdb.add_credential(tenant_id, credential_name, credential = cdb.add_credential(tenant_id, credential_name,
user_name, password) user_name, password)
return credential return credential
def delete_credential(self, tenant_id, credential_id): def delete_credential(self, tenant_id, credential_id):
"""Delete a credential""" """Delete a credential"""
LOG.debug("delete_credential() called\n") LOG.debug(_("delete_credential() called"))
try: try:
credential = cdb.get_credential(tenant_id, credential_id) credential = cdb.get_credential(tenant_id, credential_id)
except Exception: except Exception:
@ -450,7 +450,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def rename_credential(self, tenant_id, credential_id, new_name): def rename_credential(self, tenant_id, credential_id, new_name):
"""Rename the particular credential resource""" """Rename the particular credential resource"""
LOG.debug("rename_credential() called\n") LOG.debug(_("rename_credential() called"))
try: try:
credential = cdb.get_credential(tenant_id, credential_id) credential = cdb.get_credential(tenant_id, credential_id)
except Exception: except Exception:
@ -461,7 +461,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
def schedule_host(self, tenant_id, instance_id, instance_desc): def schedule_host(self, tenant_id, instance_id, instance_desc):
"""Provides the hostname on which a dynamic vnic is reserved""" """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(), host_list = self._invoke_device_plugins(self._func_name(),
[tenant_id, [tenant_id,
instance_id, instance_id,
@ -472,7 +472,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
""" """
Get the portprofile name and the device name for the dynamic vnic 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, return self._invoke_device_plugins(self._func_name(), [tenant_id,
instance_id, instance_id,
instance_desc]) instance_desc])
@ -481,7 +481,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
""" """
Remove the association of the VIF with the dynamic vnic 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, return self._invoke_device_plugins(self._func_name(), [tenant_id,
instance_id, instance_id,
instance_desc]) instance_desc])
@ -490,7 +490,7 @@ class PluginV2(db_base_plugin_v2.QuantumDbPluginV2):
""" """
Creates multiple ports on the specified Virtual Network. 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_num = len(net_id_list)
ports_id_list = [] ports_id_list = []
ports_dict_list = [] ports_dict_list = []

View File

@ -78,7 +78,7 @@ class CiscoNEXUSDriver():
""" """
confstr = snipp.CMD_PORT_TRUNK % (interface) confstr = snipp.CMD_PORT_TRUNK % (interface)
confstr = self.create_xml_snippet(confstr) confstr = self.create_xml_snippet(confstr)
LOG.debug("NexusDriver: %s" % confstr) LOG.debug(_("NexusDriver: %s"), confstr)
mgr.edit_config(target='running', config=confstr) mgr.edit_config(target='running', config=confstr)
def disable_switch_port(self, mgr, interface): def disable_switch_port(self, mgr, interface):
@ -87,7 +87,7 @@ class CiscoNEXUSDriver():
""" """
confstr = snipp.CMD_NO_SWITCHPORT % (interface) confstr = snipp.CMD_NO_SWITCHPORT % (interface)
confstr = self.create_xml_snippet(confstr) confstr = self.create_xml_snippet(confstr)
LOG.debug("NexusDriver: %s" % confstr) LOG.debug(_("NexusDriver: %s"), confstr)
mgr.edit_config(target='running', config=confstr) mgr.edit_config(target='running', config=confstr)
def enable_vlan_on_trunk_int(self, mgr, interface, vlanid): def enable_vlan_on_trunk_int(self, mgr, interface, vlanid):
@ -97,7 +97,7 @@ class CiscoNEXUSDriver():
""" """
confstr = snipp.CMD_VLAN_INT_SNIPPET % (interface, vlanid) confstr = snipp.CMD_VLAN_INT_SNIPPET % (interface, vlanid)
confstr = self.create_xml_snippet(confstr) confstr = self.create_xml_snippet(confstr)
LOG.debug("NexusDriver: %s" % confstr) LOG.debug(_("NexusDriver: %s"), confstr)
mgr.edit_config(target='running', config=confstr) mgr.edit_config(target='running', config=confstr)
def disable_vlan_on_trunk_int(self, mgr, interface, vlanid): def disable_vlan_on_trunk_int(self, mgr, interface, vlanid):
@ -107,7 +107,7 @@ class CiscoNEXUSDriver():
""" """
confstr = snipp.CMD_NO_VLAN_INT_SNIPPET % (interface, vlanid) confstr = snipp.CMD_NO_VLAN_INT_SNIPPET % (interface, vlanid)
confstr = self.create_xml_snippet(confstr) confstr = self.create_xml_snippet(confstr)
LOG.debug("NexusDriver: %s" % confstr) LOG.debug(_("NexusDriver: %s"), confstr)
mgr.edit_config(target='running', config=confstr) mgr.edit_config(target='running', config=confstr)
def create_vlan(self, vlan_name, vlan_id, nexus_host, nexus_user, def create_vlan(self, vlan_name, vlan_id, nexus_host, nexus_user,
@ -122,7 +122,7 @@ class CiscoNEXUSDriver():
self.enable_vlan(man, vlan_id, vlan_name) self.enable_vlan(man, vlan_id, vlan_name)
if vlan_ids is '': if vlan_ids is '':
vlan_ids = self.build_vlans_cmd() 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: for ports in nexus_ports:
self.enable_vlan_on_trunk_int(man, ports, vlan_ids) self.enable_vlan_on_trunk_int(man, ports, vlan_ids)

View File

@ -48,7 +48,7 @@ class NexusPlugin(L2DevicePluginBase):
Extracts the configuration parameters from the configuration file Extracts the configuration parameters from the configuration file
""" """
self._client = importutils.import_object(conf.NEXUS_DRIVER) 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._nexus_switches = conf.NEXUS_DETAILS
self.credentials = {} self.credentials = {}
@ -68,7 +68,7 @@ class NexusPlugin(L2DevicePluginBase):
<network_uuid, network_name> for <network_uuid, network_name> for
the specified tenant. the specified tenant.
""" """
LOG.debug("NexusPlugin:get_all_networks() called\n") LOG.debug(_("NexusPlugin:get_all_networks() called"))
return self._networks.values() return self._networks.values()
def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id, def create_network(self, tenant_id, net_name, net_id, vlan_name, vlan_id,
@ -78,7 +78,7 @@ class NexusPlugin(L2DevicePluginBase):
and configure the appropriate interfaces and configure the appropriate interfaces
for this VLAN 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 # Grab the switch IP and port for this host
switch_ip = '' switch_ip = ''
port_id = '' port_id = ''
@ -131,13 +131,13 @@ class NexusPlugin(L2DevicePluginBase):
Deletes the VLAN in all switches, and removes the VLAN configuration Deletes the VLAN in all switches, and removes the VLAN configuration
from the relevant interfaces 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): def get_network_details(self, tenant_id, net_id, **kwargs):
""" """
Returns the details of a particular network 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) network = self._get_network(tenant_id, net_id)
return network return network
@ -146,21 +146,21 @@ class NexusPlugin(L2DevicePluginBase):
Updates the properties of a particular Updates the properties of a particular
Virtual Network. 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): def get_all_ports(self, tenant_id, net_id, **kwargs):
""" """
This is probably not applicable to the Nexus plugin. This is probably not applicable to the Nexus plugin.
Delete if not required. 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): def create_port(self, tenant_id, net_id, port_state, port_id, **kwargs):
""" """
This is probably not applicable to the Nexus plugin. This is probably not applicable to the Nexus plugin.
Delete if not required. 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): def delete_port(self, device_id, vlan_id):
""" """
@ -168,7 +168,7 @@ class NexusPlugin(L2DevicePluginBase):
whether the network is still required on whether the network is still required on
the interfaces trunked the interfaces trunked
""" """
LOG.debug("NexusPlugin:delete_port() called\n") LOG.debug(_("NexusPlugin:delete_port() called"))
# Delete DB row for this port # Delete DB row for this port
row = nxos_db.get_nexusvm_binding(vlan_id, device_id) row = nxos_db.get_nexusvm_binding(vlan_id, device_id)
if row: if row:
@ -200,14 +200,14 @@ class NexusPlugin(L2DevicePluginBase):
This is probably not applicable to the Nexus plugin. This is probably not applicable to the Nexus plugin.
Delete if not required. 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): def get_port_details(self, tenant_id, net_id, port_id, **kwargs):
""" """
This is probably not applicable to the Nexus plugin. This is probably not applicable to the Nexus plugin.
Delete if not required. 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, def plug_interface(self, tenant_id, net_id, port_id, remote_interface_id,
**kwargs): **kwargs):
@ -215,14 +215,14 @@ class NexusPlugin(L2DevicePluginBase):
This is probably not applicable to the Nexus plugin. This is probably not applicable to the Nexus plugin.
Delete if not required. 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): def unplug_interface(self, tenant_id, net_id, port_id, **kwargs):
""" """
This is probably not applicable to the Nexus plugin. This is probably not applicable to the Nexus plugin.
Delete if not required. 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, def _get_vlan_id_for_network(self, tenant_id, network_id, context,
base_plugin_ref): base_plugin_ref):

View File

@ -53,7 +53,7 @@ def insert_inpath_service(tenant_id, service_image_id,
management_net_name, northbound_net_name, management_net_name, northbound_net_name,
southbound_net_name, *args): southbound_net_name, *args):
"""Inserting a network service between two networks""" """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() service_logic = servlogcs.ServicesLogistics()
net_list = {} net_list = {}
multiport_net_list = [] multiport_net_list = []
@ -64,17 +64,18 @@ def insert_inpath_service(tenant_id, service_image_id,
data = {servconts.NETWORK: {servconts.NAME: net}} data = {servconts.NETWORK: {servconts.NAME: net}}
net_list[net] = client.create_network(data) net_list[net] = client.create_network(data)
net_list[net][servconts.PORTS] = [] net_list[net][servconts.PORTS] = []
LOG.debug("Network %s Created with ID: %s " % ( LOG.debug(_("Network %(net)s Created with ID: %(id)s "),
net, net_list[net][servconts.NETWORK][servconts.ID])) {'net': net,
print "Completed" 'id': net_list[net][servconts.NETWORK][servconts.ID]})
print ("Creating Ports on Services and Server Networks") print _("Completed")
LOG.debug("Operation 'create_port' executed.") print _("Creating Ports on Services and Server Networks")
LOG.debug(_("Operation 'create_port' executed."))
if not service_logic.verify_plugin(const.UCS_PLUGIN): if not service_logic.verify_plugin(const.UCS_PLUGIN):
for net in networks_name_list: for net in networks_name_list:
net_list[net][servconts.PORTS].append net_list[net][servconts.PORTS].append
(client.create_port (client.create_port
(net_list[net][servconts.NETWORK][servconts.ID])) (net_list[net][servconts.NETWORK][servconts.ID]))
LOG.debug("Operation 'create_port' executed.") LOG.debug(_("Operation 'create_port' executed."))
else: else:
for net in networks_name_list: for net in networks_name_list:
nets = net_list[net][servconts.NETWORK][servconts.ID] nets = net_list[net][servconts.NETWORK][servconts.ID]
@ -84,28 +85,29 @@ def insert_inpath_service(tenant_id, service_image_id,
for net in networks_name_list: for net in networks_name_list:
port_id = data[servconts.PORTS][net_idx][servconts.ID] port_id = data[servconts.PORTS][net_idx][servconts.ID]
net_list[net][servconts.PORTS].append(port_id) net_list[net][servconts.PORTS].append(port_id)
LOG.debug("Port UUID: %s on network: %s" % LOG.debug(_("Port UUID: %(id)s on network: %(net)s"),
(data[servconts.PORTS][net_idx][servconts.ID], net)) {'id': data[servconts.PORTS][net_idx][servconts.ID],
'net': net})
net_idx = net_idx + 1 net_idx = net_idx + 1
print "Completed" print _("Completed")
try: try:
create_vm_args = [] create_vm_args = []
create_vm_args.append(servconts.CREATE_VM_CMD) create_vm_args.append(servconts.CREATE_VM_CMD)
create_vm_args.append(service_image_id) 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, process = utils.subprocess_popen(create_vm_args,
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
result = process.stdout.readlines() result = process.stdout.readlines()
tokens = re.search("i-[a-f0-9]*", str(result[1])) tokens = re.search("i-[a-f0-9]*", str(result[1]))
service_vm_name = tokens.group(0) 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: except Exception as exc:
print exc print exc
service_logic.image_status(service_vm_name) service_logic.image_status(service_vm_name)
print "Completed" print _("Completed")
print "Attaching Ports To VM Service interfaces" print _("Attaching Ports To VM Service interfaces")
try: try:
idx = 0 idx = 0
for net in networks_name_list: for net in networks_name_list:
@ -113,17 +115,17 @@ def insert_inpath_service(tenant_id, service_image_id,
port_id = net_list[net][servconts.PORTS][idx] port_id = net_list[net][servconts.PORTS][idx]
attachment = client.show_port_attachment(network_id, port_id) attachment = client.show_port_attachment(network_id, port_id)
attachment = attachment[servconts.ATTACHMENT][servconts.ID][:36] attachment = attachment[servconts.ATTACHMENT][servconts.ID][:36]
LOG.debug(("Plugging virtual interface: %s of VM %s" LOG.debug(_("Plugging virtual interface: %(attachment)s of VM "
"into port: %s on network: %s") % "%(service_vm_name)s into port: %(port_id)s on "
(attachment, service_vm_name, port_id, net)) "network: %(net)s"), locals())
attach_data = {servconts.ATTACHMENT: {servconts.ID: '%s' % attach_data = {servconts.ATTACHMENT: {servconts.ID: '%s' %
attachment}} attachment}}
client.attach_resource(network_id, port_id, attach_data) client.attach_resource(network_id, port_id, attach_data)
except Exception as exc: except Exception as exc:
print exc print exc
print "Completed" print _("Completed")
try: try:
LOG.debug("Registering Service in DB") LOG.debug(_("Registering Service in DB"))
l2db.initialize() l2db.initialize()
for uuid_net in db.network_id(networks_name_list[0]): for uuid_net in db.network_id(networks_name_list[0]):
mngnet_id = str(uuid_net.uuid) mngnet_id = str(uuid_net.uuid)
@ -142,14 +144,14 @@ def delete_service(tenant_id, service_instance_id, *args):
Removes a service and all the network configuration Removes a service and all the network configuration
""" """
l2db.initialize() l2db.initialize()
print ("Terminating Service VM") print _("Terminating Service VM")
service_logic = servlogcs.ServicesLogistics() service_logic = servlogcs.ServicesLogistics()
vms_list = [] vms_list = []
vms_list.append(servconts.DELETE_VM_CMD) vms_list.append(servconts.DELETE_VM_CMD)
vms_list.append(service_instance_id) vms_list.append(service_instance_id)
if not service_logic.image_exist(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() sys.exit()
result = subprocess.call(vms_list) result = subprocess.call(vms_list)
@ -157,7 +159,7 @@ def delete_service(tenant_id, service_instance_id, *args):
client = Client(HOST, PORT, USE_SSL, format='json', tenant=tenant_id) client = Client(HOST, PORT, USE_SSL, format='json', tenant=tenant_id)
service_nets = sdb.get_service_bindings(service_instance_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) network_name = db.network_get(service_nets.mngnet_id)
port_id_net = db.port_list(service_nets.mngnet_id) port_id_net = db.port_list(service_nets.mngnet_id)
for ports_uuid in port_id_net: for ports_uuid in port_id_net:
@ -174,7 +176,7 @@ def delete_service(tenant_id, service_instance_id, *args):
client.delete_port(service_nets.sbnet_id, ports_uuid.uuid) client.delete_port(service_nets.sbnet_id, ports_uuid.uuid)
client.delete_network(service_nets.sbnet_id) client.delete_network(service_nets.sbnet_id)
service_list = sdb.remove_services_binding(service_instance_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): def disconnect_vm(vm_instance_id, *args):
@ -182,14 +184,14 @@ def disconnect_vm(vm_instance_id, *args):
Deletes VMs and Port connection Deletes VMs and Port connection
""" """
l2db.initialize() l2db.initialize()
print ("Terminating Service VM") print _("Terminating Service VM")
service_logic = servlogcs.ServicesLogistics() service_logic = servlogcs.ServicesLogistics()
vms_list = [] vms_list = []
vms_list.append(servconts.DELETE_VM_CMD) vms_list.append(servconts.DELETE_VM_CMD)
vms_list.append(vm_instance_id) vms_list.append(vm_instance_id)
result = subprocess.call(vms_list) result = subprocess.call(vms_list)
service_logic.image_shutdown_verification(vm_instance_id) 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): def connect_vm(tenant_id, vm_image_id, service_instance_id, *args):
@ -198,40 +200,44 @@ def connect_vm(tenant_id, vm_image_id, service_instance_id, *args):
""" """
l2db.initialize() l2db.initialize()
client = Client(HOST, PORT, USE_SSL, format='json', tenant=tenant_id) 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_logic = servlogcs.ServicesLogistics()
service_nets = sdb.get_service_bindings(service_instance_id) service_nets = sdb.get_service_bindings(service_instance_id)
client.create_port(service_nets.mngnet_id) client.create_port(service_nets.mngnet_id)
client.create_port(service_nets.nbnet_id) client.create_port(service_nets.nbnet_id)
sb_port_id = client.create_port(service_nets.sbnet_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] new_port_id = sb_port_id[servconts.PORT][servconts.ID]
try: try:
create_vm_args = [] create_vm_args = []
create_vm_args.append(servconts.CREATE_VM_CMD) create_vm_args.append(servconts.CREATE_VM_CMD)
create_vm_args.append(vm_image_id) 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, process = utils.subprocess_popen(create_vm_args,
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
result = process.stdout.readlines() result = process.stdout.readlines()
tokens = re.search("i-[a-f0-9]*", str(result[1])) tokens = re.search("i-[a-f0-9]*", str(result[1]))
vm_name = tokens.group(0) vm_name = tokens.group(0)
print ("Image: %s instantiated successfully" % (vm_name)) print _("Image: %s instantiated successfully") % (vm_name)
except Exception as exc: except Exception as exc:
print exc print exc
service_logic.image_status(vm_name) service_logic.image_status(vm_name)
print "Completed" print _("Completed")
print "Attaching Ports To VM Service interfaces" print _("Attaching Ports To VM Service interfaces")
south_net = service_nets.sbnet_id south_net = service_nets.sbnet_id
attachment = client.show_port_attachment(south_net, new_port_id) attachment = client.show_port_attachment(south_net, new_port_id)
attachment = attachment[servconts.ATTACHMENT][servconts.ID][:36] attachment = attachment[servconts.ATTACHMENT][servconts.ID][:36]
LOG.debug(("Plugging virtual interface: %s of VM %s " LOG.debug(_("Plugging virtual interface: %(attachment)s of VM "
"into port: %s on network: %s") % "%(vm_name)s into port: %(new_port_id)s on network: "
(attachment, vm_name, new_port_id, service_nets.sbnet_id)) "%(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}} attach_data = {servconts.ATTACHMENT: {servconts.ID: '%s' % attachment}}
client.attach_resource(service_nets.sbnet_id, new_port_id, attach_data) 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): def create_multiport(tenant_id, networks_list, *args):
@ -256,16 +262,24 @@ def build_args(cmd, cmdargs, arglist):
args.append(arglist[0]) args.append(arglist[0])
del arglist[0] del arglist[0]
except: except:
LOG.debug("Not enough arguments for \"%s\" (expected: %d, got: %d)" % LOG.debug(_("Not enough arguments for '%(cmd)s' "
(cmd, len(cmdargs), len(orig_arglist))) "(expected: %(len_cmd)d, got: %(len_args)d)",
print "Service Insertion Usage:\n %s %s" % ( {'cmd': cmd, 'len_cmd': len(cmdargs),
cmd, " ".join(["<%s>" % y for y in SERVICE_COMMANDS[cmd]["args"]])) '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() sys.exit()
if len(arglist) > 0: if len(arglist) > 0:
LOG.debug("Too many arguments for \"%s\" (expected: %d, got: %d)" LOG.debug(_("Too many arguments for '%(cmd)s' (expected: %(len)d, "
% (cmd, len(cmdargs), len(orig_arglist))) "got: %(len_args)d)"),
print "Service Insertion Usage:\n %s %s" % ( {'cmd': cmd, 'len_cmd': len(cmdargs),
cmd, " ".join(["<%s>" % y for y in SERVICE_COMMANDS[cmd]["args"]])) '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() sys.exit()
return args return args
@ -293,20 +307,21 @@ SERVICE_COMMANDS = {
if __name__ == "__main__": if __name__ == "__main__":
os.system("clear") os.system("clear")
usagestr = "Usage: %prog [OPTIONS] <command> [args]" usagestr = _("Usage: %prog [OPTIONS] <command> [args]")
PARSER = OptionParser(usage=usagestr) PARSER = OptionParser(usage=usagestr)
PARSER.add_option("-H", "--host", dest="host", PARSER.add_option("-H", "--host", dest="host",
type="string", default="127.0.0.1", 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", 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", 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", PARSER.add_option("-v", "--verbose", dest="verbose",
action="store_true", default=False, action="store_true", default=False,
help="turn on verbose logging") help=_("Turn on verbose logging"))
PARSER.add_option("-f", "--logfile", dest="logfile", 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() options, args = PARSER.parse_args()
if options.verbose: if options.verbose:
LOG.setLevel(logging.DEBUG) LOG.setLevel(logging.DEBUG)

View File

@ -110,15 +110,15 @@ class ServicesLogistics():
plugin_obj = conf.PLUGINS[const.PLUGINS][key] plugin_obj = conf.PLUGINS[const.PLUGINS][key]
_plugins[key] = importutils.import_object(plugin_obj) _plugins[key] = importutils.import_object(plugin_obj)
if not plugin_key in _plugins.keys(): 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 return False
else: else:
LOG.debug("Plugin %s founded" % const.UCS_PLUGIN) LOG.debug(_("Plugin %s founded"), const.UCS_PLUGIN)
return True return True
def press_key(self): def press_key(self):
""" """
Waits for en external input Waits for en external input
""" """
key = raw_input("Press any key to continue") key = raw_input(_("Press any key to continue"))
return key return key

View File

@ -97,8 +97,8 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
def _load_inventory(self): def _load_inventory(self):
"""Load the inventory from a config file""" """Load the inventory from a config file"""
inventory = deepcopy(conf.INVENTORY) inventory = deepcopy(conf.INVENTORY)
LOG.info("Loaded UCS inventory: %s\n" % inventory) LOG.info(_("Loaded UCS inventory: %s"), inventory)
LOG.info("Building UCS inventory state (this may take a while)...") LOG.info(_("Building UCS inventory state (this may take a while)..."))
for ucsm in inventory.keys(): for ucsm in inventory.keys():
ucsm_ip = inventory[ucsm][const.IP_ADDRESS] ucsm_ip = inventory[ucsm][const.IP_ADDRESS]
@ -141,7 +141,7 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
ucsm_password) ucsm_password)
blades_dict[blade_id] = blade_data 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 return True
def _get_host_name(self, ucsm_ip, chassis_id, blade_id): def _get_host_name(self, ucsm_ip, chassis_id, blade_id):
@ -285,7 +285,7 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
udb.update_portbinding(port_id, udb.update_portbinding(port_id,
instance_id=instance_id) instance_id=instance_id)
return host_name 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) tenant_id)
return None return None
@ -307,9 +307,10 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
intf_data[const.TENANTID] == tenant_id and intf_data[const.TENANTID] == tenant_id and
intf_data[const.INSTANCE_ID] == instance_id): intf_data[const.INSTANCE_ID] == instance_id):
found_blade_intf_data = blade_intf_data found_blade_intf_data = blade_intf_data
LOG.debug(("Found blade %s associated with this" LOG.debug(_("Found blade %(blade_id)s "
" instance: %s") % (blade_id, "associated with this"
instance_id)) " instance: %(instance_id)s"),
locals())
break break
if found_blade_intf_data: if found_blade_intf_data:
@ -332,14 +333,13 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
const.DEVICENAME: device_name, const.DEVICENAME: device_name,
const.UCSPROFILE: profile_name, const.UCSPROFILE: profile_name,
} }
LOG.debug(("Found reserved dynamic nic: %s" LOG.debug(_("Found reserved dynamic nic: %(intf_data)s"
"associated with port %s") % "associated with port %(port_id)s"), locals())
(intf_data, port_id)) LOG.debug(_("Returning dynamic nic details: %s"),
LOG.debug("Returning dynamic nic details: %s" %
dynamicnic_details) dynamicnic_details)
return 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) tenant_id)
return None return None
@ -370,15 +370,15 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
udb.update_portbinding(port_id, instance_id=None, udb.update_portbinding(port_id, instance_id=None,
vif_id=None) vif_id=None)
LOG.debug( LOG.debug(
("Disassociated VIF-ID: %s " _("Disassociated VIF-ID: %(vif_id)s "
"from port: %s" "from port: %(port_id)s"
"in UCS inventory state for blade: %s") % "in UCS inventory state for blade: "
(vif_id, port_id, intf_data)) "%(intf_data)s"), locals())
device_params = {const.DEVICE_IP: [ucsm_ip], device_params = {const.DEVICE_IP: [ucsm_ip],
const.PORTID: port_id} const.PORTID: port_id}
return device_params return device_params
LOG.warn(("Disassociating VIF-ID in UCS inventory failed. " LOG.warn(_("Disassociating VIF-ID in UCS inventory failed. "
"Could not find a reserved dynamic nic for tenant: %s") % "Could not find a reserved dynamic nic for tenant: %s"),
tenant_id) tenant_id)
return None return None
@ -409,8 +409,8 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
const.BLADE_INTF_DN: const.BLADE_INTF_DN:
interface_dn} interface_dn}
return blade_intf_info return blade_intf_info
LOG.warn("Could not find a reserved nic for tenant: %s port: %s" % LOG.warn(_("Could not find a reserved nic for tenant: %(tenant_id)s "
(tenant_id, port_id)) "port: %(port_id)s"), locals())
return None return None
def _get_least_reserved_blade(self, intf_count=1): def _get_least_reserved_blade(self, intf_count=1):
@ -436,9 +436,9 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
least_reserved_blade_data = blade_data least_reserved_blade_data = blade_data
if unreserved_interface_count < intf_count: if unreserved_interface_count < intf_count:
LOG.warn(("Not enough dynamic nics available on a single host." LOG.warn(_("Not enough dynamic nics available on a single host."
" Requested: %s, Maximum available: %s") % " Requested: %(intf_count)s, Maximum available: "
(intf_count, unreserved_interface_count)) "%(unreserved_interface_count)s"), locals())
return False return False
least_reserved_blade_dict = { least_reserved_blade_dict = {
@ -447,7 +447,7 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
const.LEAST_RSVD_BLADE_ID: least_reserved_blade_id, const.LEAST_RSVD_BLADE_ID: least_reserved_blade_id,
const.LEAST_RSVD_BLADE_DATA: least_reserved_blade_data, 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) least_reserved_blade_dict)
return least_reserved_blade_dict return least_reserved_blade_dict
@ -520,11 +520,12 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
None, None, None) None, None, None)
udb.update_portbinding(port_id, udb.update_portbinding(port_id,
tenant_id=intf_data[const.TENANTID]) 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 return reserved_nic_dict
LOG.warn("Dynamic nic %s could not be reserved for port-id: %s" % LOG.warn(_("Dynamic nic %(blade_data)s could not be reserved for "
(blade_data, port_id)) "port-id: %(port_id)s"), locals())
return False return False
def unreserve_blade_interface(self, ucsm_ip, chassis_id, blade_id, def unreserve_blade_interface(self, ucsm_ip, chassis_id, blade_id,
@ -542,7 +543,7 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
blade_intf[const.PROFILE_ID] = None blade_intf[const.PROFILE_ID] = None
blade_intf[const.INSTANCE_ID] = None blade_intf[const.INSTANCE_ID] = None
blade_intf[const.VIF_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): def add_blade(self, ucsm_ip, chassis_id, blade_id):
"""Add a blade to the inventory""" """Add a blade to the inventory"""
@ -551,32 +552,32 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
def get_all_networks(self, args): def get_all_networks(self, args):
"""Return all UCSM IPs""" """Return all UCSM IPs"""
LOG.debug("get_all_networks() called\n") LOG.debug(_("get_all_networks() called"))
return self._get_all_ucsms() return self._get_all_ucsms()
def create_network(self, args): def create_network(self, args):
"""Return all UCSM IPs""" """Return all UCSM IPs"""
LOG.debug("create_network() called\n") LOG.debug(_("create_network() called"))
return self._get_all_ucsms() return self._get_all_ucsms()
def delete_network(self, args): def delete_network(self, args):
"""Return all UCSM IPs""" """Return all UCSM IPs"""
LOG.debug("delete_network() called\n") LOG.debug(_("delete_network() called"))
return self._get_all_ucsms() return self._get_all_ucsms()
def get_network_details(self, args): def get_network_details(self, args):
"""Return all UCSM IPs""" """Return all UCSM IPs"""
LOG.debug("get_network_details() called\n") LOG.debug(_("get_network_details() called"))
return self._get_all_ucsms() return self._get_all_ucsms()
def update_network(self, args): def update_network(self, args):
"""Return all UCSM IPs""" """Return all UCSM IPs"""
LOG.debug("update_network() called\n") LOG.debug(_("update_network() called"))
return self._get_all_ucsms() return self._get_all_ucsms()
def get_all_ports(self, args): def get_all_ports(self, args):
"""Return all UCSM IPs""" """Return all UCSM IPs"""
LOG.debug("get_all_ports() called\n") LOG.debug(_("get_all_ports() called"))
return self._get_all_ucsms() return self._get_all_ucsms()
def create_port(self, args): def create_port(self, args):
@ -584,7 +585,7 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
Return the a dict with information of the blade Return the a dict with information of the blade
on which a dynamic vnic is available 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() least_reserved_blade_dict = self._get_least_reserved_blade()
if not least_reserved_blade_dict: if not least_reserved_blade_dict:
raise cexc.NoMoreNics() raise cexc.NoMoreNics()
@ -601,14 +602,14 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
Return the a dict with information of the blade Return the a dict with information of the blade
on which a dynamic vnic was reserved for this port 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] tenant_id = args[0]
net_id = args[1] net_id = args[1]
port_id = args[2] port_id = args[2]
rsvd_info = self._get_rsvd_blade_intf_by_port(tenant_id, port_id) rsvd_info = self._get_rsvd_blade_intf_by_port(tenant_id, port_id)
if not rsvd_info: if not rsvd_info:
LOG.warn("UCSInventory: Port not found: net_id: %s, port_id: %s" % LOG.warn(_("UCSInventory: Port not found: net_id: %(net_id)s, "
(net_id, port_id)) "port_id: %(port_id)s"), locals())
return {const.DEVICE_IP: []} return {const.DEVICE_IP: []}
device_params = { device_params = {
const.DEVICE_IP: [rsvd_info[const.UCSM_IP]], const.DEVICE_IP: [rsvd_info[const.UCSM_IP]],
@ -624,7 +625,7 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
Return the a dict with IP address of the blade Return the a dict with IP address of the blade
on which a dynamic vnic was reserved for this port 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) return self._get_blade_for_port(args)
def get_port_details(self, args): def get_port_details(self, args):
@ -632,7 +633,7 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
Return the a dict with IP address of the blade Return the a dict with IP address of the blade
on which a dynamic vnic was reserved for this port 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) return self._get_blade_for_port(args)
def plug_interface(self, args): def plug_interface(self, args):
@ -640,7 +641,7 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
Return the a dict with IP address of the blade Return the a dict with IP address of the blade
on which a dynamic vnic was reserved for this port 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) return self._get_blade_for_port(args)
def unplug_interface(self, args): def unplug_interface(self, args):
@ -648,31 +649,31 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
Return the a dict with IP address of the blade Return the a dict with IP address of the blade
on which a dynamic vnic was reserved for this port 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) return self._get_blade_for_port(args)
def schedule_host(self, args): def schedule_host(self, args):
"""Provides the hostname on which a dynamic vnic is reserved""" """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] instance_id = args[1]
tenant_id = args[2][const.PROJECT_ID] tenant_id = args[2][const.PROJECT_ID]
host_name = self._get_host_name_for_rsvd_intf(tenant_id, instance_id) host_name = self._get_host_name_for_rsvd_intf(tenant_id, instance_id)
host_list = {const.HOST_LIST: {const.HOST_1: host_name}} 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 return host_list
def associate_port(self, args): def associate_port(self, args):
""" """
Get the portprofile name and the device name for the dynamic vnic 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] instance_id = args[1]
tenant_id = args[2][const.PROJECT_ID] tenant_id = args[2][const.PROJECT_ID]
vif_id = args[2][const.VIF_ID] vif_id = args[2][const.VIF_ID]
vif_info = self._get_instance_port(tenant_id, instance_id, vif_id) vif_info = self._get_instance_port(tenant_id, instance_id, vif_id)
vif_desc = {const.VIF_DESC: vif_info} 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 return vif_desc
def detach_port(self, args): def detach_port(self, args):
@ -680,7 +681,7 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
Remove the VIF-ID and instance name association Remove the VIF-ID and instance name association
with the port with the port
""" """
LOG.debug("detach_port() called\n") LOG.debug(_("detach_port() called"))
instance_id = args[1] instance_id = args[1]
tenant_id = args[2][const.PROJECT_ID] tenant_id = args[2][const.PROJECT_ID]
vif_id = args[2][const.VIF_ID] vif_id = args[2][const.VIF_ID]
@ -693,7 +694,7 @@ class UCSInventory(L2NetworkDeviceInventoryBase):
""" """
Create multiple ports for a VM Create multiple ports for a VM
""" """
LOG.debug("create_ports() called\n") LOG.debug(_("create_ports() called"))
tenant_id = args[0] tenant_id = args[0]
ports_num = args[2] ports_num = args[2]
least_reserved_blade_dict = self._get_least_reserved_blade(ports_num) least_reserved_blade_dict = self._get_least_reserved_blade(ports_num)

View File

@ -40,7 +40,7 @@ class UCSVICPlugin(L2DevicePluginBase):
def __init__(self): def __init__(self):
self._driver = importutils.import_object(conf.UCSM_DRIVER) 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 # TODO (Sumit) Make the counter per UCSM
self._port_profile_counter = 0 self._port_profile_counter = 0
@ -50,7 +50,7 @@ class UCSVICPlugin(L2DevicePluginBase):
<network_uuid, network_name> for <network_uuid, network_name> for
the specified tenant. 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]) self._set_ucsm(kwargs[const.DEVICE_IP])
networks_list = db.network_list(tenant_id) networks_list = db.network_list(tenant_id)
new_networks_list = [] new_networks_list = []
@ -68,7 +68,7 @@ class UCSVICPlugin(L2DevicePluginBase):
Creates a new Virtual Network, and assigns it Creates a new Virtual Network, and assigns it
a symbolic name. a symbolic name.
""" """
LOG.debug("UCSVICPlugin:create_network() called\n") LOG.debug(_("UCSVICPlugin:create_network() called"))
self._set_ucsm(kwargs[const.DEVICE_IP]) self._set_ucsm(kwargs[const.DEVICE_IP])
self._driver.create_vlan(vlan_name, str(vlan_id), self._ucsm_ip, self._driver.create_vlan(vlan_name, str(vlan_id), self._ucsm_ip,
self._ucsm_username, self._ucsm_password) self._ucsm_username, self._ucsm_password)
@ -83,7 +83,7 @@ class UCSVICPlugin(L2DevicePluginBase):
Deletes the network with the specified network identifier Deletes the network with the specified network identifier
belonging to the specified tenant. 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]) self._set_ucsm(kwargs[const.DEVICE_IP])
vlan_binding = cdb.get_vlan_binding(net_id) vlan_binding = cdb.get_vlan_binding(net_id)
vlan_name = vlan_binding[const.VLANNAME] vlan_name = vlan_binding[const.VLANNAME]
@ -100,7 +100,7 @@ class UCSVICPlugin(L2DevicePluginBase):
Deletes the Virtual Network belonging to a the Deletes the Virtual Network belonging to a the
spec spec
""" """
LOG.debug("UCSVICPlugin:get_network_details() called\n") LOG.debug(_("UCSVICPlugin:get_network_details() called"))
self._set_ucsm(kwargs[const.DEVICE_IP]) self._set_ucsm(kwargs[const.DEVICE_IP])
network = db.network_get(net_id) network = db.network_get(net_id)
ports_list = network[const.NETWORKPORTS] ports_list = network[const.NETWORKPORTS]
@ -123,7 +123,7 @@ class UCSVICPlugin(L2DevicePluginBase):
Updates the symbolic name belonging to a particular Updates the symbolic name belonging to a particular
Virtual Network. Virtual Network.
""" """
LOG.debug("UCSVICPlugin:update_network() called\n") LOG.debug(_("UCSVICPlugin:update_network() called"))
self._set_ucsm(kwargs[const.DEVICE_IP]) self._set_ucsm(kwargs[const.DEVICE_IP])
network = db.network_get(net_id) network = db.network_get(net_id)
net_dict = cutil.make_net_dict(network[const.UUID], net_dict = cutil.make_net_dict(network[const.UUID],
@ -136,7 +136,7 @@ class UCSVICPlugin(L2DevicePluginBase):
Retrieves all port identifiers belonging to the Retrieves all port identifiers belonging to the
specified Virtual Network. 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]) self._set_ucsm(kwargs[const.DEVICE_IP])
network = db.network_get(net_id) network = db.network_get(net_id)
ports_list = network[const.NETWORKPORTS] ports_list = network[const.NETWORKPORTS]
@ -151,7 +151,7 @@ class UCSVICPlugin(L2DevicePluginBase):
""" """
Creates a port on the specified Virtual Network. 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]) self._set_ucsm(kwargs[const.DEVICE_IP])
qos = None qos = None
ucs_inventory = kwargs[const.UCS_INVENTORY] ucs_inventory = kwargs[const.UCS_INVENTORY]
@ -183,7 +183,7 @@ class UCSVICPlugin(L2DevicePluginBase):
the remote interface should first be un-plugged and the remote interface should first be un-plugged and
then the port can be deleted. 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]) self._set_ucsm(kwargs[const.DEVICE_IP])
ucs_inventory = kwargs[const.UCS_INVENTORY] ucs_inventory = kwargs[const.UCS_INVENTORY]
chassis_id = kwargs[const.CHASSIS_ID] chassis_id = kwargs[const.CHASSIS_ID]
@ -200,7 +200,7 @@ class UCSVICPlugin(L2DevicePluginBase):
""" """
Updates the state of a port on the specified Virtual Network. 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]) self._set_ucsm(kwargs[const.DEVICE_IP])
pass pass
@ -209,7 +209,7 @@ class UCSVICPlugin(L2DevicePluginBase):
This method allows the user to retrieve a remote interface This method allows the user to retrieve a remote interface
that is attached to this particular port. 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]) self._set_ucsm(kwargs[const.DEVICE_IP])
port_binding = udb.get_portbinding(port_id) port_binding = udb.get_portbinding(port_id)
return port_binding return port_binding
@ -220,7 +220,7 @@ class UCSVICPlugin(L2DevicePluginBase):
Attaches a remote interface to the specified port on the Attaches a remote interface to the specified port on the
specified Virtual Network. specified Virtual Network.
""" """
LOG.debug("UCSVICPlugin:plug_interface() called\n") LOG.debug(_("UCSVICPlugin:plug_interface() called"))
self._set_ucsm(kwargs[const.DEVICE_IP]) self._set_ucsm(kwargs[const.DEVICE_IP])
port_binding = udb.get_portbinding(port_id) port_binding = udb.get_portbinding(port_id)
profile_name = port_binding[const.PORTPROFILENAME] profile_name = port_binding[const.PORTPROFILENAME]
@ -239,7 +239,7 @@ class UCSVICPlugin(L2DevicePluginBase):
Detaches a remote interface from the specified port on the Detaches a remote interface from the specified port on the
specified Virtual Network. specified Virtual Network.
""" """
LOG.debug("UCSVICPlugin:unplug_interface() called\n") LOG.debug(_("UCSVICPlugin:unplug_interface() called"))
self._set_ucsm(kwargs[const.DEVICE_IP]) self._set_ucsm(kwargs[const.DEVICE_IP])
port_binding = udb.get_portbinding(port_id) port_binding = udb.get_portbinding(port_id)
profile_name = port_binding[const.PORTPROFILENAME] profile_name = port_binding[const.PORTPROFILENAME]
@ -257,7 +257,7 @@ class UCSVICPlugin(L2DevicePluginBase):
""" """
Creates a port on the specified Virtual Network. 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]) self._set_ucsm(kwargs[const.DEVICE_IP])
qos = None qos = None
ucs_inventory = kwargs[const.UCS_INVENTORY] ucs_inventory = kwargs[const.UCS_INVENTORY]
@ -290,7 +290,7 @@ class UCSVICPlugin(L2DevicePluginBase):
""" """
Remove the association of the VIF with the dynamic vnic 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] port_id = kwargs[const.PORTID]
kwargs.pop(const.PORTID) kwargs.pop(const.PORTID)
return self.unplug_interface(tenant_id, None, port_id, **kwargs) return self.unplug_interface(tenant_id, None, port_id, **kwargs)