Skip to content

Commit

Permalink
added dependencies section for PTF NN agent, and updated diagram
Browse files Browse the repository at this point in the history
  • Loading branch information
antoninbas committed Jul 20, 2016
1 parent d5ec578 commit f7376df
Show file tree
Hide file tree
Showing 5 changed files with 476 additions and 1 deletion.
24 changes: 23 additions & 1 deletion ptf_nn/README.md
Expand Up @@ -8,11 +8,33 @@ the host running PTF).

---

## Dependencies

We rely on [nanomsg](http://nanomsg.org/) (a messaging library) to forward
packets between the PTF agent and the PTF test runner. You will therefore need
to install the following:

- [nanomsg](https://github.com/nanomsg/nanomsg/releases): we recommend
installing the `1.0.0` production release.
- [nnpy](https://github.com/nanomsg/nnpy): these are the Python bindings for
nanomsg. You may use the provided [install_nnpy.sh](install_nnpy.sh) script
to install nnpy. It will install a version of nnpy that we have tested.

We provide a [check_deps.py](check_deps.py) script that you can run to check
that nanomsg and nnpy are running properly.

## Overview

![PTF nanomsg overview](resources/ptf_nn.png)

---
In the above setup, we are able to capture and send packets on two different
machines (the PTF host and a remote host). Each agent acts as an intermediary
between a set of interfaces (connected to the switch) and the PTF
tester. Packets received on an interface (from the switch) will be tagged with
the port number and forwarded to the PTF tester. Packets received from the PTF
tester will be forwarded to the switch using the appropriate
interface. Communications between the PTF tester and each agent is done over TCP
using the nanomsg messaging library.

## Demo

Expand Down
17 changes: 17 additions & 0 deletions ptf_nn/check_deps.py
@@ -0,0 +1,17 @@
#!/usr/bin/env python

import nnpy
import sys

pub = nnpy.Socket(nnpy.AF_SP, nnpy.PUB)
pub.bind('inproc://foo')

sub = nnpy.Socket(nnpy.AF_SP, nnpy.SUB)
sub.connect('inproc://foo')
sub.setsockopt(nnpy.SUB, nnpy.SUB_SUBSCRIBE, '')

pub.send('hello, world')
recv = sub.recv()

if recv != 'hello, world':
sys.exit(1)
9 changes: 9 additions & 0 deletions ptf_nn/install_nnpy.sh
@@ -0,0 +1,9 @@
#!/bin/sh
set -e
git clone https://github.com/nanomsg/nnpy.git
# top of tree won't install
cd nnpy
git checkout c7e718a5173447c85182dc45f99e2abcf9cd4065
sudo pip install cffi
sudo pip install .
cd ..

0 comments on commit f7376df

Please sign in to comment.