Set iDRACCard attributes as nullable
The iDRACCard attribute GroupID is empty for 15th Generation servers, e.g., Dell EMC PowerEdge R750 and R650, which triggered the error "attribute GroupID is not nullable". A similar error message has been observed when processing the iDRACCardInteger attributes LowerBound and UpperBound read from a PowerEdge XE2420 server. This change sets those attributes as nullable. Change-Id: If34d96fab4249f466f63b3740d1ff5eb68012462
This commit is contained in:
parent
b71e16cacc
commit
1488d904e2
@ -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.'
|
||||
|
@ -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(
|
||||
|
@ -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')
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,37 @@
|
||||
<s:Envelope xmlns:n1="http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_iDRACCardInteger"
|
||||
xmlns:s="http://www.w3.org/2003/05/soap-envelope"
|
||||
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
|
||||
xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration"
|
||||
xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<s:Header>
|
||||
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
|
||||
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse</wsa:Action>
|
||||
<wsa:RelatesTo>uuid:1b114e09-e635-4ad9-90dd-3045421499a7</wsa:RelatesTo>
|
||||
<wsa:MessageID>uuid:a92483bc-40aa-10aa-8221-de7e4e771814</wsa:MessageID>
|
||||
</s:Header>
|
||||
<s:Body>
|
||||
<wsen:EnumerateResponse>
|
||||
<wsman:Items>
|
||||
<n1:DCIM_iDRACCardInteger>
|
||||
<n1:AttributeDisplayName>Delivery Retry Interval In Seconds</n1:AttributeDisplayName>
|
||||
<n1:AttributeName>DeliveryRetryIntervalInSeconds</n1:AttributeName>
|
||||
<n1:CurrentValue>30</n1:CurrentValue>
|
||||
<n1:DefaultValue>30</n1:DefaultValue>
|
||||
<n1:Dependency xsi:nil="true"/>
|
||||
<n1:DisplayOrder>2241</n1:DisplayOrder>
|
||||
<n1:FQDD>iDRAC.Embedded.1</n1:FQDD>
|
||||
<n1:GroupDisplayName>RedfishEventing</n1:GroupDisplayName>
|
||||
<n1:GroupID>RedfishEventing.1</n1:GroupID>
|
||||
<n1:InstanceID>iDRAC.Embedded.1#RedfishEventing.1#DeliveryRetryIntervalInSeconds</n1:InstanceID>
|
||||
<n1:IsReadOnly>false</n1:IsReadOnly>
|
||||
<n1:LowerBound xsi:nil="true"/>
|
||||
<n1:PendingValue xsi:nil="true"/>
|
||||
<n1:UpperBound>60</n1:UpperBound>
|
||||
</n1:DCIM_iDRACCardInteger>
|
||||
</wsman:Items>
|
||||
<wsen:EnumerationContext/>
|
||||
<wsman:EndOfSequence/>
|
||||
</wsen:EnumerateResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
@ -0,0 +1,37 @@
|
||||
<s:Envelope xmlns:n1="http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_iDRACCardInteger"
|
||||
xmlns:s="http://www.w3.org/2003/05/soap-envelope"
|
||||
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
|
||||
xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration"
|
||||
xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<s:Header>
|
||||
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
|
||||
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse</wsa:Action>
|
||||
<wsa:RelatesTo>uuid:1b114e09-e635-4ad9-90dd-3045421499a7</wsa:RelatesTo>
|
||||
<wsa:MessageID>uuid:a92483bc-40aa-10aa-8221-de7e4e771814</wsa:MessageID>
|
||||
</s:Header>
|
||||
<s:Body>
|
||||
<wsen:EnumerateResponse>
|
||||
<wsman:Items>
|
||||
<n1:DCIM_iDRACCardInteger>
|
||||
<n1:AttributeDisplayName>Delivery Retry Interval In Seconds</n1:AttributeDisplayName>
|
||||
<n1:AttributeName>DeliveryRetryIntervalInSeconds</n1:AttributeName>
|
||||
<n1:CurrentValue>30</n1:CurrentValue>
|
||||
<n1:DefaultValue>30</n1:DefaultValue>
|
||||
<n1:Dependency xsi:nil="true"/>
|
||||
<n1:DisplayOrder>2241</n1:DisplayOrder>
|
||||
<n1:FQDD>iDRAC.Embedded.1</n1:FQDD>
|
||||
<n1:GroupDisplayName>RedfishEventing</n1:GroupDisplayName>
|
||||
<n1:GroupID>RedfishEventing.1</n1:GroupID>
|
||||
<n1:InstanceID>iDRAC.Embedded.1#RedfishEventing.1#DeliveryRetryIntervalInSeconds</n1:InstanceID>
|
||||
<n1:IsReadOnly>false</n1:IsReadOnly>
|
||||
<n1:UpperBound xsi:nil="true"/>
|
||||
<n1:PendingValue xsi:nil="true"/>
|
||||
<n1:LowerBound>60</n1:LowerBound>
|
||||
</n1:DCIM_iDRACCardInteger>
|
||||
</wsman:Items>
|
||||
<wsen:EnumerationContext/>
|
||||
<wsman:EndOfSequence/>
|
||||
</wsen:EnumerateResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
@ -0,0 +1,38 @@
|
||||
<s:Envelope xmlns:n1="http://schemas.dell.com/wbem/wscim/1/cim-schema/2/DCIM_iDRACCardString"
|
||||
xmlns:s="http://www.w3.org/2003/05/soap-envelope"
|
||||
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
|
||||
xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration"
|
||||
xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<s:Header>
|
||||
<wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
|
||||
<wsa:Action>http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse</wsa:Action>
|
||||
<wsa:RelatesTo>uuid:437c3101-0e6a-41f5-ad49-8a09b3ee5589</wsa:RelatesTo>
|
||||
<wsa:MessageID>uuid:a8ddc513-40aa-10aa-821d-de7e4e771814</wsa:MessageID>
|
||||
</s:Header>
|
||||
<s:Body>
|
||||
<wsen:EnumerateResponse>
|
||||
<wsman:Items>
|
||||
<n1:DCIM_iDRACCardString>
|
||||
<n1:AttributeDisplayName>iDRAC Product Information</n1:AttributeDisplayName>
|
||||
<n1:AttributeName>Product</n1:AttributeName>
|
||||
<n1:CurrentValue>Integrated Dell Remote Access Controller</n1:CurrentValue>
|
||||
<n1:DefaultValue xsi:nil="true"/>
|
||||
<n1:Dependency xsi:nil="true"/>
|
||||
<n1:DisplayOrder>1</n1:DisplayOrder>
|
||||
<n1:FQDD>iDRAC.Embedded.1</n1:FQDD>
|
||||
<n1:GroupDisplayName>RAC Information</n1:GroupDisplayName>
|
||||
<n1:GroupID xsi:nil="true"/>
|
||||
<n1:InstanceID>iDRAC.Embedded.1#Info.1#Product</n1:InstanceID>
|
||||
<n1:IsReadOnly>true</n1:IsReadOnly>
|
||||
<n1:MaxLength>63</n1:MaxLength>
|
||||
<n1:MinLength>0</n1:MinLength>
|
||||
<n1:PendingValue xsi:nil="true"/>
|
||||
</n1:DCIM_iDRACCardString>
|
||||
</wsman:Items>
|
||||
<wsen:EnumerationContext/>
|
||||
<wsman:EndOfSequence/>
|
||||
</wsen:EnumerateResponse>
|
||||
</s:Body>
|
||||
</s:Envelope>
|
||||
|
Loading…
Reference in New Issue
Block a user