Skip to content

Commit

Permalink
Merge pull request #204 from CiscoUcs/refresh
Browse files Browse the repository at this point in the history
fixes an issue with version meta
  • Loading branch information
vvb authored Apr 22, 2020
2 parents 7f887a9 + 96fbd4f commit 156627f
Show file tree
Hide file tree
Showing 32 changed files with 192 additions and 157 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
History
=======

0.9.9 (2020-04-22)
---------------------
* Fixes an issue with version meta

0.9.8 (2020-04-22)
---------------------
* Adds support for IMC version 4.1(1c), 4.1(1d)
Expand Down
2 changes: 1 addition & 1 deletion imcsdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ def set_log_level(level=logging.DEBUG):

__author__ = 'Cisco Systems'
__email__ = 'ucs-python@cisco.com'
__version__ = '0.9.8'
__version__ = '0.9.9'
16 changes: 8 additions & 8 deletions imcsdk/imcbasetype.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Method(BaseObject):
def __init__(self, **kwargs):
BaseObject.__init__(self, "Method", "method")
if kwargs:
for n, v in kwargs.iteritems():
for n, v in kwargs.items():
self.attr_set(n, v)


Expand All @@ -34,7 +34,7 @@ class ConfigConfig(BaseObject):
def __init__(self, **kwargs):
BaseObject.__init__(self, "ConfigConfig", "configConfig")
if kwargs:
for n, v in kwargs.iteritems():
for n, v in kwargs.items():
self.attr_set(n, v)


Expand All @@ -43,7 +43,7 @@ class ConfigMap(BaseObject):
def __init__(self, **kwargs):
BaseObject.__init__(self, "ConfigMap", "configMap")
if kwargs:
for n, v in kwargs.iteritems():
for n, v in kwargs.items():
self.attr_set(n, v)


Expand All @@ -52,7 +52,7 @@ class ConfigSet(BaseObject):
def __init__(self, **kwargs):
BaseObject.__init__(self, "ConfigSet", "configSet")
if kwargs:
for n, v in kwargs.iteritems():
for n, v in kwargs.items():
self.attr_set(n, v)


Expand All @@ -65,7 +65,7 @@ def __init__(self, **kwargs):
self.error_descr = None
self.name = None
if kwargs:
for n, v in kwargs.iteritems():
for n, v in kwargs.items():
self.attr_set(n, v)


Expand All @@ -74,7 +74,7 @@ class FailedMos(BaseObject):
def __init__(self, **kwargs):
BaseObject.__init__(self, "FailedMos", "failedMos")
if kwargs:
for n, v in kwargs.iteritems():
for n, v in kwargs.items():
self.attr_set(n, v)


Expand All @@ -83,7 +83,7 @@ class FilterFilter(BaseObject):
def __init__(self, **kwargs):
BaseObject.__init__(self, "FilterFilter", "filter")
if kwargs:
for n, v in kwargs.iteritems():
for n, v in kwargs.items():
self.attr_set(n, v)


Expand All @@ -93,6 +93,6 @@ def __init__(self, **kwargs):
BaseObject.__init__(self, "Pair", "pair")
self.key = None
if kwargs:
for n, v in kwargs.iteritems():
for n, v in kwargs.items():
self.attr_set(n, v)

4 changes: 2 additions & 2 deletions imcsdk/imccore.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def from_xml(self, elem, handle=None):

self._handle = handle
if elem.attrib:
for attr_name, attr_value in imcgenutils.iteritems(elem.attrib):
for attr_name, attr_value in elem.attrib.items():
self.attr_set(imcgenutils.convert_to_python_var_name(attr_name),
str(attr_value))

Expand Down Expand Up @@ -227,5 +227,5 @@ class OperationStatus(ImcCustomMethod):
def __init__(self, **kwargs):
ImcCustomMethod.__init__(self, "OperationStatus", "operationStatus")
if kwargs:
for n, v in imcgenutils.iteritems(kwargs):
for n, v in kwargs.items():
self.attr_set(n, v)
2 changes: 1 addition & 1 deletion imcsdk/imccoreutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ def process_conf_mos_response(response, api='process_conf_mos_response',
messages = []
if response[Const.RESPONSE_STATUS] != Const.RESPONSE_STATUS_SUCCESS:
for dn, error in sorted(response[Const.RESPONSE_MOS][
Const.RESPONSE_FAILED_MOS].iteritems()):
Const.RESPONSE_FAILED_MOS].items()):
d = {}
# log.debug("Error(%s) while processing dn(%s)" % (error, dn))
d["Object"] = callback(dn, *cbargs)
Expand Down
6 changes: 0 additions & 6 deletions imcsdk/imcgenutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,3 @@ def decrypt_password(cipher, key):
decrypted_password = password_stream.tostring()[:cipher_len]
return decrypted_password


def iteritems(d):
"""
Factor-out Py2-to-3 differences in dictionary item iterator methods
"""
return six.iteritems(d)
30 changes: 15 additions & 15 deletions imcsdk/imcmeta.py

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions imcsdk/imcmethod.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from __future__ import absolute_import
from .imccore import ImcBase
from . import imccoreutils
from . import imcgenutils

try:
import xml.etree.cElementTree as ET
Expand Down Expand Up @@ -131,7 +130,7 @@ def from_xml(self, elem, handle=None):

self._handle = handle
if elem.attrib:
for attr_name, attr_value in imcgenutils.iteritems(elem.attrib):
for attr_name, attr_value in elem.attrib.items():
if attr_name in self.__property_map:
attr = self.__property_map[attr_name]
method_prop_meta = self.__property_meta[attr]
Expand Down Expand Up @@ -170,7 +169,7 @@ def __str__(self):
out_str = "\n"
out_str += "External Method\t\t\t:\t" + str(self._class_id) + "\n"
out_str += "-" * len("External Method") + "\n"
for prop, prop_value in sorted(imcgenutils.iteritems(self.__dict__)):
for prop, prop_value in sorted(self.__dict__.items()):
if "ExternalMethod" in prop:
continue
out_str += str(prop).ljust(tab_size * 4) + ':' + str(
Expand Down
16 changes: 8 additions & 8 deletions imcsdk/imcmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(
self.__parent_mo.child_add(self)

if kwargs:
for prop_name, prop_value in imcgenutils.iteritems(kwargs):
for prop_name, prop_value in kwargs.items():
if prop_name not in self.__internal_prop and \
not imccoreutils.prop_exists(self, prop_name):
log.debug("Unknown property %s" % prop_name)
Expand Down Expand Up @@ -248,7 +248,7 @@ def __str__(self):
out_str = "\n"
out_str += "Managed Object\t\t\t:\t" + str(self._class_id) + "\n"
out_str += "-" * len("Managed Object") + "\n"
for prop, prop_value in sorted(imcgenutils.iteritems(self.__dict__)):
for prop, prop_value in sorted(self.__dict__.items()):
if prop in ManagedObject.__internal_prop or prop.startswith(
"_ManagedObject__"):
continue
Expand Down Expand Up @@ -392,7 +392,7 @@ def from_xml(self, elem, handle=None):
self._handle = handle
if elem.attrib:
if self.__class__.__name__ != "ManagedObject":
for attr_name, attr_value in imcgenutils.iteritems(elem.attrib):
for attr_name, attr_value in elem.attrib.items():
if imccoreutils.property_exists_in_prop_map(self,
attr_name):
attr_name = \
Expand All @@ -405,7 +405,7 @@ def from_xml(self, elem, handle=None):
False)
object.__setattr__(self, attr_name, attr_value)
else:
for attr_name, attr_value in imcgenutils.iteritems(elem.attrib):
for attr_name, attr_value in elem.attrib.items():
object.__setattr__(self, attr_name, attr_value)

if hasattr(self, 'rn') and not hasattr(self, 'dn'):
Expand Down Expand Up @@ -437,7 +437,7 @@ def sync_mo(self, mo):
Method to return string representation of a managed object.
"""

for prop, prop_value in sorted(imcgenutils.iteritems(self.__dict__)):
for prop, prop_value in sorted(self.__dict__.items()):
if prop in ManagedObject.__internal_prop or prop.startswith(
"_ManagedObject__"):
continue
Expand Down Expand Up @@ -533,7 +533,7 @@ def __init__(self, class_id, parent_mo_or_dn=None, **kwargs):
ImcBase.__init__(self, class_id)

if kwargs:
for key, value in imcgenutils.iteritems(kwargs):
for key, value in kwargs.items():
self.__dict__[key] = str(value)
self.__properties[key] = str(value)

Expand Down Expand Up @@ -621,7 +621,7 @@ def from_xml(self, elem, handle=None):
self._handle = handle
self._class_id = elem.tag
if elem.attrib:
for name, value in imcgenutils.iteritems(elem.attrib):
for name, value in elem.attrib.items():
self.__dict__[name] = value
self.__properties[name] = str(value)

Expand Down Expand Up @@ -727,7 +727,7 @@ def __str__(self):
out_str += 'GenericMo'.ljust(ts * 4) + ':' + str(
self._class_id) + "\n"
out_str += "-" * len("GenericMo") + "\n"
for prop, prop_val in sorted(imcgenutils.iteritems(self.__dict__)):
for prop, prop_val in sorted(self.__dict__.items()):
if prop.startswith('_'):
continue
out_str += str(prop).ljust(ts * 4) + ':' + str(prop_val) + "\n"
Expand Down
8 changes: 4 additions & 4 deletions imcsdk/mometa/aaa/AaaUserPolicy.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class AaaUserPolicy(ManagedObject):
},

"modular": {
"allowed_attempts": MoPropertyMeta("allowed_attempts", "allowedAttempts", "uint", VersionMeta.Version410a, MoPropertyMeta.READ_WRITE, 0x2, None, None, None, [], ["0-20"]),
"allowed_attempts": MoPropertyMeta("allowed_attempts", "allowedAttempts", "uint", VersionMeta.Version411c, MoPropertyMeta.READ_WRITE, 0x2, None, None, None, [], ["0-20"]),
"dn": MoPropertyMeta("dn", "dn", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x4, 0, 255, None, [], []),
"lockout_period": MoPropertyMeta("lockout_period", "lockoutPeriod", "uint", VersionMeta.Version410a, MoPropertyMeta.READ_WRITE, 0x8, None, None, None, [], ["0-60"]),
"lockout_period": MoPropertyMeta("lockout_period", "lockoutPeriod", "uint", VersionMeta.Version411c, MoPropertyMeta.READ_WRITE, 0x8, None, None, None, [], ["0-60"]),
"rn": MoPropertyMeta("rn", "rn", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x10, 0, 255, None, [], []),
"status": MoPropertyMeta("status", "status", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x20, None, None, None, ["", "created", "deleted", "modified", "removed"], []),
"user_disable_on_lockout": MoPropertyMeta("user_disable_on_lockout", "userDisableOnLockout", "string", VersionMeta.Version410a, MoPropertyMeta.READ_WRITE, 0x40, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
"user_mode": MoPropertyMeta("user_mode", "userMode", "string", VersionMeta.Version410a, MoPropertyMeta.READ_WRITE, 0x80, None, None, None, ["ipmi", "non-ipmi"], []),
"user_disable_on_lockout": MoPropertyMeta("user_disable_on_lockout", "userDisableOnLockout", "string", VersionMeta.Version411c, MoPropertyMeta.READ_WRITE, 0x40, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
"user_mode": MoPropertyMeta("user_mode", "userMode", "string", VersionMeta.Version411c, MoPropertyMeta.READ_WRITE, 0x80, None, None, None, ["ipmi", "non-ipmi"], []),
"user_password_policy": MoPropertyMeta("user_password_policy", "userPasswordPolicy", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x100, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
"child_action": MoPropertyMeta("child_action", "childAction", "string", VersionMeta.Version2013e, MoPropertyMeta.INTERNAL, None, None, None, None, [], []),
"password_policy_rules": MoPropertyMeta("password_policy_rules", "passwordPolicyRules", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_ONLY, None, 0, 2500, None, [], []),
Expand Down
12 changes: 6 additions & 6 deletions imcsdk/mometa/adaptor/AdaptorEthMultiQueueProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ class AdaptorEthMultiQueueProfile(ManagedObject):
"modular": {
"completion_count": MoPropertyMeta("completion_count", "completionCount", "uint", VersionMeta.Version404b, MoPropertyMeta.READ_WRITE, 0x2, None, None, None, [], ["0-2000", "1-2000"]),
"dn": MoPropertyMeta("dn", "dn", "string", VersionMeta.Version404b, MoPropertyMeta.READ_WRITE, 0x4, 0, 255, None, [], []),
"multi_queue_memory_regions": MoPropertyMeta("multi_queue_memory_regions", "multiQueueMemoryRegions", "uint", VersionMeta.Version410a, MoPropertyMeta.READ_WRITE, 0x8, None, None, None, [], ["0-524288"]),
"multi_queue_pairs": MoPropertyMeta("multi_queue_pairs", "multiQueuePairs", "uint", VersionMeta.Version410a, MoPropertyMeta.READ_WRITE, 0x10, None, None, None, [], ["0-8192"]),
"multi_queue_resource_groups": MoPropertyMeta("multi_queue_resource_groups", "multiQueueResourceGroups", "uint", VersionMeta.Version410a, MoPropertyMeta.READ_WRITE, 0x20, None, None, None, [], ["0-128"]),
"multi_queue_roce_version2": MoPropertyMeta("multi_queue_roce_version2", "multiQueueRoceVersion2", "string", VersionMeta.Version410a, MoPropertyMeta.READ_WRITE, 0x40, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
"multi_queue_memory_regions": MoPropertyMeta("multi_queue_memory_regions", "multiQueueMemoryRegions", "uint", VersionMeta.Version411c, MoPropertyMeta.READ_WRITE, 0x8, None, None, None, [], ["0-524288"]),
"multi_queue_pairs": MoPropertyMeta("multi_queue_pairs", "multiQueuePairs", "uint", VersionMeta.Version411c, MoPropertyMeta.READ_WRITE, 0x10, None, None, None, [], ["0-8192"]),
"multi_queue_resource_groups": MoPropertyMeta("multi_queue_resource_groups", "multiQueueResourceGroups", "uint", VersionMeta.Version411c, MoPropertyMeta.READ_WRITE, 0x20, None, None, None, [], ["0-128"]),
"multi_queue_roce_version2": MoPropertyMeta("multi_queue_roce_version2", "multiQueueRoceVersion2", "string", VersionMeta.Version411c, MoPropertyMeta.READ_WRITE, 0x40, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
"receive_count": MoPropertyMeta("receive_count", "receiveCount", "uint", VersionMeta.Version404b, MoPropertyMeta.READ_WRITE, 0x80, None, None, None, [], ["0-1000", "1-1000"]),
"rn": MoPropertyMeta("rn", "rn", "string", VersionMeta.Version404b, MoPropertyMeta.READ_WRITE, 0x100, 0, 255, None, [], []),
"status": MoPropertyMeta("status", "status", "string", VersionMeta.Version404b, MoPropertyMeta.READ_WRITE, 0x200, None, None, None, ["", "created", "deleted", "modified", "removed"], []),
"transmit_count": MoPropertyMeta("transmit_count", "transmitCount", "uint", VersionMeta.Version404b, MoPropertyMeta.READ_WRITE, 0x400, None, None, None, [], ["0-1000", "1-1000"]),
"child_action": MoPropertyMeta("child_action", "childAction", "string", VersionMeta.Version404b, MoPropertyMeta.INTERNAL, None, None, None, None, [], []),
"multi_queue_class_of_service": MoPropertyMeta("multi_queue_class_of_service", "multiQueueClassOfService", "string", VersionMeta.Version410a, MoPropertyMeta.READ_ONLY, None, None, None, None, ["0", "1", "2", "4", "5", "6"], []),
"multi_queue_roce_version1": MoPropertyMeta("multi_queue_roce_version1", "multiQueueRoceVersion1", "string", VersionMeta.Version410a, MoPropertyMeta.READ_ONLY, None, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
"multi_queue_class_of_service": MoPropertyMeta("multi_queue_class_of_service", "multiQueueClassOfService", "string", VersionMeta.Version411c, MoPropertyMeta.READ_ONLY, None, None, None, None, ["0", "1", "2", "4", "5", "6"], []),
"multi_queue_roce_version1": MoPropertyMeta("multi_queue_roce_version1", "multiQueueRoceVersion1", "string", VersionMeta.Version411c, MoPropertyMeta.READ_ONLY, None, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
},

}
Expand Down
6 changes: 3 additions & 3 deletions imcsdk/mometa/adaptor/AdaptorEthRdmaProfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ class AdaptorEthRdmaProfile(ManagedObject):
"dn": MoPropertyMeta("dn", "dn", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x2, 0, 255, None, [], []),
"memory_regions": MoPropertyMeta("memory_regions", "memoryRegions", "uint", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x4, None, None, None, [], ["0-524288"]),
"queue_pairs": MoPropertyMeta("queue_pairs", "queuePairs", "uint", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x8, None, None, None, [], ["0-8192"]),
"rdma_class_of_service": MoPropertyMeta("rdma_class_of_service", "rdmaClassOfService", "string", VersionMeta.Version410a, MoPropertyMeta.READ_WRITE, 0x10, None, None, None, ["0", "1", "2", "4", "5", "6"], []),
"rdma_class_of_service": MoPropertyMeta("rdma_class_of_service", "rdmaClassOfService", "string", VersionMeta.Version411c, MoPropertyMeta.READ_WRITE, 0x10, None, None, None, ["0", "1", "2", "4", "5", "6"], []),
"resource_groups": MoPropertyMeta("resource_groups", "resourceGroups", "uint", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x20, None, None, None, [], ["0-128"]),
"rn": MoPropertyMeta("rn", "rn", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x40, 0, 255, None, [], []),
"roce_version2": MoPropertyMeta("roce_version2", "roceVersion2", "string", VersionMeta.Version410a, MoPropertyMeta.READ_WRITE, 0x80, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
"roce_version2": MoPropertyMeta("roce_version2", "roceVersion2", "string", VersionMeta.Version411c, MoPropertyMeta.READ_WRITE, 0x80, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
"status": MoPropertyMeta("status", "status", "string", VersionMeta.Version2013e, MoPropertyMeta.READ_WRITE, 0x100, None, None, None, ["", "created", "deleted", "modified", "removed"], []),
"child_action": MoPropertyMeta("child_action", "childAction", "string", VersionMeta.Version2013e, MoPropertyMeta.INTERNAL, None, None, None, None, [], []),
"roce_version1": MoPropertyMeta("roce_version1", "roceVersion1", "string", VersionMeta.Version410a, MoPropertyMeta.READ_ONLY, None, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
"roce_version1": MoPropertyMeta("roce_version1", "roceVersion1", "string", VersionMeta.Version411c, MoPropertyMeta.READ_ONLY, None, None, None, None, ["Disabled", "Enabled", "disabled", "enabled"], []),
},

}
Expand Down
Loading

0 comments on commit 156627f

Please sign in to comment.