HewlettPackard / python-hpOneView

DEPRECATED - no longer actively maintained. New repository: https://github.com/HewlettPackard/oneview-python
MIT License
87 stars 57 forks source link

call to hpOneView version reports 3.3.0 on hpOneView 4.1.0 and appliance_node_information is unknown #311

Closed ffdarkpenguin closed 7 years ago

ffdarkpenguin commented 7 years ago

Scenario/Intent

trying to run the script below:

from pprint import pprint import hpOneView from hpOneView.oneview_client import OneViewClient from hpOneView.exceptions import HPOneViewException

config = { 'ip': 'ov-ff', 'api_version': 300, 'credentials': { 'userName': 'administrator', 'password': 'ff123123' } }

print('hpOneView version: {}'.format(hpOneView.version)) ov_conn = OneViewClient(config) pprint(ov_conn.appliance_node_information.get_status())

Environment Details

4.1.0 installed with pip: pip install --upgrade hpOneView Collecting hpOneView Requirement already up-to-date: future>=0.15.2 in ./redfish-venv/lib/python3.4/site-packages (from hpOneView) Installing collected packages: hpOneView Found existing installation: hpOneView 4.0.0 Uninstalling hpOneView-4.0.0: Successfully uninstalled hpOneView-4.0.0 Successfully installed hpOneView-4.1.0

Steps to Reproduce

install hpOpenView 4.1.0 using pip run the script above

Expected Result

[What do you expect to happen after taking the steps above?] print version: expect 4.1.0

pprint(ov_conn.appliance_node_information.get_status()): expect appliance information not an exception

Actual Result

python teste.py

hpOneView version: 3.3.0 Traceback (most recent call last): File "./teste.py", line 24, in pprint(ov_conn.appliance_node_information.get_status()) AttributeError: 'OneViewClient' object has no attribute 'appliance_node_information' (redfish-venv) ff@darkvm:~/dev/redfish>

fgbulsoni commented 7 years ago

Nice catch on the 3.3.0, it must've gotten left over.

Apparently that is coming from here, it should definitely be updated to match the 4.1.0 current version.

As for the appliance node information, I'm not sure but to me it looks like something is wrong in your environment.

I've just tried installing the hponeview sdk through pip and it worked fine:

#### First no hponeview installed
vagrant@ecosystem-centos7:~
$ python dev/python-hpOneView/examples/appliance_node_information.py
Traceback (most recent call last):
  File "dev/python-hpOneView/examples/appliance_node_information.py", line 25, in <module>
    from hpOneView.oneview_client import OneViewClient
ImportError: No module named hpOneView.oneview_client

## Installing it through pip
vagrant@ecosystem-centos7:~
$ pip install hponeview
Downloading/unpacking hponeview
  Downloading hpOneView-4.1.0.tar.gz (74kB): 74kB downloaded
  Running setup.py (path:/tmp/pip_build_vagrant/hponeview/setup.py) egg_info for package hponeview
Requirement already satisfied (use --upgrade to upgrade): future>=0.15.2 in /usr/local/lib/python2.7/site-packages (from hponeview)
Installing collected packages: hponeview
  Running setup.py install for hponeview
  Could not find .egg-info directory in install record for hponeview
Successfully installed hponeview
Cleaning up...

## now trying the same example again
vagrant@ecosystem-centos7:~
$ python dev/python-hpOneView/examples/appliance_node_information.py

Get node status information from appliance:

{u'cpu': 8,
 u'cpuSpeed': 1865,
 u'cpuSpeedUnits': u'MHz',
 u'cpuStatusError': u'Minimum CPU requirement of 2 @ 2 GHz not met.',
 u'lan': 10000,
 u'lanLinkStatusError': None,
 u'lanStatusError': None,
 u'lanUnits': u'Mb/s',
 u'memory': 12,
 u'memoryStatusError': None,
 u'memoryUnits': u'GB',
 u'networkConfigured': True}

Get node version information from appliance

{u'build': u'0296809',
 u'category': u'appliance',
 u'compatibility': u'3.10',
 u'created': None,
 u'date': u'2017-05-18T23:10:15+0000',
 u'eTag': None,
 u'family': u'HPE OneView VM',
 u'major': u'3',
 u'minor': u'10',
 u'modelNumber': u'HPE OneView - Demo VM,',
 u'modified': None,
 u'platformType': u'hardware',
 u'revision': u'00',
 u'serialNumber': u'VMware-42268f936c931809-782bbd693b9fd4ca',
 u'softwareVersion': u'3.10.00-0296809',
 u'type': u'NodeVersionDto4',
 u'uri': u'/rest/appliance/nodeinfo/version',
 u'uuid': u'2ead6950-b295-46e7-87a7-fb16ac1248f1'}

This was tested running this example from the repository.

I've also tested your example in my environment, and other than print('hpOneView version: {}'.format(hpOneView.version)) failing, the get_status also worked normally.

ffdarkpenguin commented 7 years ago

Thanks Felipe for the reply. Was in fact something in my env. Glad to catch something useful for you guys. Feel free to close this when you solve the version problem or when ever you want. Best regards,

Flávio

fgbulsoni commented 7 years ago

__init__.py fixed on #313