HewlettPackard / python-hpOneView

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

scmb example script is unable to connect to rabbit. raises exception with AMQPLAIN auth-mod #359

Closed ffdarkpenguin closed 6 years ago

ffdarkpenguin commented 6 years ago

Scenario/Intent

I'm working on https://github.com/HewlettPackard/oneview-redfish-toolkit project and need to access the rabbitMQ of OneView. Run the scmb.py script in the examples\scmb folder of the project.

Environment Details

Python environment: amqp==2.2.2 asn1crypto==0.24.0 cffi==1.11.4 click==6.7 configparser==3.5.0 cryptography==2.1.4 Flask==0.12.2 Flask-API==1.0 future==0.16.0 hpOneView==4.4.0 idna==2.6 itsdangerous==0.24 Jinja2==2.10 jsonschema==2.6.0 MarkupSafe==1.0 -e git+https://github.com/HewlettPackard/oneview-redfish-toolkit@0d1fd2da27c5c61cb8a1606f95981f873430662c#egg=oneview_redfish_toolkit pbr==3.1.1 pycparser==2.18 pyOpenSSL==17.5.0 six==1.11.0 vine==1.1.4 Werkzeug==0.14.1

Steps to Reproduce

  1. download the script: https://github.com/HewlettPackard/python-hpOneView/blob/master/examples/scmb/scmb.py
  2. install the dependencies (see list above in my venv)
  3. generate rabbit key pair ./scmb.py -a [HPE OneView Appliance IP] -u Administrator -p MyPass -g
  4. download rabbit key pair and root ca cert ./scmb.py -a [HPE OneView Appliance IP] -u Administrator -p MyPass -d
  5. run the scmb.py script to listen to rabbit: ./scmb.py -a [HPE OneView Appliance IP] -u Administrator -p MyPass

    Expected Result

    Oneview alerts printed in the screen

Actual Result

Traceback (most recent call last): File "./scmb.py", line 203, in sys.exit(main()) File "./scmb.py", line 196, in main recv(args.host, args.route) File "./scmb.py", line 103, in recv conn.connect() File "/home/ff/dev/oneview-redfish-toolkit/.venv/lib/python3.5/site-packages/amqp/connection.py", line 288, in connect self.drain_events(timeout=self.connect_timeout) File "/home/ff/dev/oneview-redfish-toolkit/.venv/lib/python3.5/site-packages/amqp/connection.py", line 471, in drain_events while not self.blocking_read(timeout): File "/home/ff/dev/oneview-redfish-toolkit/.venv/lib/python3.5/site-packages/amqp/connection.py", line 477, in blocking_read return self.on_inbound_frame(frame) File "/home/ff/dev/oneview-redfish-toolkit/.venv/lib/python3.5/site-packages/amqp/method_framing.py", line 55, in on_frame callback(channel, method_sig, buf, None) File "/home/ff/dev/oneview-redfish-toolkit/.venv/lib/python3.5/site-packages/amqp/connection.py", line 481, in on_inbound_method method_sig, payload, content, File "/home/ff/dev/oneview-redfish-toolkit/.venv/lib/python3.5/site-packages/amqp/abstract_channel.py", line 128, in dispatch_method listener(*args) File "/home/ff/dev/oneview-redfish-toolkit/.venv/lib/python3.5/site-packages/amqp/connection.py", line 603, in _on_close (class_id, method_id), ConnectionError) amqp.exceptions.AccessRefused: (0, 0): (403) ACCESS_REFUSED - Login was refused using authentication mechanism AMQPLAIN. For details see the broker logfile.

avgovind commented 6 years ago

I too faced this issue and was able to resolve by using 'amqplib' in place of 'amqp' library. Here is the output of 'pip3 list' command: Package Version


amqplib 1.0.2 asn1crypto 0.24.0 certifi 2018.4.16 cffi 1.11.5 chardet 3.0.4 cryptography 2.2.2 future 0.16.0 hpOneView 4.5.0 idna 2.6 pip 10.0.1 pycparser 2.18 pyOpenSSL 17.5.0 requests 2.18.4 schedule 0.5.0 setuptools 28.8.0 six 1.11.0 urllib3 1.22 vine 1.1.4 wheel 0.31.0

In my code my import statement is: import amqplib.client_0_8 as amqp

With these two changes I could make this sample work! I dont know if this is the right way to fix!

sijeesh commented 6 years ago

I have tried with the latest version of "amqp" and its working.

Closing this issue as this can be fixed using the latest version of amqp library.

Feel free to reopen if you need more information / help.