ONTAP Rest API Discussions

NodeControllerFrusSchema is wrong

Pedro2
While using the latest version (9.8.0) available at https://pypi.org/project/netapp-ontap/ there is a problem if I try to get the node controller FRUs:

 

from netapp_ontap import config, HostConnection
from netapp_ontap.resources import Node

config.CONNECTION = HostConnection('myfiler.example.com', username='admin', password='mypass', verify=False)

for n in Node.get_collection(fields='controller'):
    pass

 

Then I get a traceback:

 

Traceback (most recent call last):
  File "test.py", line 6, in <module>
    for n in Node.get_collection(fields='controller'):
  File "/home/pedro/venv/lib64/python3.6/site-packages/netapp_ontap/resource.py", line 640, in _get_collection
    obj = cls.from_dict(record, *args)
  File "/home/pedro/venv/lib64/python3.6/site-packages/netapp_ontap/resource.py", line 486, in from_dict
    raise NetAppRestError(cause=exc) from None
netapp_ontap.error.NetAppRestError:  Caused by ValidationError({'controller': {'frus': {0: {'id': ['"FAN1" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}, 1: {'id': ['"FAN3" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}, 2: {'id': ['"FAN2" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}, 3: {'id': ['"PSU1" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}, 4: {'id': ['"PSU2" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}, 5: {'id': ['"DIMM-4" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}, 6: {'id': ['"DIMM-3" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}, 7: {'id': ['"DIMM-2" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}, 8: {'id': ['"DIMM-1" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}, 9: {'id': ['"NVRA" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}, 10: {'id': ['"BOOT MEDIA" could not be interpreted as a valid size. Valid values  are of the form \\d+[KB|MB|GB|TB|PB]']}}}},)

 

The problem is in netapp_ontap/models/node_controller_frus.py:22 where the NodeControllerFrusSchema indicates that the id field is a "Size". If I change it to be a "fields.Str" then it works as expected.
 
Can someone here help get this fixed?
1 REPLY 1

Re: NodeControllerFrusSchema is wrong

RobertBlackhart

Thanks for the report. I'll file an issue to have our API team look into this.

 

In case it helps, the other workaround you could do would be to have it skip returning that field:

from netapp_ontap import config, HostConnection
from netapp_ontap.resources import Node

config.CONNECTION = HostConnection('myfiler.example.com', username='admin', password='mypass', verify=False)

for n in Node.get_collection(fields='controller,!controller.frus.id'):
    pass

This will return all the same data except for the controller.frus.id field. Then when it goes to parse the return, there will be no issue.

View solution in original post

Earn Rewards for Your Review!
GPI Review Banner
All Community Forums
Public