Skip to main content

BreakingPoint REST API Python Wrapper

Project description

The BreakingPoint RESTv2 API Python Wrapper

pypi python license downloads

BreakingPoint detail

Network testing with BreakingPoint®. By simulating real-world legitimate traffic, distributed denial of service (DDoS), exploits, malware, and fuzzing, BreakingPoint validates an organization’s security infrastructure, reduces the risk of network degradation by almost 80%, and increases attack readiness by nearly 70%. And with our new TrafficREWIND solution, you'll get even more realistic and high-fidelity validation by adding production network insight into BreakingPoint test traffic configuration More details:

Install the package

pip install --upgrade bps-restpy

Start scripting

"""This script demonstrates how to get started with bps_restpy scripting.

# Title:  Python Script Sample To Run a Canned Test.
# Actions:
#   1. Login to BPS box
#   2. Reserve ports
#   3. Load a test from the box and start the run
#   4. Wait for the test to finish
#   5. Get test result
#   6. Get and print the Synopsis page from report
#   7. Unreserve ports
#   8. Logout


#================

########################################
import time, sys, os
# Import corresponding BPS RESTv2 python2.7/ 3 library from outside the folder with samples.
sys.path.insert(1, os.path.dirname(os.getcwd()))

from bps_restpy.bps import BPS, pp

########################################


########################################
# Demo script global variables
########################################
# Demo script global variables
canned_test_name = 'AppSim'
#bps system info
bps_system  = '<BPS_BOX_IP/HOSTNAME>'
bpsuser     = 'bps user'
bpspass     = 'bps pass'


slot_number = 2
port_list   = [0, 1]

########################################


########################################
# Login to BPS box
bps = BPS(bps_system, bpsuser, bpspass)
bps.login()


########################################
print("Load a canned test: ")
bps.testmodel.load(canned_test_name)

########################################
print("Reserve Ports")
for p in port_list:
    bps.topology.reserve([{'slot': slot_number, 'port': p, 'group': 2}])


########################################
print("Run test and Get Stats:")
test_id_json = bps.testmodel.run(modelname=canned_test_name, group=2)
testid = str( test_id_json["runid"] )
run_id = 'TEST-' + testid
print("Test Run Id: %s"%run_id)

#get the ids for all tests running on the chassis
runningTests_Ids = [test['id'] for  test in bps.topology.runningTest.get()] 
#wait while the test is still running
while run_id in runningTests_Ids:
     run_state =  bps.topology.runningTest[run_id].get()
     #print progress if test started
     try: print ('progress: %s%% , runtime %ss' % (run_state['progress'], run_state['runtime'] ))
     except: print ("Starting...")
     time.sleep(2)
     #update the current running tests
     runningTests_Ids = [test['id'] for  test in bps.topology.runningTest.get()] 

print("~The test finished the execution.")
results = bps.reports.search(searchString=canned_test_name, limit=10, sort="endTime", sortorder="descending")
result  = results[0]
print ("%s execution duration %s ended with status: %s " % (result['name'], result['duration'], result['result']) )

#getting 3.4 Section: Synopsys Summary of Results from the Report
tabledata = bps.reports.getReportTable(runid=testid, sectionId="3.4")
pp(tabledata)

print ("Unreserving the ports")
for p in port_list:
    bps.topology.unreserve([{'slot': slot_number, 'port': p, 'group': 2}])

bps.logout()

wew

Documentation

Documentation is available using the following methods:

  • Online web based documentation and samples
  • On your BreakingPoint System RestApi found near the BreakingPoint App
  • Documentation available in the online doc browser is also inlined in each class, property and method and can be viewed using the python help command
    from bps_restpy.bps import BPS, pp
    
    #login to your Breaking Point System
    help(BPS)
    bps = BPS('your_bps_IP_or_FQDN', 'admin', 'admin')
    
    help(bps.testmodel.importModel)
    

Additional Samples

Visit the OpenIxia breakingpoint-restpy sample site maintained by solution architects for in depth end-to-end samples that demonstrate the following:

  • building a configuration
    • from scratch
    • from an existing BreakingPoint configuration
  • running the configuration
    • connecting ports to hardware
    • starting protocols
    • starting traffic
  • getting statistics
    • port stats
    • traffic stats

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bps_restpy-26.0.6.tar.gz (119.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bps_restpy-26.0.6-py3-none-any.whl (142.4 kB view details)

Uploaded Python 3

File details

Details for the file bps_restpy-26.0.6.tar.gz.

File metadata

  • Download URL: bps_restpy-26.0.6.tar.gz
  • Upload date:
  • Size: 119.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for bps_restpy-26.0.6.tar.gz
Algorithm Hash digest
SHA256 3ad862f786b20bf1d690345e06416592a7b006d5e8978b2a355d2f7ed4cb5905
MD5 ea414da75a79b7122051e74c4c2d39a2
BLAKE2b-256 a6030f88841095995944b02b4da4a33972f05b6ba1be9443d3eb32938569a202

See more details on using hashes here.

File details

Details for the file bps_restpy-26.0.6-py3-none-any.whl.

File metadata

  • Download URL: bps_restpy-26.0.6-py3-none-any.whl
  • Upload date:
  • Size: 142.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for bps_restpy-26.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2fd88c58dc6dab52028a972aab4bce5f86065fd8335960ec65a7221811c7bbe6
MD5 0a6e9e59cd45c25144093f0477b97381
BLAKE2b-256 99f3a1c3a54d5fc9516eb378643cbc0cd405e6850e668ddd17056723adbacf2b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page