Skip to content

little-dude/tgen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quickstart:

Build:

Dependencies

Build steps

  • server side:
    • clone this repo: git clone https://github.mv.usa.alcatel.com/corentih/tgen
    • make go-capnproto2 available in your $GOPATH: go get github.com/zombiezen/go-capnproto2/
    • run make go. A tgen binary should be built. Look at the help with ./tgen -h
  • python client:
    • create a virtual environment and activate it
    • run make py. A tar.gz package should be built under client/dist/tgenpy<version>.tar.gz.
    • install the package with pip install client/dist/tgenpy<version>.tar.gz.

Usage:

import tgenpy

# connect to the server
controller = tgenpy.Controller('localhost', '1234')

# create a new stream with 1000 ethernet frames:
stream = tgenpy.Stream()
ethernet = tgenpy.protocols.Ethernet2())
stream.layers.append(ethernet)
stream.count = 1000

# save the stream
controller.save_stream(stream)

# fetch the ports, find the loopback interface, and send and capture traffic:
port = controller.get_port('lo'):
    port.start_capture(packet_count=1000)
    port.start_send([stream.id])
    done, error = port.wait_capture(timeout=5000)
    if not done:
        print "capture did not finish after 5 seconds"
        port.stop_capture()
        port.wait_capture(timeout=2000)
    if error:
        print 'something when wrong: %s' % error

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published