Constantin Cretu
Ixia Senior System Test Engineer

Automation 101: The REST is the Future.

July 10, 2017 by Constantin Cretu

Ixia enabled REST capability in BreakingPoint a few years back and has continued to develop it. The recent 8.30 release (customer login required) introduces enhancements that enable users to parametrize network configurations, flexibly fetch statistics, granularly control tests, and more. This blog, however, will concentrate on the basics of REST automation with BreakingPoint.


RESTs simplicity and overwhelming adoption by all types of applications makes it an obvious choice for automation and testing. Its simplified structure, use of HTTP, and cloud readiness enable it to seamlessly integrate into test automation harnesses. REST can be used standalone to create new automation tests, but since it’s just HTTP requests and response, literally any programming language like Python or Perl can wrap around REST API calls. 

Getting Started

Users can download the Ixia Python Library that will wrap around the REST commands from the web interface of BreakingPoint.


BreakingPoint Web UI can be used  to download the REST API samples and help docs

To try the  Ixia Python sample you need Python 2.7 and the “requests” and “json” additional packages used in the Ixia example library above.   

The Python sample script and a Python library that implements over REST the most used operations are examples that can be replicated with other languages.

To test your environment, run the “” included in the above download.  Just customize the script with your chassis settings (chassis ip, username, password, slot, and ports):

#Details of the Chassis, username and password

bps = BPS('IP-Of-Chassis', 'user', 'pass')

# The below procedure will login to the BPS chassis.


# Showing current port reservation state


# Reserving first two ports of the first card in the chassis

bps.reservePorts(slot = 1, portList = [0,1], group = 1, force = True)

BreakingPoint REST API – Under the X-Ray Similar to the other Ixia products, the RESTAPI is accessed at: https://<REST Server>/api/v1/<product name>  (for Breaking Point: https://<IP-Of-Chassis>/api/v1/bps)

Let’s see one simple example with the BreakingPoint Python REST library abstracting the REST calls. The below script will login, get port status, and log out of a chassis.

#!/usr/bin/env python

#This command will import the BPS REST library

from bpsRest import *

#Creating an instance of the BPS object defined in bpsRest lib

bps = BPS('IP-Of-Chassis’, 'admin', 'admin')

# login


# showing current port reservation state

bps.portsState() # logging out bps.logout()

Now let’s see an example of the same actions (login, get port status, log out) with the REST interface calls, without using the sample bpsRest wrapper library:

#!/usr/bin/env python

import requests

import json

#Connectivity  details like IP and credentials to the bps chassis

ipstr = 'IP-Of-Chassis'

username = '<username>'

password =  '<password>'

#Creating an instance for http session in python

session = requests.Session()

#Login to the url using post request with the credentials in as json body "jdata"

url = 'https://' + ipstr + '/api/v1/auth/session'

jheaders = {'content-type': 'application/json'}

jdata = json.dumps({'username':username, 'password':password})

r =, data=jdata, headers=jheaders, verify=False)

if(r.status_code == 200):

   print 'Login successful. Welcome ' + username


    print r.content

#Using a GET request to obtain the status of the ports.

url = 'https://' + ipstr +'/api/v1/bps/ports/'

r = session.get(url)

#If successful. From the return json print 'portReservationState' value <

if(r.status_code == 200):

    print 'Port Status: ', r.json()['portReservationState']


    print r.content

#Log out using a DELETE request   


r = session.delete(url)

if(r.status_code == 204):

    print 'Log Out successful. Good Bye ' + username


    print r.content

As you may observe from the two examples above, the library significantly simplifies the actions. However, users are also advised to create their own REST calls without the wrapper to enjoy the flexibility it provides.

A more advanced script that will import a template, modify, run, and get real-time stats can be downloaded from here. Below are explanations of the main blocks of code included in the script and their purposes:

  1. Customizing methods by extending the BreakingPoint class:

In the first few blocks we create a class MY_BPS_REST that inherits the BPS class with 3 custom methods: saveAsNormalTest , viewNormalTest, and  stopTest.


    def saveAsNormalTest(self, name_, force, enableRequestPrints = False):



    def viewNormalTest(self, enableRequestPrints = False):


    def stopTest(self, runid, enableRequestPrints = False):

  1. Changing Test Strategy – Using Rest API to change security component:

We are loading a test that already exists in the system (in this case: 'Clientside Strikes') and modifying the security component ‘attackPlanIterations’ value to 2. To identify the component and the name of the parameter that we want to change, we printed the test configuration as a json string with the custom method (defined at paragraph 2.a. above): bps.viewNormalTest( enableRequestPrints = True). Similarly, you can modify other test elements, parameters (for  Network Neighborhood use modifyNetwork method from the library), or labs using the appropriate methods.

print "Mofifying %s existent template and saving as:  %s" % (template, testModel)

#bps.viewNormalTest( enableRequestPrints = True)

bps.modifyNormalTest(componentId = 'Security1', elementId = 'attackPlanIterations', Value=2)
  1. Start the test using a customized Network Neighborhood:
runid = bps.runTest(modelname = testModel,neighborhood = 'BreakingPoint Switching Jumbo Frames' , group = 1)
  1. Monitoring test run -  Fetching the real-time stats

We are getting the real-time stats and printing them using the method from the library: ‘getRTS(<runid> )’. This method is used to pull the stats from the system and print them continuously in a ‘loop‘in this case. In this example we cancel the execution once the test progress reaches 2%.

# showing progress and current statistics. Stop the test at 2% progress

progress = 0

while (progress < 2):

    progress = bps.getRTS(runid)




Sample Output of the stats, also depicting  the end of the execution at 2% progress

In Summary

While building out the BreakingPoint REST library, we’ve kept in mind the penetration and success of REST in the automation world and its future potential. Our BreakingPoint Virtual customers are already leveraging the benefits of such APIs. As most cloud apps heavily use REST, they will be able to easily integrate BreakingPoint on Amazon Web Services (AWS) in their existing automation framework. Ixia will continue to fortify its APIs to ensure our customers can leverage REST for most of their present and future automation needs. This is a good path forward as other organizations are also developing automation frameworks (like Robot Framework) that can work on top of REST.

Stay tuned for the next edition of this blog series where we will discuss tips and tricks to validate application policies and discuss performance limits of our 350+ application flows when run individually through automation. 


Author’s Note:This blog is co-written with my colleague Amritam Putatunda and is the second of our automation series. Read the first blog here.