diff --git a/dracclient/resources/idrac_card.py b/dracclient/resources/idrac_card.py
index c4c69ca..089deca 100644
--- a/dracclient/resources/idrac_card.py
+++ b/dracclient/resources/idrac_card.py
@@ -61,7 +61,7 @@ class iDRACCardAttribute(object):
fqdd = utils.get_wsman_resource_attr(
idrac_attr_xml, namespace, 'FQDD')
group_id = utils.get_wsman_resource_attr(
- idrac_attr_xml, namespace, 'GroupID')
+ idrac_attr_xml, namespace, 'GroupID', nullable=True)
return cls(name, instance_id, current_value, pending_value,
(read_only == 'true'), fqdd, group_id)
@@ -218,9 +218,12 @@ class iDRACCardIntegerAttribute(iDRACCardAttribute):
idrac_attr = iDRACCardAttribute.parse(cls.namespace, idrac_attr_xml)
lower_bound = utils.get_wsman_resource_attr(
- idrac_attr_xml, cls.namespace, 'LowerBound')
+ idrac_attr_xml, cls.namespace, 'LowerBound', nullable=True)
upper_bound = utils.get_wsman_resource_attr(
- idrac_attr_xml, cls.namespace, 'UpperBound')
+ idrac_attr_xml, cls.namespace, 'UpperBound', nullable=True)
+
+ lower_bound = lower_bound if lower_bound else 0
+ upper_bound = upper_bound if upper_bound else 0
if idrac_attr.current_value:
idrac_attr.current_value = int(idrac_attr.current_value)
@@ -235,6 +238,8 @@ class iDRACCardIntegerAttribute(iDRACCardAttribute):
def validate(self, new_value):
"""Validates new value"""
+ if self.lower_bound == 0 and self.upper_bound == 0:
+ return
val = int(new_value)
if val < self.lower_bound or val > self.upper_bound:
msg = ('Attribute %(attr)s cannot be set to value %(val)d.'
diff --git a/dracclient/tests/test_idrac_card.py b/dracclient/tests/test_idrac_card.py
index d3db623..ebdcc57 100644
--- a/dracclient/tests/test_idrac_card.py
+++ b/dracclient/tests/test_idrac_card.py
@@ -184,6 +184,47 @@ class ClientiDRACCardConfigurationTestCase(base.BaseTest):
self.assertEqual(expected_enum_attr, idrac_settings[
'Info.1#Type'])
+ def test_list_idrac_settings_with_nil_group_id(
+ self, mock_requests, mock_wait_until_idrac_is_ready):
+
+ mock_requests.post('https://1.2.3.4:443/wsman', [
+ {'text': test_utils.iDracCardEnumerations[
+ uris.DCIM_iDRACCardEnumeration]['ok']},
+ {'text': test_utils.iDracCardEnumerations[
+ uris.DCIM_iDRACCardString]['nil_group_id']},
+ {'text': test_utils.iDracCardEnumerations[
+ uris.DCIM_iDRACCardInteger]['ok']}])
+ self.drac_client.list_idrac_settings(
+ by_name=True, fqdd_filter='iDRAC.Embedded.1')
+
+ def test_list_idrac_settings_with_nil_lower_bound(
+ self, mock_requests, mock_wait_until_idrac_is_ready):
+
+ mock_requests.post('https://1.2.3.4:443/wsman', [
+ {'text': test_utils.iDracCardEnumerations[
+ uris.DCIM_iDRACCardEnumeration]['ok']},
+ {'text': test_utils.iDracCardEnumerations[
+ uris.DCIM_iDRACCardString]['ok']},
+ {'text': test_utils.iDracCardEnumerations[
+ uris.DCIM_iDRACCardInteger]['nil_lower_bound']}])
+
+ self.drac_client.list_idrac_settings(
+ by_name=True, fqdd_filter='iDRAC.Embedded.1')
+
+ def test_list_idrac_settings_with_nil_upper_bound(
+ self, mock_requests, mock_wait_until_idrac_is_ready):
+
+ mock_requests.post('https://1.2.3.4:443/wsman', [
+ {'text': test_utils.iDracCardEnumerations[
+ uris.DCIM_iDRACCardEnumeration]['ok']},
+ {'text': test_utils.iDracCardEnumerations[
+ uris.DCIM_iDRACCardString]['ok']},
+ {'text': test_utils.iDracCardEnumerations[
+ uris.DCIM_iDRACCardInteger]['nil_upper_bound']}])
+
+ self.drac_client.list_idrac_settings(
+ by_name=True, fqdd_filter='iDRAC.Embedded.1')
+
@mock.patch.object(dracclient.client.WSManClient, 'invoke',
spec_set=True, autospec=True)
def test_set_idrac_settings(
diff --git a/dracclient/tests/utils.py b/dracclient/tests/utils.py
index 0545f93..0dbc84c 100644
--- a/dracclient/tests/utils.py
+++ b/dracclient/tests/utils.py
@@ -163,10 +163,16 @@ iDracCardEnumerations = {
'ok': load_wsman_xml('idraccard_enumeration-enum-ok')
},
uris.DCIM_iDRACCardString: {
- 'ok': load_wsman_xml('idraccard_string-enum-ok')
+ 'ok': load_wsman_xml('idraccard_string-enum-ok'),
+ 'nil_group_id': load_wsman_xml(
+ 'idraccard_string-enum-nil-group-id')
},
uris.DCIM_iDRACCardInteger: {
- 'ok': load_wsman_xml('idraccard_integer-enum-ok')
+ 'ok': load_wsman_xml('idraccard_integer-enum-ok'),
+ 'nil_lower_bound': load_wsman_xml(
+ 'idraccard_integer-enum-nil-lower-bound'),
+ 'nil_upper_bound': load_wsman_xml(
+ 'idraccard_integer-enum-nil-upper-bound')
},
}
diff --git a/dracclient/tests/wsman_mocks/idraccard_integer-enum-nil-lower-bound.xml b/dracclient/tests/wsman_mocks/idraccard_integer-enum-nil-lower-bound.xml
new file mode 100644
index 0000000..3480b2a
--- /dev/null
+++ b/dracclient/tests/wsman_mocks/idraccard_integer-enum-nil-lower-bound.xml
@@ -0,0 +1,37 @@
+
+
+ http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+ http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse
+ uuid:1b114e09-e635-4ad9-90dd-3045421499a7
+ uuid:a92483bc-40aa-10aa-8221-de7e4e771814
+
+
+
+
+
+ Delivery Retry Interval In Seconds
+ DeliveryRetryIntervalInSeconds
+ 30
+ 30
+
+ 2241
+ iDRAC.Embedded.1
+ RedfishEventing
+ RedfishEventing.1
+ iDRAC.Embedded.1#RedfishEventing.1#DeliveryRetryIntervalInSeconds
+ false
+
+
+ 60
+
+
+
+
+
+
+
diff --git a/dracclient/tests/wsman_mocks/idraccard_integer-enum-nil-upper-bound.xml b/dracclient/tests/wsman_mocks/idraccard_integer-enum-nil-upper-bound.xml
new file mode 100644
index 0000000..1dca7bd
--- /dev/null
+++ b/dracclient/tests/wsman_mocks/idraccard_integer-enum-nil-upper-bound.xml
@@ -0,0 +1,37 @@
+
+
+ http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+ http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse
+ uuid:1b114e09-e635-4ad9-90dd-3045421499a7
+ uuid:a92483bc-40aa-10aa-8221-de7e4e771814
+
+
+
+
+
+ Delivery Retry Interval In Seconds
+ DeliveryRetryIntervalInSeconds
+ 30
+ 30
+
+ 2241
+ iDRAC.Embedded.1
+ RedfishEventing
+ RedfishEventing.1
+ iDRAC.Embedded.1#RedfishEventing.1#DeliveryRetryIntervalInSeconds
+ false
+
+
+ 60
+
+
+
+
+
+
+
diff --git a/dracclient/tests/wsman_mocks/idraccard_string-enum-nil-group-id.xml b/dracclient/tests/wsman_mocks/idraccard_string-enum-nil-group-id.xml
new file mode 100644
index 0000000..3c1950f
--- /dev/null
+++ b/dracclient/tests/wsman_mocks/idraccard_string-enum-nil-group-id.xml
@@ -0,0 +1,38 @@
+
+
+ http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
+ http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse
+ uuid:437c3101-0e6a-41f5-ad49-8a09b3ee5589
+ uuid:a8ddc513-40aa-10aa-821d-de7e4e771814
+
+
+
+
+
+ iDRAC Product Information
+ Product
+ Integrated Dell Remote Access Controller
+
+
+ 1
+ iDRAC.Embedded.1
+ RAC Information
+
+ iDRAC.Embedded.1#Info.1#Product
+ true
+ 63
+ 0
+
+
+
+
+
+
+
+
+