- Community Home
- >
- Networking
- >
- Software Defined Networking
- >
- Re: Python language bindings for the REST API - hp...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2014 07:24 AM
02-16-2014 07:24 AM
Python language bindings for the REST API - hp-sdn-client
hp-sdn-client
A Python library that makes interaction with the HP SDN Controller REST API easy
This is a free open-source (Apache 2.0) library, that you can use to develop your own applications in Python.
It tries to abstract the complexity of dealing wth the REST API (JSON, Token Management etc..) and allows you to focus on your application logic.
You can install it from PyPi by using pip:
pip install hp-sdn-client
If you find this library useful, please star the repo on GitHub and if you'd like to contribute please fork it, make your changes and send me a pull request!
Code:
https://github.com/dave-tucker/hp-sdn-client
Docs:
https://hp-sdn-client.readthedocs.org/en/latest/index.html
Example:
import hpsdnclient as hp controller = '10.44.254.129' # Set up Authentication auth = hp.XAuthToken(user='sdn',password='skyline', server=controller) # Create an API object api = hp.Api(controller=controller, auth=auth) #API calls are then just a method call using "natural language" datapaths = api.get_datapaths() for datapath in datapaths: flows = api.get_flows(datapath.dpid) for flow in flows: print "This is a flow from {} to {} on DPID: {}".format(flow.eth_src, flow.eth_dst, datapath.dpid)
- Tags:
- Python
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2014 12:05 PM
02-16-2014 12:05 PM
Re: Python language bindings for the REST API - hp-sdn-client
Hi Dave,
just starting with the sdn controller and a couple of hp 5900 switches.
want to use python to create some apps, so found your information and tried to install...but failed...
I installed the sdn-controller on a virtual ubuntu server and tested it with my 5900 switches...succes!
Now i installed pip on this same server: "sudo apt-get install python-pip"
after this i tried to start "pip install hp-sdn-client", but failed.
can you help me with this?
root@ubuntu-server-12:/# pip install hp-sdn-client
Downloading/unpacking hp-sdn-client
Downloading hp-sdn-client-1.0.2.tar.gz (633Kb): 633Kb downloaded
Running setup.py egg_info for package hp-sdn-client
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/build/hp-sdn-client/setup.py", line 18, in <module>
from hpsdnclient import __version__
File "hpsdnclient/__init__.py", line 17, in <module>
from hpsdnclient.api import __version__, Api
File "hpsdnclient/api.py", line 23, in <module>
from hpsdnclient.core import CoreMixin
File "hpsdnclient/core.py", line 28, in <module>
import requests
ImportError: No module named requests
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 14, in <module>
File "/build/hp-sdn-client/setup.py", line 18, in <module>
from hpsdnclient import __version__
File "hpsdnclient/__init__.py", line 17, in <module>
from hpsdnclient.api import __version__, Api
File "hpsdnclient/api.py", line 23, in <module>
from hpsdnclient.core import CoreMixin
File "hpsdnclient/core.py", line 28, in <module>
import requests
ImportError: No module named requests
----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /root/.pip/pip.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2014 12:08 PM
02-16-2014 12:08 PM
Re: Python language bindings for the REST API - hp-sdn-client
Yes I can...
pip install requests
... then you can try
pip install hp-sdn-client
For some reason this dependency isn't being installed automatically. I'm looking in to it, but for now the workaround above should get you started!
-- Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2014 12:13 PM
02-16-2014 12:13 PM
Re: Python language bindings for the REST API - hp-sdn-client
PERFECT!
Thank you Dave!
root@ubuntu-server-12:/# pip install requests
Downloading/unpacking requests
Downloading requests-2.2.1.tar.gz (421Kb): 421Kb downloaded
Running setup.py egg_info for package requests
Installing collected packages: requests
Running setup.py install for requests
Successfully installed requests
Cleaning up...
root@ubuntu-server-12:/# pip install hp-sdn-client
Downloading/unpacking hp-sdn-client
Downloading hp-sdn-client-1.0.2.tar.gz (633Kb): 633Kb downloaded
Running setup.py egg_info for package hp-sdn-client
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/local/lib/python2.7/dist-packages (from hp-sdn-client)
Requirement already satisfied (use --upgrade to upgrade): distribute in /usr/lib/python2.7/dist-packages (from hp-sdn-client)
Installing collected packages: hp-sdn-client
Running setup.py install for hp-sdn-client
Successfully installed hp-sdn-client
Cleaning up...
root@ubuntu-server-12:/#
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2014 05:38 AM
02-18-2014 05:38 AM
Re: Python language bindings for the REST API - hp-sdn-client
Thank you Dave it's done ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2014 12:18 AM
02-25-2014 12:18 AM
Re: Python language bindings for the REST API - hp-sdn-client
Hi Dave,
Thanks for the code. I was able to execute the same on Ubuntu.
However the same does not work on Windows machine. Can you guide in this case?
Regards
Atul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2014 08:19 AM
02-25-2014 08:19 AM
Re: Python language bindings for the REST API - hp-sdn-client
Windows is a little more tricky.
I'll try and put together some comprehensive instructions for windows in the next few days...
-- Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2014 08:19 AM - edited 02-25-2014 08:20 AM
02-25-2014 08:19 AM - edited 02-25-2014 08:20 AM
Re: Python language bindings for the REST API - hp-sdn-client
v1.0.3 is now released which fixes the dependency errors mentioned in this thread
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-27-2014 10:43 AM
02-27-2014 10:43 AM
Re: Python language bindings for the REST API - hp-sdn-client
I'm using this python library to make some end to end tests on mininet. It's awesome and very helpfully because mininet is written in python too. I expect to send some pull requests soon.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-02-2014 03:16 AM
03-02-2014 03:16 AM
Re: Python language bindings for the REST API - hp-sdn-client
If you want some help with installation and first steps or you would like some demos and code walkthroughs of example applications please check out these videos on YouTube
http://www.youtube.com/playlist?list=PLhpgNkL46_235AgToyrhEMykVLaBTt6Bw
This also covers installation on Windows as requested.
@dave_tucker