Git Product home page Git Product logo

trafpy's Introduction

TrafPy

TrafPy is a Python package for the generation, management and standardisation of network traffic.

Documentation: https://trafpy.readthedocs.io/

Example

Generate simple flow-centric traffic for an arbitrary network you want to put under 10% traffic load with 16 leaf node end points which have communication link capacities of 1,250 information units per unit time. Save the traffic trace in a universally compatible file format so you can import it into any simulation, emulation, or experimentation test bed independently of TrafPy.

import trafpy.generator as tpg
import gzip, pickle

# init network
net = tpg.gen_arbitrary_network(num_eps=16, ep_capacity=1250)

# define flow characteristic distributions
node_dist = tpg.gen_uniform_node_dist(eps=net.graph['endpoints'])
interarrival_time_dist = {1.0: 1.0}
flow_size_dist = {1.0: 1.0}

# define network load config
network_load_config = {'network_rate_capacity': net.graph['max_nw_capacity'],
                       'ep_link_capacity': net.graph['ep_link_capacity'],
                       'target_load_fraction': 0.1}

# generate traffic demands
demand_data = tpg.create_demand_data(eps=net.graph['endpoints'],
                                     node_dist=node_dist,
                                     flow_size_dist=flow_size_dist,
                                     interarrival_time_dist=interarrival_time_dist,
                                     network_load_config=network_load_config,
                                     jensen_shannon_distance_threshold=0.9)

# save
Path('data/').mkdir(parents=True)
with gzip.open('data/demand_data.pickle', 'wb') as f:
    pickle.dump(demand_data, f)

See the tutorial and the examples directory for more information.

Install

Open Git Bash. Change the current working directory to the location where you want to clone this GitHub project, and run:

$ git clone https://github.com/cwfparsonson/trafpy

In the project's root directory, run:

$ python setup.py install

Then, still in the root directory, install the required packages with either pip:

$ pip install -r requirements/default.txt

or conda:

$ conda install --file requirements/default.txt

You should then be able to import TrafPy into your Python script from any directory on your machine

import trafpy

Contributing

File an issue here to report any bugs or new suggestions. Or, even better, for the repository on GitHub and create a pull request. If you want help making a pull request or are new to git, ask on the contributing issue you raise and/or see TrafPy's contributing guide.

License

TrafPy uses Apache License 2.0.

trafpy's People

Contributors

cwfparsonson avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.