Getting Started - Plexxi/PlexxiControlCLI GitHub Wiki

This Library works with python 2.7.x

  1. Get the files from this repository, put them on your PlexxiControl machine
PlexxiControlShow.py - show commands
PlexxiControlConfig.py - configuration commands (def/get)
PlexxiControlCommonLib.py - just a set of useful library functions, dont run these directly
  1. Check your version - This repository currently for PlexxiControl 1.3.1, and service packs

  2. Install the python libs (they have to match your Control/Switch version exactly)

pip-python install -lv http://pypi.plexxi.com/packages/plexxi-1.3.1.tar.gz
or
pip-python install -lv http://pypi.plexxi.com/packages/plexxi-1.3.1-sp1.tar.gz
  1. Add this to your .pythonrc (connects to the local PlexxiControl automatically)
#!/usr/bin/python
import os
import sys

try:
 import readline
 print 'Using readline'
except ImportError:
 print "Module readline not available."
else:
 import rlcompleter
 readline.parse_and_bind("tab: complete")

try:
  from plexxi.core.api.binding import *
  from plexxi.core.api.session import *
  from plexxi.core.api.util import *
except:
  print "Failed to load Plexxi Python Bindings"

try:
  exchange = CoreSession.connect("http://127.0.0.1:8080/PlexxiCore/api", True, "admin", "admin")
  print "Connected to PlexxiCore at localhost"
except:
  print "Failed to connect to local PlexxiCore"

add this to your .bash_profile

export PYTHONSTARTUP=~/.pythonrc
  1. Run python, import the library and show, show, show
[root@localhost 131]# python
Python 2.7.3 (default, Jul 24 2012, 10:05:38) 
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Using readline
Connected to PlexxiCore at localhost
>>> from PlexxiControlShow import *
>>> from PlexxiControlConfig import *
>>> showRingSummary()
 
                  Number of Plexxi Rings =  1
 
Ring Name:  PlexxiRing-92a497dd-e67d-4a09-bb8b-7ee2c718d43d

      NumConfluentRings:  1
 
      Active switches ( 6 )

		Switch:  sim_01 , stationMac:  08:00:00:00:00:01  -  S3P  -  HEALTHY

		Switch:  sim_02 , stationMac:  08:00:00:00:00:02  -  S3P  -  HEALTHY

		Switch:  sim_03 , stationMac:  08:00:00:00:00:03  -  S3P  -  HEALTHY

		Switch:  sim_04 , stationMac:  08:00:00:00:00:04  -  S3P  -  HEALTHY

		Switch:  sim_05 , stationMac:  08:00:00:00:00:05  -  S3P  -  HEALTHY

		Switch:  sim_06 , stationMac:  08:00:00:00:00:06  -  S3P  -  HEALTHY
>>>