Hello Plexxi - Plexxi/PlexxiControlCLI GitHub Wiki
Hello Plexxi
To verify that your Plexxi Control python bindings and python environment are properly configured, we will connect to the Plexxi Control process and say hello.
Plexxi Control Setup
We are assuming that the Plexxi Control application is setup and running. You have successfully launched the Plexxi UI and logged in to Control. You have your Plexxi Switches up and running and a Plexxi Ring has been formed, which you can see from the UI Dashboard: Plexxi Control API > Hello Plexxi > Screen Shot 2013-08-09 at 1.49.24 PM.png
Python Data Access
Let’s do in python some of what the Plexxi UI is doing to build the table above:
$ python
Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
from plexxi.core.api.binding import *
from plexxi.core.api.session import *
exchange=CoreSession.connect("http://127.0.0.1:8080/PlexxiCore/api", True, "admin", "admin")
for sw in PlexxiSwitch.getAll():
print sw.getName(), sw.getOperationalStage(), sw.getStatus(), sw.getPlexxiRing().getName()
P_01 S3P HEALTHY PlexxiRing-0a9c6a67-87c7-4169-80c1-54b5eba12d41
P_05 S3P HEALTHY PlexxiRing-0a9c6a67-87c7-4169-80c1-54b5eba12d41
P_04 S3P HEALTHY PlexxiRing-0a9c6a67-87c7-4169-80c1-54b5eba12d41
P_03 S3P HEALTHY PlexxiRing-0a9c6a67-87c7-4169-80c1-54b5eba12d41
P_06 S3P HEALTHY PlexxiRing-0a9c6a67-87c7-4169-80c1-54b5eba12d41
P_02 S3P HEALTHY PlexxiRing-0a9c6a67-87c7-4169-80c1-54b5eba12d41
If you see the above results, you have successfully connected to the Plexxi Control via python and have accessed the Plexxi Switch data.
NOTE In a secure environment utilizing https, the connection syntax is:
exchange=CoreSession.connect("https://127.0.0.1:8443/PlexxiCore/api", False, "admin", "admin")