Remove redunant key list generation in Cisco plugin
Evaluates existance of key directly on dictionary. Fixes bug #1110957 Change-Id: I9b46a991ab9c764d7451cc122d208e06778c1ee1
This commit is contained in:
parent
68582ecfde
commit
742557d20d
@ -1,6 +1,7 @@
|
|||||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
#
|
|
||||||
# Copyright 2012 Cisco Systems, Inc. All rights reserved.
|
# Copyright 2012 Cisco Systems, Inc.
|
||||||
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -15,6 +16,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
# @author: Sumit Naiksatam, Cisco Systems, Inc.
|
# @author: Sumit Naiksatam, Cisco Systems, Inc.
|
||||||
|
#
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import inspect
|
import inspect
|
||||||
@ -74,7 +76,7 @@ class NetworkMultiBladeV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
Invokes a device plugin's relevant functions (on the it's
|
Invokes a device plugin's relevant functions (on the it's
|
||||||
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 plugin_key not in self._plugins:
|
||||||
LOG.info(_("No %s Plugin loaded"), plugin_key)
|
LOG.info(_("No %s Plugin loaded"), plugin_key)
|
||||||
LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
|
LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
|
||||||
"ignored"), locals())
|
"ignored"), locals())
|
||||||
@ -99,7 +101,7 @@ class NetworkMultiBladeV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
Invokes the relevant function on a device plugin's
|
Invokes the relevant function on a device plugin's
|
||||||
inventory for completing this operation.
|
inventory for completing this operation.
|
||||||
"""
|
"""
|
||||||
if not plugin_key in self._inventory.keys():
|
if plugin_key not in self._inventory:
|
||||||
LOG.info(_("No %s inventory loaded"), plugin_key)
|
LOG.info(_("No %s inventory loaded"), plugin_key)
|
||||||
LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
|
LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
|
||||||
"ignored"), locals())
|
"ignored"), locals())
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
#
|
|
||||||
# Copyright 2012 Cisco Systems, Inc. All rights reserved.
|
# Copyright 2012 Cisco Systems, Inc.
|
||||||
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -16,6 +17,7 @@
|
|||||||
#
|
#
|
||||||
# @author: Sumit Naiksatam, Cisco Systems, Inc.
|
# @author: Sumit Naiksatam, Cisco Systems, Inc.
|
||||||
# @author: Rohit Agarwalla, Cisco Systems, Inc.
|
# @author: Rohit Agarwalla, Cisco Systems, Inc.
|
||||||
|
#
|
||||||
|
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import inspect
|
import inspect
|
||||||
@ -34,6 +36,7 @@ from quantum.plugins.cisco import l2network_plugin_configuration as conf
|
|||||||
from quantum.plugins.openvswitch import ovs_db_v2 as odb
|
from quantum.plugins.openvswitch import ovs_db_v2 as odb
|
||||||
from quantum import quantum_plugin_base_v2
|
from quantum import quantum_plugin_base_v2
|
||||||
|
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +117,7 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
Invokes a device plugin's relevant functions (on the it's
|
Invokes a device plugin's relevant functions (on the it's
|
||||||
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 plugin_key not in self._plugins:
|
||||||
LOG.info(_("No %s Plugin loaded"), plugin_key)
|
LOG.info(_("No %s Plugin loaded"), plugin_key)
|
||||||
LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
|
LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
|
||||||
"ignored"), locals())
|
"ignored"), locals())
|
||||||
@ -139,7 +142,7 @@ class VirtualPhysicalSwitchModelV2(quantum_plugin_base_v2.QuantumPluginBaseV2):
|
|||||||
Invokes the relevant function on a device plugin's
|
Invokes the relevant function on a device plugin's
|
||||||
inventory for completing this operation.
|
inventory for completing this operation.
|
||||||
"""
|
"""
|
||||||
if not plugin_key in self._inventory.keys():
|
if plugin_key not in self._inventory:
|
||||||
LOG.info(_("No %s inventory loaded"), plugin_key)
|
LOG.info(_("No %s inventory loaded"), plugin_key)
|
||||||
LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
|
LOG.info(_("%(plugin_key)s: %(function_name)s with args %(args)s "
|
||||||
"ignored"), locals())
|
"ignored"), locals())
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
#
|
|
||||||
# Copyright 2012 Cisco Systems, Inc. All rights reserved.
|
# Copyright 2012 Cisco Systems, Inc.
|
||||||
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -18,9 +19,11 @@
|
|||||||
# @author: Edgar Magana, Cisco Systems, Inc.
|
# @author: Edgar Magana, Cisco Systems, Inc.
|
||||||
# @author: Arvind Somya, Cisco Systems, Inc. (asomya@cisco.com)
|
# @author: Arvind Somya, Cisco Systems, Inc. (asomya@cisco.com)
|
||||||
#
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
PlugIn for Nexus OS driver
|
PlugIn for Nexus OS driver
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from quantum.common import exceptions as exc
|
from quantum.common import exceptions as exc
|
||||||
@ -55,7 +58,7 @@ class NexusPlugin(L2DevicePluginBase):
|
|||||||
self.credentials = {}
|
self.credentials = {}
|
||||||
|
|
||||||
def get_credential(self, nexus_ip):
|
def get_credential(self, nexus_ip):
|
||||||
if not nexus_ip in self.credentials.keys():
|
if nexus_ip not in self.credentials:
|
||||||
_nexus_username = cred.Store.get_username(nexus_ip)
|
_nexus_username = cred.Store.get_username(nexus_ip)
|
||||||
_nexus_password = cred.Store.get_password(nexus_ip)
|
_nexus_password = cred.Store.get_password(nexus_ip)
|
||||||
self.credentials[nexus_ip] = {
|
self.credentials[nexus_ip] = {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||||
#
|
|
||||||
# Copyright 2011 Cisco Systems, Inc. All rights reserved.
|
# Copyright 2011 Cisco Systems, Inc.
|
||||||
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# not use this file except in compliance with the License. You may obtain
|
# not use this file except in compliance with the License. You may obtain
|
||||||
@ -15,6 +16,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
# @author: Edgar Magana, Cisco Systems
|
# @author: Edgar Magana, Cisco Systems
|
||||||
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Logistic components for Service Insertion utility
|
Logistic components for Service Insertion utility
|
||||||
"""
|
"""
|
||||||
@ -109,7 +112,7 @@ class ServicesLogistics():
|
|||||||
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]
|
||||||
_plugins[key] = importutils.import_object(plugin_obj)
|
_plugins[key] = importutils.import_object(plugin_obj)
|
||||||
if not plugin_key in _plugins.keys():
|
if plugin_key not in _plugins:
|
||||||
LOG.debug(_("No %s Plugin loaded"), plugin_key)
|
LOG.debug(_("No %s Plugin loaded"), plugin_key)
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user