Knowledge base: Knowledge Base > ByteBlower > Examples
Using the ByteBlower Python API
Posted by Vincent De Maertelaere, Last modified by Craig Godbold on 29 November 2023 11:23 AM
Since lots of our customers were asking for it.  Here it is: our experimental Python API.

The Python API allows users to script tests just like our TCL API does.  Even more, the syntax is almost the same:  Remove the dot from the TCL function names and you'll have the Python function!  Isn't that easy?
It is not all puppies and sunshine.  Because Python isn't TCL and the release is experimental, there are some warnings and caveats!  Those warnings and caveats are listed later in this article.


After installing Python, you can download the Python API from here.  After following the installation wizard, everything should be ready to go!

Basic usage

After installation, you can open a terminal and import the ByteBlower package.
from byteblowerll.byteblower import ByteBlower
This imports the ByteBlower module into the current Python space.  Now we can connect to a server and create a port:
# Create a ByteBlower instance first.  In TCL we should write [ ByteBlower Instance.Get ]
byteblower_instance = ByteBlower.InstanceGet()
# Connect to a server (TCL: [ $byteblower_instance Server.Add "byteblower-tutorial..."])
server = byteblower_instance.ServerAdd("")

# Create a port (TCL: [ $server Port.Create "trunk-1-1" ])
port = server.PortCreate("trunk-1-1")

# print the current configuration
print port.DescriptionGet()

Python has a neat build-in help function. This works on all API objects. As of now returns a list of methods you can call on the object.
which gives following text.
Help on ByteBlowerPort in module byteblower object:

class ByteBlowerPort(AbstractObject)
 |  Method resolution order:
 |      ByteBlowerPort
 |      AbstractObject
 |      __builtin__.object
 |  Methods defined here:
 |  CapabilityGetByName(self, name)
 |  CapabilityIsSupported(self, name)
 |  CapabilityListGet(self)
 |  GetByteBlowerInterface(self)
 |  InterfaceGet(self)
 |  InterfaceNameGet(self)
 |  InterfaceSpeedGet(self)
 |  Layer2EthIIGet(self)
 |  Layer2EthIISet(self)
 |  Layer3IPv4Get(self)
The complete TCL documentation can be found on Remove the dots (.) in the function names to get the Python name.


We are creating a library of examples that you can use as a reference for your own development. These examples can be found on our github account: 
Feel free to use it. Are you missing an example, don't hesitate to ask us at

Warnings and caveats

The above Python API is a  public beta version. It's fully functional and used both in- and outside Excentis. But a couple points are worth mentioning:
  • There is not yet a complete documentation available.  Since the API is almost the same as the TCL API, the TCL documentation is a good starting point.
  • All time configuration items are in nanoseconds and integer values.  There is no support for the shorted syntax as we have in TCL (e.g. "5ms" should be configured as 5000000)
(0 vote(s))
Not helpful

Comments (0)

We to help you!